MediaWiki master
NullLockManager.php
Go to the documentation of this file.
1<?php
7
9
18 protected function doLock( array $paths, $type ) {
19 foreach ( $paths as $path ) {
20 if ( isset( $this->locksHeld[$path][$type] ) ) {
21 ++$this->locksHeld[$path][$type];
22 } else {
23 $this->locksHeld[$path][$type] = 1;
24 }
25 }
26
27 return StatusValue::newGood();
28 }
29
31 protected function doUnlock( array $paths, $type ) {
32 $status = StatusValue::newGood();
33
34 foreach ( $paths as $path ) {
35 if ( isset( $this->locksHeld[$path][$type] ) ) {
36 if ( --$this->locksHeld[$path][$type] <= 0 ) {
37 unset( $this->locksHeld[$path][$type] );
38 if ( !$this->locksHeld[$path] ) {
39 unset( $this->locksHeld[$path] ); // clean up
40 }
41 }
42 } else {
43 $status->warning( 'lockmanager-notlocked', $path );
44 }
45 }
46
47 return $status;
48 }
49}
51class_alias( NullLockManager::class, 'NullLockManager' );
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Resource locking handling.
Simple lock management based on in-process reference counting.
doUnlock(array $paths, $type)
Unlock resources with the given keys and lock type.StatusValue
doLock(array $paths, $type)
Lock resources with the given keys and lock type.StatusValue