Go to the documentation of this file.
49 $pathsToLock =
array();
51 foreach ( $pathsByType
as $type => $paths ) {
53 if ( isset( $this->locksHeld[
$path][
$type] ) ) {
62 $lockedPaths =
array();
64 foreach ( $pathsToLock
as $bucket => $pathsToLockByType ) {
67 if ( !$status->isOK() ) {
73 foreach ( $pathsToLockByType
as $type => $paths ) {
88 $pathsToUnlock =
array();
89 foreach ( $pathsByType
as $type => $paths ) {
91 if ( !isset( $this->locksHeld[
$path][
$type] ) ) {
92 $status->warning(
'lockmanager-notlocked',
$path );
101 if ( !count( $this->locksHeld[
$path] ) ) {
102 unset( $this->locksHeld[
$path] );
110 foreach ( $pathsToUnlock
as $bucket => $pathsToUnlockByType ) {
113 if ( !count( $this->locksHeld ) ) {
115 $this->degradedBuckets =
array();
133 $votesLeft = count( $this->srvsByBucket[$bucket] );
134 $quorum = floor( $votesLeft / 2 + 1 );
136 foreach ( $this->srvsByBucket[$bucket]
as $lockSrv ) {
139 $status->warning(
'lockmanager-fail-svr-acquire', $lockSrv );
140 $this->degradedBuckets[$bucket] = time();
145 if ( !$status->isOK() ) {
149 if ( $yesVotes >= $quorum ) {
153 $votesNeeded = $quorum - $yesVotes;
154 if ( $votesNeeded > $votesLeft ) {
159 $status->setResult(
false );
175 $votesLeft = count( $this->srvsByBucket[$bucket] );
176 $quorum = floor( $votesLeft / 2 + 1 );
177 $isDegraded = isset( $this->degradedBuckets[$bucket] );
178 foreach ( $this->srvsByBucket[$bucket]
as $lockSrv ) {
180 $status->warning(
'lockmanager-fail-svr-release', $lockSrv );
187 if ( $yesVotes >= $quorum && !$isDegraded ) {
194 $status->setResult( $yesVotes >= $quorum );
207 $prefix = substr( sha1(
$path ), 0, 2 );
208 return (
int)base_convert( $prefix, 16, 10 ) % count( $this->srvsByBucket );
218 abstract protected function isServerUp( $lockSrv );
Class for handling resource locking.
doUnlockByType(array $pathsByType)
getBucketFromPath( $path)
Get the bucket for resource path.
array $degradedBuckets
Map of degraded buckets *.
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
doLockingRequestBucket( $bucket, array $pathsByType)
Attempt to acquire locks with the peers for a bucket.
static newGood( $value=null)
Factory function for good results.
Version of LockManager that uses a quorum from peer servers for locks.
releaseAllLocks()
Release all locks that this session is holding.
isServerUp( $lockSrv)
Check if a lock server is up.
doLockByType(array $pathsByType)
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
doUnlockingRequestBucket( $bucket, array $pathsByType)
Attempt to release locks with the peers for a bucket.
doUnlock(array $paths, $type)
Unlock resources with the given keys and lock type.
array $srvsByBucket
Map of bucket indexes to peer server lists *.
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
freeLocksOnServer( $lockSrv, array $pathsByType)
Get a connection to a lock server and release locks on $paths.
doLock(array $paths, $type)
Lock resources with the given keys and lock type.
getLocksOnServer( $lockSrv, array $pathsByType)
Get a connection to a lock server and acquire locks.