70 parent::__construct( $config );
72 $this->dbServers = $config[
'dbServers'];
74 $this->srvsByBucket = array_filter( $config[
'dbsByBucket'],
'is_array' );
75 $this->srvsByBucket = array_values( $this->srvsByBucket );
77 if ( isset( $config[
'lockExpiry'] ) ) {
78 $this->lockExpiry = $config[
'lockExpiry'];
80 $met = ini_get(
'max_execution_time' );
81 $this->lockExpiry = $met ? $met : 60;
83 $this->safeDelay = ( $this->lockExpiry <= 0 )
89 $this->statusCache = isset( $config[
'srvCache'] )
101 $status = StatusValue::newGood();
102 foreach ( $pathsByType
as $type => $paths ) {
112 return StatusValue::newGood();
144 if ( !isset( $this->conns[$lockDb] ) ) {
145 if ( $this->dbServers[$lockDb] instanceof
IDatabase ) {
147 $db = $this->dbServers[$lockDb];
148 } elseif ( is_array( $this->dbServers[$lockDb] ) ) {
150 $config = $this->dbServers[$lockDb];
151 $db = Database::factory( $config[
'type'], $config );
153 throw new UnexpectedValueException(
"No server called '$lockDb'." );
157 # If the connection drops, try to avoid letting the DB rollback
158 # and release the locks before the file operations are finished.
159 # This won't handle the case of DB server restarts however.
161 if ( $this->lockExpiry > 0 ) {
167 $this->conns[$lockDb] = $db;
170 return $this->conns[$lockDb];
191 return ( $this->safeDelay > 0 )
192 ? !$this->statusCache->get( $this->
getMissKey( $lockDb ) )
203 return ( $this->safeDelay > 0 )
204 ? $this->statusCache->set( $this->
getMissKey( $lockDb ), 1, $this->safeDelay )
215 return 'dblockmanager:downservers:' . str_replace(
' ',
'_', $lockDb );
223 foreach ( $this->conns
as $db ) {
interface is intended to be more or less compatible with the PHP memcached client.
Database error base class.
Version of LockManager based on using named/row DB locks.
__destruct()
Make sure remaining locks get cleared for sanity.
cacheRecordFailure( $lockDb)
Log a lock request failure to the cache.
IDatabase[] $conns
Map Database connections (DB name => Database)
freeLocksOnServer( $lockSrv, array $pathsByType)
Get a connection to a lock server and release locks on $paths.
getMissKey( $lockDb)
Get a cache key for recent query misses for a DB.
getConnection( $lockDb)
Get (or reuse) a connection to a lock DB.
initConnection( $lockDb, IDatabase $db)
Do additional initialization for new lock DB connection.
getLocksOnServer( $lockSrv, array $pathsByType)
@TODO change this code to work in one batch
array[] IDatabase[] $dbServers
Map of (DB names => server config or IDatabase)
__construct(array $config)
Construct a new instance from configuration.
doGetLocksOnServer( $lockSrv, array $paths, $type)
cacheCheckFailures( $lockDb)
Checks if the DB has not recently had connection/query errors.
Simple store for keeping values in an associative array for the current process.
Version of LockManager that uses a quorum from peer servers for locks.
releaseAllLocks()
Release all locks that this session is holding.
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
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
the array() calling protocol came about after MediaWiki 1.4rc1.
namespace are movable Hooks may change this value to override the return value of MWNamespace::isMovable(). 'NewDifferenceEngine' do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
returning false will NOT prevent logging $e
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Basic database interface for live and lazy-loaded relation database handles.