}
if ( $ret === null || ( $ret->getDBkey() == '' && $ret->getInterwiki() == '' ) ) {
- $ret = new BadTitle;
+ $ret = SpecialPage::getTitleFor( 'Badtitle' );
}
return $ret;
array( &$title, null, &$output, &$user, $request, $this ) );
// Invalid titles. Bug 21776: The interwikis must redirect even if the page name is empty.
- if ( $title instanceof BadTitle ) {
+ if ( is_null( $title ) || ( ( $title->getDBkey() == '' ) && ( $title->getInterwiki() == '' ) ) ) {
+ $this->context->title = SpecialPage::getTitleFor( 'Badtitle' );
throw new ErrorPageError( 'badtitle', 'badtitletext' );
// If the user is not logged in, the Namespace:title of the article must be in
// the Read array in order for the user to see it. (We have to check here to
// 301 so google et al report the target as the actual url.
$output->redirect( $url, 301 );
} else {
- $this->context->setTitle( new BadTitle );
+ $this->context->setTitle( SpecialPage::getTitleFor( 'Badtitle' ) );
wfProfileOut( __METHOD__ );
throw new ErrorPageError( 'badtitle', 'badtitletext' );
}
$title = SpecialPage::getTitleFor( $name, $subpage );
}
}
- $targetUrl = $title->getFullURL();
+ $targetUrl = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
// Redirect to canonical url, make it a 301 to allow caching
if ( $targetUrl == $request->getFullRequestURL() ) {
$message = "Redirect loop detected!\n\n" .
/**
* $wgArticle is deprecated, do not use it. This will possibly be removed
* entirely in 1.20 or 1.21
- * @deprecated since 1.19
+ * @deprecated since 1.18
*/
global $wgArticle;
$wgArticle = $article;
/**
* Create an Article object of the appropriate class for the given page.
*
- * @deprecated in 1.19; use Article::newFromTitle() instead
+ * @deprecated in 1.18; use Article::newFromTitle() instead
* @param $title Title
* @param $context RequestContext
* @return Article object
// Check for disabled actions
if ( in_array( $action, $wgDisabledActions ) ) {
- $action = 'nosuchaction';
- } elseif ( $action === 'historysubmit' ) {
- // Workaround for bug #20966: inability of IE to provide an action dependent
- // on which submit button is clicked.
+ return 'nosuchaction';
+ }
+
+ // Workaround for bug #20966: inability of IE to provide an action dependent
+ // on which submit button is clicked.
+ if ( $action === 'historysubmit' ) {
if ( $request->getBool( 'revisiondelete' ) ) {
- $action = 'revisiondelete';
+ return 'revisiondelete';
} else {
- $action = 'view';
+ return 'view';
}
} elseif ( $action == 'editredlink' ) {
- $action = 'edit';
+ return 'edit';
}
-
- // Write back the executed action
- $request->setVal( 'action', $action );
+
return $action;
}
// Output everything!
$this->context->getOutput()->output();
// Do any deferred jobs
- wfDoUpdates( 'commit' );
+ DeferredUpdates::doUpdates( 'commit' );
$this->doJobs();
wfProfileOut( __METHOD__ );
}
$act = $this->getAction();
$action = Action::factory( $act, $article );
- if( $action instanceof Action ){
+ if ( $action instanceof Action ) {
$action->show();
wfProfileOut( __METHOD__ );
return;
&& ( $external || $user->getOption( 'externaleditor' ) ) )
{
$mode = $request->getVal( 'mode' );
- $extedit = new ExternalEdit( $article, $mode );
+ $extedit = new ExternalEdit( $article->getTitle(), $mode );
$extedit->edit();
}
}
break;
default:
if ( wfRunHooks( 'UnknownAction', array( $act, $article ) ) ) {
- $request->setVal( 'action', 'nosuchaction' );
$output->showErrorPage( 'nosuchaction', 'nosuchactiontext' );
}
}
list( $host, $lag ) = $lb->getMaxLag();
if ( $lag > $maxLag ) {
if ( $abort ) {
- 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' );
+ $resp = $this->context->getRequest()->response();
+ $resp->header( 'HTTP/1.1 503 Service Unavailable' );
+ $resp->header( 'Retry-After: ' . max( intval( $maxLag ), 5 ) );
+ $resp->header( 'X-Database-Lag: ' . intval( $lag ) );
+ $resp->header( 'Content-Type: text/plain' );
if( $wgShowHostnames ) {
echo "Waiting for $host: $lag seconds lagged\n";
} else {
wfProfileOut( __METHOD__ );
- if ( !$abort )
+ if ( !$abort ) {
return false;
+ }
exit;
}
}