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 }
doLock(array $paths, $type)
static newGood( $value=null)
Factory function for good results.
Definition: StatusValue.php:81
doUnlock(array $paths, $type)