Go to the documentation of this file.
48 self::LOCK_SH => self::LOCK_SH,
49 self::LOCK_UW => self::LOCK_EX,
50 self::LOCK_EX => self::LOCK_EX
73 $this->domain = isset( $config[
'domain'] ) ? $config[
'domain'] :
wfWikiID();
74 if ( isset( $config[
'lockTTL'] ) ) {
75 $this->lockTTL = max( 1, $config[
'lockTTL'] );
76 } elseif ( PHP_SAPI ===
'cli' ) {
77 $this->lockTTL = 2 * 3600;
79 $met = ini_get(
'max_execution_time' );
80 $this->lockTTL = max( 5 * 60, 2 * (
int)$met );
92 final public function lock(
array $paths,
$type = self::LOCK_EX, $timeout = 0 ) {
108 $msleep =
array( 0, 50, 100, 300, 500 );
109 $start = microtime(
true );
112 $elapsed = microtime(
true ) - $start;
113 if ( $status->isOK() || $elapsed >= $timeout || $elapsed < 0 ) {
116 usleep( 1e3 * ( next( $msleep ) ?: 1000 ) );
117 $elapsed = microtime(
true ) - $start;
118 }
while ( $elapsed < $timeout && $elapsed >= 0 );
160 return wfBaseConvert( sha1(
"{$this->domain}:{$path}" ), 16, 36, 31 );
172 return sha1(
"{$this->domain}:{$path}" );
185 foreach ( $pathsByType
as $type => $paths ) {
186 $res[$this->lockTypeMap[
$type]] = array_unique( $paths );
200 $lockedByType =
array();
201 foreach ( $pathsByType
as $type => $paths ) {
203 if ( $status->isOK() ) {
204 $lockedByType[
$type] = $paths;
207 foreach ( $lockedByType
as $lType => $lPaths ) {
208 $status->merge( $this->
doUnlock( $lPaths, $lType ) );
234 foreach ( $pathsByType
as $type => $paths ) {
Class for handling resource locking.
doLock(array $paths, $type)
Lock resources with the given keys and lock type.
array $locksHeld
Map of (resource path => lock type => count) *.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
const LOCK_SH
Lock types; stronger locks have higher values.
sha1Base16Absolute( $path)
Get the base 16 SHA-1 of a string, padded to 31 digits.
wfProfileIn( $functionname)
Begin profiling of a function.
static newGood( $value=null)
Factory function for good results.
doUnlock(array $paths, $type)
Unlock resources with the given keys and lock type.
array $lockTypeMap
Mapping of lock types to the type actually used *.
normalizePathsByType(array $pathsByType)
Normalize the $paths array by converting LOCK_UW locks into the appropriate type and removing any dup...
sha1Base36Absolute( $path)
Get the base 36 SHA-1 of a string, padded to 31 digits.
Simple version of LockManager that does nothing.
wfProfileOut( $functionname='missing')
Stop profiling of a function.
doUnlockByType(array $pathsByType)
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
unlock(array $paths, $type=self::LOCK_EX)
Unlock the resources at the given abstract paths.
lock(array $paths, $type=self::LOCK_EX, $timeout=0)
Lock the resources at the given abstract paths.
unlockByType(array $pathsByType)
Unlock the resources at the given abstract paths.
wfWikiID()
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
doUnlock(array $paths, $type)
Unlock resources with the given keys and lock type.
wfBaseConvert( $input, $sourceBase, $destBase, $pad=1, $lowercase=true, $engine='auto')
Convert an arbitrarily-long digit string from one numeric base to another, optionally zero-padding to...
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
__construct(array $config)
Construct a new instance from configuration.
doLock(array $paths, $type)
Lock resources with the given keys and lock type.
doLockByType(array $pathsByType)
lockByType(array $pathsByType, $timeout=0)
Lock the resources at the given abstract paths.