MediaWiki master
|
Simple lock management based on server-local temporary files. More...
Inherits LockManager.
Public Member Functions | |
__construct (array $config) | |
Construct a new instance from configuration. | |
__destruct () | |
Make sure remaining locks get cleared. | |
Public Member Functions inherited from LockManager | |
lock (array $paths, $type=self::LOCK_EX, $timeout=0) | |
Lock the resources at the given abstract paths. | |
lockByType (array $pathsByType, $timeout=0) | |
Lock the resources at the given abstract paths. | |
unlock (array $paths, $type=self::LOCK_EX) | |
Unlock the resources at the given abstract paths. | |
unlockByType (array $pathsByType) | |
Unlock the resources at the given abstract paths. | |
Protected Member Functions | |
doLock (array $paths, $type) | |
doSingleLock ( $path, $type) | |
Lock a single resource key. | |
doSingleUnlock ( $path, $type) | |
Unlock a single resource key. | |
doUnlock (array $paths, $type) | |
getLockPath ( $path) | |
Get the path to the lock file for a key. | |
Protected Member Functions inherited from LockManager | |
doLockByType (array $pathsByType) | |
doUnlockByType (array $pathsByType) | |
normalizePathsByType (array $pathsByType) | |
Normalize the $paths array by converting LOCK_UW locks into the appropriate type and removing any duplicated paths for each lock type. | |
sha1Base36Absolute ( $path) | |
Get the base 36 SHA-1 of a string, padded to 31 digits. | |
Protected Attributes | |
array | $handles = [] |
Map of (locked key => lock file handle) | |
bool | $isWindows |
string | $lockDir |
Global dir for all servers. | |
array | $lockTypeMap |
Mapping of lock types to the type actually used. | |
Protected Attributes inherited from LockManager | |
string | $domain |
domain (usually wiki ID) | |
array | $locksHeld = [] |
Map of (resource path => lock type => count) | |
int | $lockTTL |
maximum time locks can be held | |
array | $lockTypeMap |
Mapping of lock types to the type actually used. | |
LoggerInterface | $logger |
string | $session |
Random 32-char hex number. | |
const | CLI_LOCK_TTL = 3600 |
Default lock TTL in CLI mode. | |
const | MAX_LOCK_TTL = 2 * 3600 |
Max expected lock expiry in any context. | |
const | MIN_GUESSED_LOCK_TTL = 5 * 60 |
The minimum lock TTL if it is guessed from max_execution_time rather than configured. | |
const | MIN_LOCK_TTL = 5 |
Minimum lock TTL. | |
Additional Inherited Members | |
Public Attributes inherited from LockManager | |
const | LOCK_EX = 3 |
const | LOCK_SH = 1 |
Lock types; stronger locks have higher values. | |
const | LOCK_UW = 2 |
Simple lock management based on server-local temporary files.
All locks are non-blocking, which avoids deadlocks.
This should work fine for small sites running from a single web server. Do not use this with 'lockDirectory' set to an NFS mount unless the NFS client is at least version 2.6.12. Otherwise, the BSD flock() locks will be ignored; see http://nfs.sourceforge.net/#section_d.
Definition at line 34 of file FSLockManager.php.
FSLockManager::__construct | ( | array | $config | ) |
Construct a new instance from configuration.
array | $config | Includes:
|
Reimplemented from LockManager.
Definition at line 57 of file FSLockManager.php.
FSLockManager::__destruct | ( | ) |
Make sure remaining locks get cleared.
Definition at line 248 of file FSLockManager.php.
References $path, and doSingleUnlock().
|
protected |
array | $paths | |
int | $type |
Reimplemented from LockManager.
Definition at line 70 of file FSLockManager.php.
References $path, doSingleLock(), and doUnlock().
|
protected |
Lock a single resource key.
string | $path | |
int | $type |
Definition at line 112 of file FSLockManager.php.
References $path, getLockPath(), LockManager\LOCK_EX, and LockManager\LOCK_SH.
Referenced by doLock().
|
protected |
Unlock a single resource key.
string | $path | |
int | $type |
Definition at line 162 of file FSLockManager.php.
References $path.
Referenced by __destruct(), and doUnlock().
|
protected |
array | $paths | |
int | $type |
Reimplemented from LockManager.
Definition at line 95 of file FSLockManager.php.
References $path, and doSingleUnlock().
Referenced by doLock().
|
protected |
Get the path to the lock file for a key.
string | $path |
Definition at line 241 of file FSLockManager.php.
Referenced by doSingleLock().
|
protected |
Map of (locked key => lock file handle)
Definition at line 46 of file FSLockManager.php.
|
protected |
Definition at line 49 of file FSLockManager.php.
|
protected |
Global dir for all servers.
Definition at line 43 of file FSLockManager.php.
|
protected |
Mapping of lock types to the type actually used.
Definition at line 36 of file FSLockManager.php.