From: Aaron Schulz Date: Wed, 24 Aug 2016 06:53:31 +0000 (-0700) Subject: Move Article checkLastModified() up to MediaWiki::performRequest X-Git-Tag: 1.31.0-rc.0~5907^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/rappels.php?a=commitdiff_plain;h=8b141886edebcbbb35f3f07870f7a22fadde9c90;p=lhc%2Fweb%2Fwiklou.git Move Article checkLastModified() up to MediaWiki::performRequest This lets revalidations via IMS headers run a bit faster. Change-Id: I1f61086dea4c6bc460f6249ed7fda78316117a8d --- diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index 77ac76ae4c..2a00900b06 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -286,6 +286,16 @@ class MediaWiki { // may still be a wikipage redirect to another article or URL. $article = $this->initializeArticle(); if ( is_object( $article ) ) { + $url = $request->getFullRequestURL(); // requested URL + if ( + $request->getMethod() === 'GET' && + $url === $article->getTitle()->getCanonicalURL() && + $article->checkTouched() && + $output->checkLastModified( $article->getTouched() ) + ) { + wfDebug( __METHOD__ . ": done 304\n" ); + return; + } $this->performAction( $article, $requestTitle ); } elseif ( is_string( $article ) ) { $output->redirect( $article ); diff --git a/includes/page/Article.php b/includes/page/Article.php index 6396aaabcf..b3a97f7bf1 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -543,13 +543,8 @@ class Article implements Page { } } - # Is it client cached? - if ( $outputPage->checkLastModified( $timestamp ) ) { - wfDebug( __METHOD__ . ": done 304\n" ); - - return; - # Try file cache - } elseif ( $wgUseFileCache && $this->tryFileCache() ) { + # Try to stream the output from file cache + if ( $wgUseFileCache && $this->tryFileCache() ) { wfDebug( __METHOD__ . ": done file cache\n" ); # tell wgOut that output is taken care of $outputPage->disable(); diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 3851d15e60..40665010a1 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -504,13 +504,13 @@ class WikiPage implements Page, IDBAccessObject { /** * Loads page_touched and returns a value indicating if it should be used - * @return bool True if not a redirect + * @return bool True if this page exists and is not a redirect */ public function checkTouched() { if ( !$this->mDataLoaded ) { $this->loadPageData(); } - return !$this->mIsRedirect; + return ( $this->mId && !$this->mIsRedirect ); } /**