Merge "Set context on RedirectSpecialPage in MediaWiki.php"
[lhc/web/wiklou.git] / includes / actions / RawAction.php
index b71b0e9..b371848 100644 (file)
  * @ingroup Actions
  */
 class RawAction extends FormlessAction {
-       /**
-        * Whether the request includes a 'gen' parameter
-        * @var bool
-        * @deprecated since 1.17 This used to be a string for "css" or "javascript" but
-        * it is no longer used. Setting this parameter results in an empty response.
-        */
-       private $gen = false;
-
        public function getName() {
                return 'raw';
        }
@@ -77,15 +69,13 @@ class RawAction extends FormlessAction {
                $maxage = $request->getInt( 'maxage', $config->get( 'SquidMaxage' ) );
                $smaxage = $request->getIntOrNull( 'smaxage' );
                if ( $smaxage === null ) {
-                       if ( $this->gen ) {
-                               $smaxage = $config->get( 'SquidMaxage' );
-                       } elseif ( $contentType == 'text/css' || $contentType == 'text/javascript' ) {
-                               // CSS/JS raw content has its own squid max age configuration.
-                               // Note: Title::getSquidURLs() includes action=raw for css/js pages,
+                       if ( $contentType == 'text/css' || $contentType == 'text/javascript' ) {
+                               // CSS/JS raw content has its own CDN max age configuration.
+                               // Note: Title::getCdnUrls() includes action=raw for css/js pages,
                                // so if using the canonical url, this will get HTCP purges.
                                $smaxage = intval( $config->get( 'ForcedRawSMaxage' ) );
                        } else {
-                               // No squid cache for anything else
+                               // No CDN cache for anything else
                                $smaxage = 0;
                        }
                }
@@ -93,7 +83,8 @@ class RawAction extends FormlessAction {
                $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';
@@ -127,11 +118,6 @@ class RawAction extends FormlessAction {
        public function getRawText() {
                global $wgParser;
 
-               # No longer used
-               if ( $this->gen ) {
-                       return '';
-               }
-
                $text = false;
                $title = $this->getTitle();
                $request = $this->getRequest();