MediaWiki master
NullLockManager.php
Go to the documentation of this file.
1<?php
28 protected function doLock( array $paths, $type ) {
29 foreach ( $paths as $path ) {
30 if ( isset( $this->locksHeld[$path][$type] ) ) {
31 ++$this->locksHeld[$path][$type];
32 } else {
33 $this->locksHeld[$path][$type] = 1;
34 }
35 }
36
37 return StatusValue::newGood();
38 }
39
40 protected function doUnlock( array $paths, $type ) {
41 $status = StatusValue::newGood();
42
43 foreach ( $paths as $path ) {
44 if ( isset( $this->locksHeld[$path][$type] ) ) {
45 if ( --$this->locksHeld[$path][$type] <= 0 ) {
46 unset( $this->locksHeld[$path][$type] );
47 if ( !$this->locksHeld[$path] ) {
48 unset( $this->locksHeld[$path] ); // clean up
49 }
50 }
51 } else {
52 $status->warning( 'lockmanager-notlocked', $path );
53 }
54 }
55
56 return $status;
57 }
58}
Resource locking handling.
Simple lock management based on in-process 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.