MediaWiki
master
Toggle main menu visibility
NullLockManager.php
Go to the documentation of this file.
1
<?php
6
namespace
Wikimedia\LockManager;
7
8
use StatusValue;
9
16
class
NullLockManager
extends
LockManager
{
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
}
53
54
class_alias( NullLockManager::class,
'NullLockManager'
);
$path
$path
Definition
NoLocalSettings.php:14
Wikimedia\LockManager\LockManager
Resource locking handling.
Definition
LockManager.php:37
Wikimedia\LockManager\NullLockManager
Simple lock management based on in-process reference counting.
Definition
NullLockManager.php:16
Wikimedia\LockManager\NullLockManager\doUnlockByType
doUnlockByType(array $pathsByType)
Release a set of locks.StatusValue LockManager\unlockByType()
Definition
NullLockManager.php:33
Wikimedia\LockManager\NullLockManager\doLockByType
doLockByType(array $pathsByType)
Acquire a set of locks without blocking.If some locks could not be acquired, then the other locks sho...
Definition
NullLockManager.php:18
includes
libs
LockManager
NullLockManager.php
Generated on
for MediaWiki by
1.18.0