{
$this->context->setTitle( SpecialPage::getTitleFor( 'Badtitle' ) );
wfProfileOut( __METHOD__ );
- throw new ErrorPageError( 'badtitle', 'badtitletext' );
+ throw new BadTitleError();
}
// Check user's permissions to read this page.
} else {
$this->context->setTitle( SpecialPage::getTitleFor( 'Badtitle' ) );
wfProfileOut( __METHOD__ );
- throw new ErrorPageError( 'badtitle', 'badtitletext' );
+ throw new BadTitleError();
}
// Redirect loops, no title in URL, $wgUsePathInfo URLs, and URLs with a variant
} elseif ( $request->getVal( 'action', 'view' ) == 'view' && !$request->wasPosted()
$pageView = true;
/**
* $wgArticle is deprecated, do not use it.
- * This will be removed entirely in 1.20.
* @deprecated since 1.18
*/
global $wgArticle;
- $wgArticle = $article;
+ $wgArticle = new DeprecatedGlobal( 'wgArticle', $article, '1.18' );
$this->performAction( $article );
} elseif ( is_string( $article ) ) {
while ( $n-- && false != ( $job = Job::pop() ) ) {
$output = $job->toString() . "\n";
- $t = -wfTime();
+ $t = - microtime( true );
$success = $job->run();
- $t += wfTime();
+ $t += microtime( true );
$t = round( $t * 1000 );
if ( !$success ) {
$output .= "Error: " . $job->getLastError() . ", Time: $t ms\n";
/**
* Perform one of the "standard" actions
*
- * @param $article Article
+ * @param $page Page
*/
- private function performAction( Page $article ) {
- global $wgSquidMaxage;
-
+ private function performAction( Page $page ) {
wfProfileIn( __METHOD__ );
$request = $this->context->getRequest();
$user = $this->context->getUser();
if ( !wfRunHooks( 'MediaWikiPerformAction',
- array( $output, $article, $title, $user, $request, $this ) ) )
+ array( $output, $page, $title, $user, $request, $this ) ) )
{
wfProfileOut( __METHOD__ );
return;
$act = $this->getAction();
- $action = Action::factory( $act, $article );
+ $action = Action::factory( $act, $page );
if ( $action instanceof Action ) {
$action->show();
wfProfileOut( __METHOD__ );
return;
}
- if ( wfRunHooks( 'UnknownAction', array( $act, $article ) ) ) {
+ if ( wfRunHooks( 'UnknownAction', array( $request->getVal( 'action', 'view' ), $page ) ) ) {
$output->showErrorPage( 'nosuchaction', 'nosuchactiontext' );
}
wfProfileIn( __METHOD__ );
- # Set title from request parameters
- $wgTitle = $this->getTitle();
- $action = $this->getAction();
+ $request = $this->context->getRequest();
+
+ // Send Ajax requests to the Ajax dispatcher.
+ if ( $wgUseAjax && $request->getVal( 'action', 'view' ) == 'ajax' ) {
+
+ // Set a dummy title, because $wgTitle == null might break things
+ $title = Title::makeTitle( NS_MAIN, 'AJAX' );
+ $this->context->setTitle( $title );
+ $wgTitle = $title;
- # Send Ajax requests to the Ajax dispatcher.
- if ( $wgUseAjax && $action == 'ajax' ) {
$dispatcher = new AjaxDispatcher();
$dispatcher->performAction();
wfProfileOut( __METHOD__ );
return;
}
- if ( $wgUseFileCache && $this->getTitle()->getNamespace() >= 0 ) {
+ // Get title from request parameters,
+ // is set on the fly by parseTitle the first time.
+ $title = $this->getTitle();
+ $action = $this->getAction();
+ $wgTitle = $title;
+
+ if ( $wgUseFileCache && $title->getNamespace() >= 0 ) {
wfProfileIn( 'main-try-filecache' );
if ( HTMLFileCache::useFileCache( $this->context ) ) {
- /* Try low-level file cache hit */
- $cache = HTMLFileCache::newFromTitle( $this->getTitle(), $action );
+ // Try low-level file cache hit
+ $cache = HTMLFileCache::newFromTitle( $title, $action );
if ( $cache->isCacheGood( /* Assume up to date */ ) ) {
- /* Check incoming headers to see if client has this cached */
+ // Check incoming headers to see if client has this cached
$timestamp = $cache->cacheTimestamp();
if ( !$this->context->getOutput()->checkLastModified( $timestamp ) ) {
$cache->loadFromFileCache( $this->context );
}
- # Do any stats increment/watchlist stuff
+ // Do any stats increment/watchlist stuff
$this->context->getWikiPage()->doViewUpdates( $this->context->getUser() );
- # Tell OutputPage that output is taken care of
+ // Tell OutputPage that output is taken care of
$this->context->getOutput()->disable();
wfProfileOut( 'main-try-filecache' );
wfProfileOut( __METHOD__ );