diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2008-03-21 11:49:34 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2008-03-21 11:49:34 +0100 |
commit | 086ae52d12011746a75f5588e877347bc0457352 (patch) | |
tree | e73263c7a29d0f94fafb874562610e16eb292ba8 /includes/Wiki.php | |
parent | 749e7fb2bae7bbda855de3c9e319435b9f698ff7 (diff) |
Update auf MediaWiki 1.12.0
Diffstat (limited to 'includes/Wiki.php')
-rw-r--r-- | includes/Wiki.php | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/includes/Wiki.php b/includes/Wiki.php index 72a6a61d..e0a57445 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -57,18 +57,10 @@ class MediaWiki { } function checkMaxLag( $maxLag ) { - global $wgLoadBalancer, $wgShowHostnames; + global $wgLoadBalancer; list( $host, $lag ) = $wgLoadBalancer->getMaxLag(); if ( $lag > $maxLag ) { - header( 'HTTP/1.1 503 Service Unavailable' ); - header( 'Retry-After: ' . max( intval( $maxLag ), 5 ) ); - header( 'X-Database-Lag: ' . intval( $lag ) ); - header( 'Content-Type: text/plain' ); - if( $wgShowHostnames ) { - echo "Waiting for $host: $lag seconds lagged\n"; - } else { - echo "Waiting for a database server: $lag seconds lagged\n"; - } + wfMaxlagError( $host, $lag, $maxLag ); return false; } else { return true; @@ -228,6 +220,10 @@ class MediaWiki { switch( $title->getNamespace() ) { case NS_IMAGE: + $file = wfFindFile( $title ); + if( $file && $file->getRedirected() ) { + return new Article( $title ); + } return new ImagePage( $title ); case NS_CATEGORY: return new CategoryPage( $title ); @@ -252,8 +248,9 @@ class MediaWiki { $article = $this->articleFromTitle( $title ); // Namespace might change when using redirects - if( $action == 'view' && !$request->getVal( 'oldid' ) && - $request->getVal( 'redirect' ) != 'no' ) { + if( ( $action == 'view' || $action == 'render' ) && !$request->getVal( 'oldid' ) && + $request->getVal( 'redirect' ) != 'no' && + !( $wgTitle->getNamespace() == NS_IMAGE && wfFindFile( $wgTitle->getText() ) ) ) { $dbr = wfGetDB(DB_SLAVE); $article->loadPageData($article->pageDataFromTitle($dbr, $title)); @@ -297,7 +294,7 @@ class MediaWiki { $this->doJobs(); $loadBalancer->saveMasterPos(); # Now commit any transactions, so that unreported errors after output() don't roll back the whole thing - $loadBalancer->commitAll(); + $loadBalancer->commitMasterChanges(); $output->output(); wfProfileOut( 'MediaWiki::finalCleanup' ); } @@ -309,6 +306,12 @@ class MediaWiki { */ function doUpdates ( &$updates ) { wfProfileIn( 'MediaWiki::doUpdates' ); + /* No need to get master connections in case of empty updates array */ + if (!$updates) { + wfProfileOut('MediaWiki::doUpdates'); + return; + } + $dbw = wfGetDB( DB_MASTER ); foreach( $updates as $up ) { $up->doUpdate(); @@ -360,7 +363,6 @@ class MediaWiki { */ function restInPeace ( &$loadBalancer ) { wfLogProfilingData(); - $loadBalancer->closeAll(); wfDebug( "Request ended normally\n" ); } @@ -371,6 +373,11 @@ class MediaWiki { wfProfileIn( 'MediaWiki::performAction' ); + if ( !wfRunHooks('MediaWikiPerformAction', array($output, $article, $title, $user, $request)) ) { + wfProfileOut( 'MediaWiki::performAction' ); + return; + } + $action = $this->getVal('Action'); if( in_array( $action, $this->getVal('DisabledActions',array()) ) ) { /* No such action; this will switch to the default case */ |