MediaWiki  master
NullLockManager.php
Go to the documentation of this file.
1 <?php
29  protected function doLock( array $paths, $type ) {
30  foreach ( $paths as $path ) {
31  if ( isset( $this->locksHeld[$path][$type] ) ) {
32  ++$this->locksHeld[$path][$type];
33  } else {
34  $this->locksHeld[$path][$type] = 1;
35  }
36  }
37 
38  return StatusValue::newGood();
39  }
40 
41  protected function doUnlock( array $paths, $type ) {
42  $status = StatusValue::newGood();
43 
44  foreach ( $paths as $path ) {
45  if ( isset( $this->locksHeld[$path][$type] ) ) {
46  if ( --$this->locksHeld[$path][$type] <= 0 ) {
47  unset( $this->locksHeld[$path][$type] );
48  if ( !$this->locksHeld[$path] ) {
49  unset( $this->locksHeld[$path] ); // clean up
50  }
51  }
52  } else {
53  $status->warning( 'lockmanager-notlocked', $path );
54  }
55  }
56 
57  return $status;
58  }
59 }
LockManager
Class for handling resource locking.
Definition: LockManager.php:47
NullLockManager\doLock
doLock(array $paths, $type)
Lock resources with the given keys and lock type.
Definition: NullLockManager.php:29
NullLockManager\doUnlock
doUnlock(array $paths, $type)
Unlock resources with the given keys and lock type.
Definition: NullLockManager.php:41
NullLockManager
Simple version of LockManager that only does lock reference counting.
Definition: NullLockManager.php:28
StatusValue\newGood
static newGood( $value=null)
Factory function for good results.
Definition: StatusValue.php:81
$path
$path
Definition: NoLocalSettings.php:25
$type
$type
Definition: testCompression.php:52