Go to the documentation of this file.
43 public function scaleLoads( &$loads, $group =
false, $wiki =
false );
53 public function getLagTimes( $serverIndexes, $wiki );
60 public function scaleLoads( &$loads, $group =
false, $wiki =
false ) {
64 return array_fill_keys( $serverIndexes, 0 );
82 public function scaleLoads( &$loads, $group =
false, $wiki =
false ) {
85 public function getLagTimes( $serverIndexes, $wiki ) {
86 if ( count( $serverIndexes ) == 1 && reset( $serverIndexes ) == 0 ) {
88 return array( 0 => 0 );
101 $masterName = $this->parent->getServerName( 0 );
102 $memcKey =
wfMemcKey(
'lag_times', $masterName );
103 $times =
$wgMemc->get( $memcKey );
104 if ( is_array( $times ) ) {
105 # Randomly recache with probability rising over $expiry
106 $elapsed = time() - $times[
'timestamp'];
107 $chance = max( 0, ( $expiry - $elapsed ) * $requestRate );
108 if ( mt_rand( 0, $chance ) != 0 ) {
109 unset( $times[
'timestamp'] );
118 # Cache key missing or expired
119 if (
$wgMemc->add(
"$memcKey:lock", 1, 10 ) ) {
120 # Let this process alone update the cache value
124 } elseif ( is_array( $times ) ) {
125 # Could not acquire lock but an old cache exists, so use it
126 unset( $times[
'timestamp'] );
132 foreach ( $serverIndexes
as $i ) {
133 if ( $i == 0 ) { # Master
135 } elseif (
false !== ( $conn = $this->parent->getAnyOpenConnection( $i ) ) ) {
136 $times[$i] = $conn->getLag();
137 } elseif (
false !== ( $conn = $this->parent->openConnection( $i, $wiki ) ) ) {
138 $times[$i] = $conn->getLag();
142 # Add a timestamp key so we know when it was cached
143 $times[
'timestamp'] = time();
144 $wgMemc->set( $memcKey, $times, $expiry + 10 );
145 unset( $times[
'timestamp'] );
getLagTimes( $serverIndexes, $wiki)
Return an estimate of replication lag for each server.
__construct( $parent)
Construct a new LoadMonitor with a given LoadBalancer parent.
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
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php For a description of the see design txt $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest to get request data $wgMemc
scaleLoads(&$loads, $group=false, $wiki=false)
Perform pre-connection load ratio adjustment.
getLagTimes( $serverIndexes, $wiki)
Return an estimate of replication lag for each server.
An interface for database load monitoring.
__construct( $parent)
Construct a new LoadMonitor with a given LoadBalancer parent.
getLagTimes( $serverIndexes, $wiki)
Return an estimate of replication lag for each server.
Class for handling function-scope profiling.
wfGetMainCache()
Get the main cache object.
wfMemcKey()
Get a cache key.
wfIncrStats( $key, $count=1)
Increment a statistics counter.
Basic MySQL load monitor with no external dependencies Uses memcached to cache the replication lag fo...
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
Database load balancing object.
Class for asserting that a callback happens when an dummy object leaves scope.
scaleLoads(&$loads, $group=false, $wiki=false)
Perform pre-connection load ratio adjustment.
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( $parent)
Construct a new LoadMonitor with a given LoadBalancer parent.
scaleLoads(&$loads, $group=false, $wiki=false)
Perform pre-connection load ratio adjustment.