MediaWiki master
NullLockManager.php
Go to the documentation of this file.
1<?php
7
9
18 protected function doLockByType( array $pathsByType ) {
19 foreach ( $pathsByType as $type => $paths ) {
20 foreach ( $paths as $path ) {
21 if ( isset( $this->locksHeld[$path][$type] ) ) {
22 ++$this->locksHeld[$path][$type];
23 } else {
24 $this->locksHeld[$path][$type] = 1;
25 }
26 }
27 }
28
29 return StatusValue::newGood();
30 }
31
33 protected function doUnlockByType( array $pathsByType ) {
34 $status = StatusValue::newGood();
35 foreach ( $pathsByType as $type => $paths ) {
36 foreach ( $paths as $path ) {
37 if ( isset( $this->locksHeld[$path][$type] ) ) {
38 if ( --$this->locksHeld[$path][$type] <= 0 ) {
39 unset( $this->locksHeld[$path][$type] );
40 if ( !$this->locksHeld[$path] ) {
41 unset( $this->locksHeld[$path] ); // clean up
42 }
43 }
44 } else {
45 $status->warning( 'lockmanager-notlocked', $path );
46 }
47 }
48 }
49
50 return $status;
51 }
52}
54class_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.
doUnlockByType(array $pathsByType)
LockManager::unlockByType() StatusValue
doLockByType(array $pathsByType)
LockManager::lockByType() StatusValue