MediaWiki  REL1_19
FSLockManager Class Reference

Simple version of LockManager based on using FS lock files. More...

Inheritance diagram for FSLockManager:
Collaboration diagram for FSLockManager:

List of all members.

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)

Detailed Description

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.

Since:
1.19

Definition at line 15 of file FSLockManager.php.


Constructor & Destructor Documentation

FSLockManager::__construct ( array $  config)

Construct a new instance from configuration.

$config includes: 'lockDirectory' : Directory containing the lock files

Parameters:
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().

Here is the call graph for this function:


Member Function Documentation

FSLockManager::closeLockHandles ( path,
array $  handlesToClose 
) [private]

Definition at line 155 of file FSLockManager.php.

References $path, Status\newGood(), wfRestoreWarnings(), and wfSuppressWarnings().

Referenced by doSingleUnlock().

Here is the call graph for this function:

Here is the caller graph for this function:

FSLockManager::doLock ( array $  paths,
type 
) [protected]

Lock resources with the given keys and lock type.

Parameters:
$pathsArray List of storage paths
$typeinteger LockManager::LOCK_* constant
Returns:
string

Reimplemented from LockManager.

Definition at line 41 of file FSLockManager.php.

References $path, doSingleLock(), doUnlock(), and Status\newGood().

Here is the call graph for this function:

FSLockManager::doSingleLock ( path,
type 
) [protected]

Lock a single resource key.

Parameters:
$pathstring
$typeinteger
Returns:
Status

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().

Here is the call graph for this function:

Here is the caller graph for this function:

FSLockManager::doSingleUnlock ( path,
type 
) [protected]

Unlock a single resource key.

Parameters:
$pathstring
$typeinteger
Returns:
Status

Definition at line 117 of file FSLockManager.php.

References $path, closeLockHandles(), Status\newGood(), pruneKeyLockFiles(), and wfIsWindows().

Referenced by __destruct(), and doUnlock().

Here is the call graph for this function:

Here is the caller graph for this function:

FSLockManager::doUnlock ( array $  paths,
type 
) [protected]

Unlock resources with the given keys and lock type.

Parameters:
$pathsArray List of storage paths
$typeinteger LockManager::LOCK_* constant
Returns:
string

Reimplemented from LockManager.

Definition at line 59 of file FSLockManager.php.

References $path, doSingleUnlock(), and Status\newGood().

Referenced by doLock().

Here is the call graph for this function:

Here is the caller graph for this function:

FSLockManager::getLockPath ( path) [protected]

Get the path to the lock file for a key.

Parameters:
$pathstring
Returns:
string

Definition at line 190 of file FSLockManager.php.

References $path, and LockManager\sha1Base36().

Referenced by doSingleLock(), and pruneKeyLockFiles().

Here is the call graph for this function:

Here is the caller graph for this function:

FSLockManager::pruneKeyLockFiles ( path) [private]

Definition at line 170 of file FSLockManager.php.

References $path, getLockPath(), Status\newGood(), wfRestoreWarnings(), and wfSuppressWarnings().

Referenced by doSingleUnlock().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

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]
Initial value:
 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.


The documentation for this class was generated from the following file: