}
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;
}
switch( $title->getNamespace() ) {
- case NS_IMAGE:
- return new ImagePage( $title );
- case NS_CATEGORY:
- return new CategoryPage( $title );
- default:
- return new Article( $title );
+ case NS_IMAGE:
+ $file = RepoGroup::singleton()->findFile( $title->getText() );
+ if( $file && $file->getRedirectedFrom() ) {
+ return new Article( $title );
+ } else {
+ return new ImagePage( $title );
+ }
+ case NS_CATEGORY:
+ return new CategoryPage( $title );
+ default:
+ return new Article( $title );
}
}
$article = $this->articleFromTitle( $title );
// Namespace might change when using redirects
- if( $action == 'view' && !$request->getVal( 'oldid' ) &&
+ if( ( $action == 'view' || $action == 'render' ) && !$request->getVal( 'oldid' ) &&
$request->getVal( 'redirect' ) != 'no' ) {
$dbr = wfGetDB(DB_SLAVE);
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 */