X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Factions%2FViewAction.php;h=134b8a45b11a4a7294f5d45de30bd7d6199eb348;hb=526341516a91502ac7cfd2e5590e7432b3f50c5d;hp=3a24565c35d09593a8ef7677db5b003bac2d2951;hpb=83a1cf573f7439e45d292a072472ac49212c9ffb;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/actions/ViewAction.php b/includes/actions/ViewAction.php index 3a24565c35..134b8a45b1 100644 --- a/includes/actions/ViewAction.php +++ b/includes/actions/ViewAction.php @@ -26,7 +26,7 @@ /** * An action that views article content * - * This is a wrapper that will call Article::render(). + * This is a wrapper that will call Article::view(). * * @ingroup Actions */ @@ -41,6 +41,30 @@ class ViewAction extends FormlessAction { } public function show() { + $config = $this->context->getConfig(); + + if ( + $config->get( 'DebugToolbar' ) == false && // don't let this get stuck on pages + $this->page->checkTouched() // page exists and is not a redirect + ) { + // Include any redirect in the last-modified calculation + $redirFromTitle = $this->page->getRedirectedFrom(); + if ( !$redirFromTitle ) { + $touched = $this->page->getTouched(); + } elseif ( $config->get( 'MaxRedirects' ) <= 1 ) { + $touched = max( $this->page->getTouched(), $redirFromTitle->getTouched() ); + } else { + // Don't bother following the chain and getting the max mtime + $touched = null; + } + + // Send HTTP 304 if the IMS matches or otherwise set expiry/last-modified headers + if ( $touched && $this->getOutput()->checkLastModified( $touched ) ) { + wfDebug( __METHOD__ . ": done 304\n" ); + return; + } + } + $this->page->view(); } }