MediaWiki REL1_39
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}
Class for handling resource locking.
Simple version of LockManager that only does lock reference counting.
doLock(array $paths, $type)
Lock resources with the given keys and lock type.
doUnlock(array $paths, $type)
Unlock resources with the given keys and lock type.