# Load the revision (including cur_text) into this object
function loadContent( $noredir = false )
{
- global $wgOut, $wgMwRedir, $wgRequest, $wgIsPg;
+ global $wgOut, $wgMwRedir, $wgRequest, $wgIsPg, $wgLoadBalancer;
# Query variables :P
$oldid = $wgRequest->getVal( 'oldid' );
$this->mTitle->mRestrictionsLoaded = true;
wfFreeResult( $res );
} else { # oldid set, retrieve historical version
+ $wgLoadBalancer->force(-1);
$oldtable=$wgIsPg?'"old"':'old';
$sql = "SELECT old_namespace,old_title,old_text,old_timestamp,".
"old_user,old_user_text,old_comment,old_flags FROM old ".
"WHERE old_id={$oldid}";
$res = wfQuery( $sql, DB_READ, $fname );
+ $wgLoadBalancer->force(0);
if ( 0 == wfNumRows( $res ) ) {
return;
}
# Get a ban from the DB, with either the given address or the given username
function load( $address = "", $user = 0, $killExpired = true )
{
- $fname = 'Block::load';
+ global $wgLoadBalancer;
+ $fname = 'Block::load';
$ret = false;
$killed = false;
"' OR ipb_user={$user})";
}
- $res = wfQuery( $sql, DB_READ, $fname );
- if ( 0 == wfNumRows( $res ) ) {
+ $wgLoadBalancer->force(-1);
+ $res = wfQuery( $sql, DB_READ, $fname );
+ $wgLoadBalancer->force(0);
+ if ( 0 == wfNumRows( $res ) ) {
# User is not blocked
$this->clear();
} else {
{
global $wgUser, $wgTitle, $wgOut, $wgLang, $wgRequest;
global $wgDisableTextSearch, $wgInputEncoding;
- $fname = "SearchEngine::showResults";
+ global $wgLoadBalancer;
+
+ $wgLoadBalancer->force(-1);
+
+ $fname = "SearchEngine::showResults";
$search = $wgRequest->getText( 'search' );
$wgOut->addHTML( "<p>{$sl}</p>\n" );
$wgOut->addHTML( $powersearch );
}
- }
+ $wgLoadBalancer->force(0);
+ }
function legalSearchChars()
{
'standard' => 'Standard',
'nostalgia' => 'Nostalgia',
'cologneblue' => 'CologneBlue'
-);
+) + $wgExtraSkins;
if( $wgUsePHPTal ) {
#$wgValidSkinNames[] = 'PHPTal';
#$wgValidSkinNames['davinci'] = 'DaVinci';
# Pass a title object, not a title string
function makeLinkObj( &$nt, $text= '', $query = '', $trail = '', $prefix = '' )
{
- global $wgOut, $wgUser;
+ global $wgOut, $wgUser, $wgLoadBalancer;
if ( $nt->isExternal() ) {
$u = $nt->getFullURL();
$link = $nt->getPrefixedURL();
} else {
$threshold = $wgUser->getOption('stubthreshold') ;
if ( $threshold > 0 ) {
- $res = wfQuery ( "SELECT LENGTH(cur_text) AS x, cur_namespace, cur_is_redirect FROM cur WHERE cur_id='{$aid}'", DB_READ ) ;
-
+ $wgLoadBalancer->force(-1);
+ $res = wfQuery ( "SELECT LENGTH(cur_text) AS x, cur_namespace, cur_is_redirect FROM cur WHERE cur_id='{$aid}'", DB_READ ) ;
+ $wgLoadBalancer->force(0);
if ( wfNumRows( $res ) > 0 ) {
$s = wfFetchObject( $res );
$size = $s->x;
function wfSpecialAllpages( $par=NULL )
{
- global $indexMaxperpage, $wgRequest;
+ global $indexMaxperpage, $wgRequest, $wgLoadBalancer;
$indexMaxperpage = 480;
$from = $wgRequest->getVal( 'from' );
+
+ $wgLoadBalancer->force(-1);
if( $par ) {
indexShowChunk( $par );
} else {
indexShowToplevel();
}
+
+ $wgLoadBalancer->force(0);
}
function indexShowToplevel()
function wfSpecialMaintenance( $par=NULL )
{
global $wgUser, $wgOut, $wgLang, $wgTitle, $wgRequest, $wgLanguageCode;
- global $wgMiserMode;
+ global $wgMiserMode, $wgLoadBalancer;
if ( $wgMiserMode ) {
$wgOut->addWikiText( wfMsg( "perfdisabled" ) );
return;
}
+ $wgLoadBalancer->force(-1);
+
$submitmll = $wgRequest->getVal( 'submitmll' );
if( $par )
else
$subfunction = $wgRequest->getText( 'subfunction' );
- if ( $subfunction == "disambiguations" ) return wfSpecialDisambiguations() ;
- if ( $subfunction == "doubleredirects" ) return wfSpecialDoubleRedirects() ;
- if ( $subfunction == "brokenredirects" ) return wfSpecialBrokenRedirects() ;
- if ( $subfunction == "selflinks" ) return wfSpecialSelfLinks() ;
- if ( $subfunction == "mispeelings" ) return wfSpecialMispeelings() ;
- if ( $subfunction == "missinglanguagelinks" ) return wfSpecialMissingLanguageLinks() ;
- if ( !is_null( $submitmll ) ) return wfSpecialMissingLanguageLinks() ;
+ $done = true;
+
+ if ( $subfunction == "disambiguations" ) {
+ wfSpecialDisambiguations() ;
+ } elseif ( $subfunction == "doubleredirects" ) {
+ wfSpecialDoubleRedirects() ;
+ } elseif ( $subfunction == "brokenredirects" ) {
+ wfSpecialBrokenRedirects() ;
+ } elseif ( $subfunction == "selflinks" ) {
+ wfSpecialSelfLinks() ;
+ } elseif ( $subfunction == "mispeelings" ) {
+ wfSpecialMispeelings() ;
+ } elseif ( $subfunction == "missinglanguagelinks" ) {
+ wfSpecialMissingLanguageLinks() ;
+ } elseif ( !is_null( $submitmll ) ) {
+ wfSpecialMissingLanguageLinks() ;
+ } else {
+ $done = false;
+ }
+
+ $wgLoadBalancer->force(0);
+ if ( $done ) {
+ return;
+ }
$sk = $wgUser->getSkin();
$ns = $wgLang->getNamespaces() ;
function wfSpecialStatistics()
{
- global $wgUser, $wgOut, $wgLang, $wgIsPg;
+ global $wgUser, $wgOut, $wgLang, $wgIsPg, $wgLoadBalancer;
$fname = "wfSpecialStatistics";
+ $wgLoadBalancer->force(-1);
+
$wgOut->addHTML( "<h2>" . wfMsg( "sitestats" ) . "</h2>\n" );
$sql = "SELECT COUNT(cur_id) AS total FROM cur";
$wgLang->formatNum( $total ),
$wgLang->formatNum( $admins ), $ap );
$wgOut->addWikiText( $text );
+
+ $wgLoadBalancer->force(0);
}
?>
function wfSpecialWatchlist()
{
- global $wgUser, $wgOut, $wgLang, $wgTitle, $wgMemc;
+ global $wgUser, $wgOut, $wgLang, $wgTitle, $wgMemc, $wgLoadBalancer;
global $wgUseWatchlistCache, $wgWLCacheTimeout, $wgDBname, $wgIsMySQL;
global $days, $limit, $target; # From query string
$fname = "wfSpecialWatchlist";
return;
}
}
-
-
+
+ $wgLoadBalancer->force(-1);
$sql = "SELECT COUNT(*) AS n FROM watchlist WHERE wl_user=$uid";
$res = wfQuery( $sql, DB_READ );
$s = wfFetchObject( $res );
$nitems = $s->n;
-
+ $wgLoadBalancer->force(0);
if($nitems == 0) {
$wgOut->addHTML( wfMsg( "nowatchlist" ) );
return;
}
-
+
+ $wgLoadBalancer->force(-1);
+
if ( ! isset( $days ) ) {
$big = 1000;
if($nitems > $big) {
$cutoff = false;
$npages = wfMsg( "all" );
} else {
- $docutoff = "AND cur_timestamp > '" .
+ $docutoff = "AND cur_timestamp > '" .
( $cutoff = wfUnix2Timestamp( time() - intval( $days * 86400 ) ) )
. "'";
- $sql = "SELECT COUNT(*) AS n FROM cur WHERE cur_timestamp>'$cutoff'";
+ $sql = "SELECT COUNT(*) AS n FROM cur WHERE cur_timestamp>'$cutoff'";
$res = wfQuery( $sql, DB_READ );
$s = wfFetchObject( $res );
$npages = $s->n;
+
}
if(isset($_REQUEST['magic'])) {
wfMsg( "removechecked" ) . "' />\n" .
"</form>\n" );
+ $wgLoadBalancer->force(0);
return;
}
if ( wfNumRows( $res ) == 0 ) {
$wgOut->addHTML( "<p><i>" . wfMsg( "watchnochange" ) . "</i></p>" );
+ $wgLoadBalancer->force(0);
return;
}
if ( $wgUseWatchlistCache ) {
$wgMemc->set( $memckey, $s, $wgWLCacheTimeout);
}
+
+ $wgLoadBalancer->force(0);
}
function getInterwikiLink( $key )
{
global $wgMemc, $wgDBname, $wgInterwikiExpiry, $wgTitleInterwikiCache;
-
+ global $wgLoadBalancer;
+
$k = "$wgDBname:interwiki:$key";
if( array_key_exists( $k, $wgTitleInterwikiCache ) )
return $s->iw_url;
}
$dkey = wfStrencode( $key );
- $query = "SELECT iw_url,iw_local FROM interwiki WHERE iw_prefix='$dkey'";
+ $wgLoadBalancer->force(-1);
+ $query = "SELECT iw_url,iw_local FROM interwiki WHERE iw_prefix='$dkey'";
$res = wfQuery( $query, DB_READ, "Title::getInterwikiLink" );
- if(!$res) return "";
+ $wgLoadBalancer->force(0);
+ if(!$res) return "";
$s = wfFetchObject( $res );
if(!$s) {