Move Article checkLastModified() up to MediaWiki::performRequest
This lets revalidations via IMS headers run a bit faster. Change-Id: I1f61086dea4c6bc460f6249ed7fda78316117a8d
This commit is contained in:
parent
fbce940836
commit
8b141886ed
3 changed files with 14 additions and 9 deletions
|
|
@ -286,6 +286,16 @@ class MediaWiki {
|
||||||
// may still be a wikipage redirect to another article or URL.
|
// may still be a wikipage redirect to another article or URL.
|
||||||
$article = $this->initializeArticle();
|
$article = $this->initializeArticle();
|
||||||
if ( is_object( $article ) ) {
|
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 );
|
$this->performAction( $article, $requestTitle );
|
||||||
} elseif ( is_string( $article ) ) {
|
} elseif ( is_string( $article ) ) {
|
||||||
$output->redirect( $article );
|
$output->redirect( $article );
|
||||||
|
|
|
||||||
|
|
@ -543,13 +543,8 @@ class Article implements Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Is it client cached?
|
# Try to stream the output from file cache
|
||||||
if ( $outputPage->checkLastModified( $timestamp ) ) {
|
if ( $wgUseFileCache && $this->tryFileCache() ) {
|
||||||
wfDebug( __METHOD__ . ": done 304\n" );
|
|
||||||
|
|
||||||
return;
|
|
||||||
# Try file cache
|
|
||||||
} elseif ( $wgUseFileCache && $this->tryFileCache() ) {
|
|
||||||
wfDebug( __METHOD__ . ": done file cache\n" );
|
wfDebug( __METHOD__ . ": done file cache\n" );
|
||||||
# tell wgOut that output is taken care of
|
# tell wgOut that output is taken care of
|
||||||
$outputPage->disable();
|
$outputPage->disable();
|
||||||
|
|
|
||||||
|
|
@ -504,13 +504,13 @@ class WikiPage implements Page, IDBAccessObject {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads page_touched and returns a value indicating if it should be used
|
* 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() {
|
public function checkTouched() {
|
||||||
if ( !$this->mDataLoaded ) {
|
if ( !$this->mDataLoaded ) {
|
||||||
$this->loadPageData();
|
$this->loadPageData();
|
||||||
}
|
}
|
||||||
return !$this->mIsRedirect;
|
return ( $this->mId && !$this->mIsRedirect );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue