MediaWiki
1.23.2
|
Simple version of LockManager based on using FS lock files. More...
Public Member Functions | |
__construct (array $config) | |
Construct a new instance from configuration. More... | |
__destruct () | |
Make sure remaining locks get cleared for sanity. More... | |
Public Member Functions inherited from LockManager | |
lock (array $paths, $type=self::LOCK_EX, $timeout=0) | |
Lock the resources at the given abstract paths. More... | |
lockByType (array $pathsByType, $timeout=0) | |
Lock the resources at the given abstract paths. More... | |
unlock (array $paths, $type=self::LOCK_EX) | |
Unlock the resources at the given abstract paths. More... | |
unlockByType (array $pathsByType) | |
Unlock the resources at the given abstract paths. More... | |
Protected Member Functions | |
doLock (array $paths, $type) | |
doSingleLock ( $path, $type) | |
Lock a single resource key. More... | |
doSingleUnlock ( $path, $type) | |
Unlock a single resource key. More... | |
doUnlock (array $paths, $type) | |
getLockPath ( $path) | |
Get the path to the lock file for a key. More... | |
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. More... | |
sha1Base16Absolute ( $path) | |
Get the base 16 SHA-1 of a string, padded to 31 digits. More... | |
sha1Base36Absolute ( $path) | |
Get the base 36 SHA-1 of a string, padded to 31 digits. More... | |
Protected Attributes | |
array | $handles = array() |
Map of (locked key => lock file handle) *. More... | |
$lockDir | |
array | $lockTypeMap |
Mapping of lock types to the type actually used *. More... | |
Protected Attributes inherited from LockManager | |
$domain | |
array | $locksHeld = array() |
Map of (resource path => lock type => count) *. More... | |
$lockTTL | |
array | $lockTypeMap |
Mapping of lock types to the type actually used *. More... | |
Private Member Functions | |
closeLockHandles ( $path, array $handlesToClose) | |
pruneKeyLockFiles ( $path) | |
Additional Inherited Members | |
Public Attributes inherited from LockManager | |
const | LOCK_EX = 3 |
const | LOCK_SH = 1 |
Lock types; stronger locks have higher values. More... | |
const | LOCK_UW = 2 |
Simple version of LockManager based on using FS lock files.
All locks are non-blocking, which avoids deadlocks.
This should work fine for small sites running off one 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 36 of file FSLockManager.php.
FSLockManager::__construct | ( | array | $config | ) |
Construct a new instance from configuration.
array | $config | Includes:
|
Reimplemented from LockManager.
Definition at line 53 of file FSLockManager.php.
FSLockManager::__destruct | ( | ) |
Make sure remaining locks get cleared for sanity.
Definition at line 238 of file FSLockManager.php.
References $path, as, and doSingleUnlock().
|
private |
string | $path | |
array | $handlesToClose |
Definition at line 195 of file FSLockManager.php.
References $path, as, and Status\newGood().
Referenced by doSingleUnlock().
|
protected |
array | $paths | |
int | $type |
Reimplemented from LockManager.
Definition at line 65 of file FSLockManager.php.
References $path, $type, array(), as, doSingleLock(), doUnlock(), and Status\newGood().
|
protected |
Lock a single resource key.
string | $path | |
int | $type |
Definition at line 107 of file FSLockManager.php.
References $path, $type, getLockPath(), LockManager\LOCK_EX, LockManager\LOCK_SH, Status\newGood(), wfMkdirParents(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by doLock().
|
protected |
Unlock a single resource key.
string | $path | |
int | $type |
Definition at line 152 of file FSLockManager.php.
References $path, $type, array(), closeLockHandles(), Status\newGood(), pruneKeyLockFiles(), and wfIsWindows().
Referenced by __destruct(), and doUnlock().
|
protected |
array | $paths | |
int | $type |
Reimplemented from LockManager.
Definition at line 90 of file FSLockManager.php.
References $path, $type, as, doSingleUnlock(), and Status\newGood().
Referenced by doLock().
|
protected |
Get the path to the lock file for a key.
string | $path |
Definition at line 231 of file FSLockManager.php.
Referenced by doSingleLock(), and pruneKeyLockFiles().
|
private |
string | $path |
Definition at line 213 of file FSLockManager.php.
References $path, getLockPath(), and Status\newGood().
Referenced by doSingleUnlock().
Map of (locked key => lock file handle) *.
Definition at line 45 of file FSLockManager.php.
|
protected |
Definition at line 43 of file FSLockManager.php.
|
protected |
Mapping of lock types to the type actually used *.
Definition at line 37 of file FSLockManager.php.