MediaWiki
REL1_19
|
Simple version of LockManager based on using FS lock files. More...
Public Member Functions | |
__construct (array $config) | |
Construct a new instance from configuration. | |
__destruct () | |
Protected Member Functions | |
doLock (array $paths, $type) | |
Lock resources with the given keys and lock type. | |
doSingleLock ($path, $type) | |
Lock a single resource key. | |
doSingleUnlock ($path, $type) | |
Unlock a single resource key. | |
doUnlock (array $paths, $type) | |
Unlock resources with the given keys and lock type. | |
getLockPath ($path) | |
Get the path to the lock file for a key. | |
Protected Attributes | |
$handles = array() | |
$lockDir | |
$lockTypeMap | |
Private Member Functions | |
closeLockHandles ($path, array $handlesToClose) | |
pruneKeyLockFiles ($path) |
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 15 of file FSLockManager.php.
FSLockManager::__construct | ( | array $ | config | ) |
Construct a new instance from configuration.
$config includes: 'lockDirectory' : Directory containing the lock files
array | $config |
Reimplemented from LockManager.
Definition at line 36 of file FSLockManager.php.
Definition at line 195 of file FSLockManager.php.
References $path, and doSingleUnlock().
FSLockManager::closeLockHandles | ( | $ | path, |
array $ | handlesToClose | ||
) | [private] |
Definition at line 155 of file FSLockManager.php.
References $path, Status\newGood(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by doSingleUnlock().
FSLockManager::doLock | ( | array $ | paths, |
$ | type | ||
) | [protected] |
Lock resources with the given keys and lock type.
$paths | Array List of storage paths |
$type | integer LockManager::LOCK_* constant |
Reimplemented from LockManager.
Definition at line 41 of file FSLockManager.php.
References $path, doSingleLock(), doUnlock(), and Status\newGood().
FSLockManager::doSingleLock | ( | $ | path, |
$ | type | ||
) | [protected] |
Lock a single resource key.
$path | string |
$type | integer |
Definition at line 76 of file FSLockManager.php.
References $path, getLockPath(), LockManager\LOCK_EX, LockManager\LOCK_SH, Status\newGood(), wfMkdirParents(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by doLock().
FSLockManager::doSingleUnlock | ( | $ | path, |
$ | type | ||
) | [protected] |
Unlock a single resource key.
$path | string |
$type | integer |
Definition at line 117 of file FSLockManager.php.
References $path, closeLockHandles(), Status\newGood(), pruneKeyLockFiles(), and wfIsWindows().
Referenced by __destruct(), and doUnlock().
FSLockManager::doUnlock | ( | array $ | paths, |
$ | type | ||
) | [protected] |
Unlock resources with the given keys and lock type.
$paths | Array List of storage paths |
$type | integer LockManager::LOCK_* constant |
Reimplemented from LockManager.
Definition at line 59 of file FSLockManager.php.
References $path, doSingleUnlock(), and Status\newGood().
Referenced by doLock().
FSLockManager::getLockPath | ( | $ | path | ) | [protected] |
Get the path to the lock file for a key.
$path | string |
Definition at line 190 of file FSLockManager.php.
References $path, and LockManager\sha1Base36().
Referenced by doSingleLock(), and pruneKeyLockFiles().
FSLockManager::pruneKeyLockFiles | ( | $ | path | ) | [private] |
Definition at line 170 of file FSLockManager.php.
References $path, getLockPath(), Status\newGood(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by doSingleUnlock().
FSLockManager::$handles = array() [protected] |
Definition at line 26 of file FSLockManager.php.
FSLockManager::$lockDir [protected] |
Definition at line 23 of file FSLockManager.php.
FSLockManager::$lockTypeMap [protected] |
array( self::LOCK_SH => self::LOCK_SH, self::LOCK_UW => self::LOCK_SH, self::LOCK_EX => self::LOCK_EX )
Reimplemented from LockManager.
Definition at line 17 of file FSLockManager.php.