dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "parser: Update outdated comment about ImageGallery"
[lhc/web/wiklou.git]
/
includes
/
actions
/
RawAction.php
diff --git
a/includes/actions/RawAction.php
b/includes/actions/RawAction.php
index
6de95a0
..
d8c8bc3
100644
(file)
--- a/
includes/actions/RawAction.php
+++ b/
includes/actions/RawAction.php
@@
-33,14
+33,6
@@
* @ingroup Actions
*/
class RawAction extends FormlessAction {
* @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';
}
public function getName() {
return 'raw';
}
@@
-77,9
+69,7
@@
class RawAction extends FormlessAction {
$maxage = $request->getInt( 'maxage', $config->get( 'SquidMaxage' ) );
$smaxage = $request->getIntOrNull( 'smaxage' );
if ( $smaxage === null ) {
$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' ) {
+ 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.
// 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.
@@
-90,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
$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';
// Don't accidentally cache cookies if user is logged in (T55032)
$privateCache = $privateCache || $this->getUser()->isLoggedIn();
$mode = $privateCache ? 'private' : 'public';
@@
-111,7
+108,9
@@
class RawAction extends FormlessAction {
$response->statusHeader( 404 );
}
$response->statusHeader( 404 );
}
- if ( !Hooks::run( 'RawPageViewBeforeOutput', array( &$this, &$text ) ) ) {
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $rawAction = $this;
+ if ( !Hooks::run( 'RawPageViewBeforeOutput', [ &$rawAction, &$text ] ) ) {
wfDebug( __METHOD__ . ": RawPageViewBeforeOutput hook broke raw page output.\n" );
}
wfDebug( __METHOD__ . ": RawPageViewBeforeOutput hook broke raw page output.\n" );
}
@@
-127,11
+126,6
@@
class RawAction extends FormlessAction {
public function getRawText() {
global $wgParser;
public function getRawText() {
global $wgParser;
- # No longer used
- if ( $this->gen ) {
- return '';
- }
-
$text = false;
$title = $this->getTitle();
$request = $this->getRequest();
$text = false;
$title = $this->getTitle();
$request = $this->getRequest();
@@
-242,7
+236,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';
}
if ( $ctype == '' || !in_array( $ctype, $allowedCTypes ) ) {
$ctype = 'text/x-wiki';
}