* Get the database which should be used for reads
*/
function &getDB() {
- if ( $this->mForUpdate ) {
+ #if ( $this->mForUpdate ) {
return wfGetDB( DB_MASTER );
- } else {
- return wfGetDB( DB_SLAVE );
- }
+ #} else {
+ # return wfGetDB( DB_SLAVE );
+ #}
}
/**
$oldid = $this->getOldID();
$diff = $wgRequest->getVal( 'diff' );
$rcid = $wgRequest->getVal( 'rcid' );
+ $rdfrom = $wgRequest->getVal( 'rdfrom' );
$wgOut->setArticleFlag( true );
$wgOut->setRobotpolicy( 'index,follow' );
# Can't cache redirects
$pcache = false;
+ } elseif ( !empty( $rdfrom ) ) {
+ $sk = $wgUser->getSkin();
+ $redir = $sk->makeExternalLink( $rdfrom, $rdfrom );
+ $s = wfMsg( 'redirectedfrom', $redir );
+ $wgOut->setSubtitle( $s );
}
# wrap user css and user js in pre and don't parse
function updateArticle( $text, $summary, $minor, $watchthis, $forceBot = false, $sectionanchor = '' ) {
global $wgOut, $wgUser;
global $wgDBtransactions, $wgMwRedir;
- global $wgUseSquid, $wgInternalServer;
+ global $wgUseSquid, $wgInternalServer, $wgPostCommitUpdateList;
$fname = 'Article::updateArticle';
$good = true;
if ( $wgUseSquid ) {
$urls = array_merge( $urls, $this->mTitle->getSquidURLs() );
$u = new SquidUpdate( $urls );
- $u->doUpdate();
+ array_push( $wgPostCommitUpdateList, $u );
}
$this->showArticle( $text, wfMsg( 'updated' ), $sectionanchor, $me2, $now, $summary, $lastRevision );
*/
function doDeleteArticle( $reason ) {
global $wgUser;
- global $wgUseSquid, $wgDeferredUpdateList, $wgInternalServer;
+ global $wgUseSquid, $wgDeferredUpdateList, $wgInternalServer, $wgPostCommitUpdateList;
$fname = 'Article::doDeleteArticle';
wfDebug( $fname."\n" );
}
$u = new SquidUpdate( $urls );
- array_push( $wgDeferredUpdateList, $u );
+ array_push( $wgPostCommitUpdateList, $u );
}
*/
function onArticleCreate($title_obj) {
- global $wgUseSquid, $wgDeferredUpdateList;
+ global $wgUseSquid, $wgPostCommitUpdateList;
$titles = $title_obj->getBrokenLinksTo();
$urls[] = $linkTitle->getInternalURL();
}
$u = new SquidUpdate( $urls );
- array_push( $wgDeferredUpdateList, $u );
+ array_push( $wgPostCommitUpdateList, $u );
}
# Clear persistent link cache
if( !isset( $wgProfiling ) )
$wgProfiling = false;
-if ( $wgProfiling and (0 == rand() % $wgProfileSampleRate ) ) {
- require_once( 'Profiling.php' );
+if ( $wgProfiling and (0 == rand() % $wgProfileSampleRate ) ) {
+ require_once( 'Profiling.php' );
} else {
- function wfProfileIn( $fn = '' ) {}
- function wfProfileOut( $fn = '' ) {}
- function wfGetProfilingOutput( $s, $e ) {}
- function wfProfileClose() {}
+ function wfProfileIn( $fn = '' ) {
+ global $hackwhere, $wgDBname;
+ $hackwhere[] = $fn;
+ if (function_exists("setproctitle"))
+ setproctitle($fn . " [$wgDBname]");
+ }
+ function wfProfileOut( $fn = '' ) {
+ global $hackwhere, $wgDBname;
+ if (count($hackwhere))
+ array_pop($hackwhere);
+ if (function_exists("setproctitle") && count($hackwhere))
+ setproctitle($hackwhere[count($hackwhere)-1] . " [$wgDBname]");
+ }
+ function wfGetProfilingOutput( $s, $e ) {}
+ function wfProfileClose() {}
}
+
+
/* collect the originating ips */
if( $wgUseSquid && isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
# If the web server is behind a reverse proxy, we need to find
}
}
- $wgMemc = new MemCachedClientforWiki( array('persistant' => true) );
+ $wgMemc = new MemCachedClientforWiki( array('persistant' => true, 'compress_threshold' => 1500 ) );
$wgMemc->set_servers( $wgMemCachedServers );
$wgMemc->set_debug( $wgMemCachedDebug );
wfProfileIn( $fname.'-misc2' );
$wgDeferredUpdateList = array();
+$wgPostCommitUpdateList = array();
+
$wgLinkCache = new LinkCache();
$wgMagicWords = array();
$wgMwRedir =& MagicWord::get( MAG_REDIRECT );