X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Factions%2FRawAction.php;h=5bf24f60e683ccb0b3393d7310aa4b13d3619c6f;hb=3c7c900d230dfdba161c1edc872342e0299db5a1;hp=69cd7aa1bd1ea5b893db252452c91fb59ad5e388;hpb=8b2139e1a773ab4be16a58c8cf2edb1c86b4b798;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/actions/RawAction.php b/includes/actions/RawAction.php index 69cd7aa1bd..5bf24f60e6 100644 --- a/includes/actions/RawAction.php +++ b/includes/actions/RawAction.php @@ -80,10 +80,17 @@ class RawAction extends FormlessAction { } } + // Set standard Vary headers so cache varies on cookies and such (T125283) + $response->header( $this->getOutput()->getVaryHeader() ); + if ( $config->get( 'UseKeyHeader' ) ) { + $response->header( $this->getOutput()->getKeyHeader() ); + } + $response->header( 'Content-type: ' . $contentType . '; charset=UTF-8' ); // Output may contain user-specific data; // vary generated content for open sessions on private wikis - $privateCache = !User::isEveryoneAllowed( 'read' ) && ( $smaxage == 0 || session_id() != '' ); + $privateCache = !User::isEveryoneAllowed( 'read' ) && + ( $smaxage == 0 || MediaWiki\Session\SessionManager::getGlobalSession()->isPersistent() ); // Don't accidentally cache cookies if user is logged in (T55032) $privateCache = $privateCache || $this->getUser()->isLoggedIn(); $mode = $privateCache ? 'private' : 'public'; @@ -101,7 +108,7 @@ class RawAction extends FormlessAction { $response->statusHeader( 404 ); } - if ( !Hooks::run( 'RawPageViewBeforeOutput', array( &$this, &$text ) ) ) { + if ( !Hooks::run( 'RawPageViewBeforeOutput', [ &$this, &$text ] ) ) { wfDebug( __METHOD__ . ": RawPageViewBeforeOutput hook broke raw page output.\n" ); } @@ -227,7 +234,7 @@ class RawAction extends FormlessAction { } } - $allowedCTypes = array( 'text/x-wiki', 'text/javascript', 'text/css', 'application/x-zope-edit' ); + $allowedCTypes = [ 'text/x-wiki', 'text/javascript', 'text/css', 'application/x-zope-edit' ]; if ( $ctype == '' || !in_array( $ctype, $allowedCTypes ) ) { $ctype = 'text/x-wiki'; }