mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree
synced 2024-11-15 12:00:44 +00:00
Merge "Stop manually messing with caching HTTP headers"
This commit is contained in:
commit
d2e04a3391
|
@ -99,7 +99,6 @@
|
|||
"CategoryTreeMaxChildren": 200,
|
||||
"CategoryTreeAllowTag": true,
|
||||
"CategoryTreeDisableCache": 21600,
|
||||
"CategoryTreeHTTPCache": false,
|
||||
"CategoryTreeMaxDepth": {
|
||||
"10": 1,
|
||||
"20": 1,
|
||||
|
|
|
@ -40,27 +40,10 @@ class ApiCategoryTree extends ApiBase {
|
|||
|
||||
$ct = new CategoryTree( $options );
|
||||
$depth = CategoryTree::capDepth( $ct->getOption( 'mode' ), $depth );
|
||||
$config = $this->getConfig();
|
||||
$ctConfig = ConfigFactory::getDefaultInstance()->makeConfig( 'categorytree' );
|
||||
$html = $this->getHTML( $ct, $title, $depth, $ctConfig );
|
||||
|
||||
if (
|
||||
$ctConfig->get( 'CategoryTreeHTTPCache' ) &&
|
||||
$config->get( 'SquidMaxage' ) &&
|
||||
$config->get( 'UseSquid' )
|
||||
) {
|
||||
if ( $config->get( 'UseESI' ) ) {
|
||||
$this->getRequest()->response()->header(
|
||||
'Surrogate-Control: max-age=' . $config->get( 'SquidMaxage' ) . ', content="ESI/1.0"'
|
||||
);
|
||||
$this->getMain()->setCacheMaxAge( 0 );
|
||||
} else {
|
||||
$this->getMain()->setCacheMaxAge( $config->get( 'SquidMaxage' ) );
|
||||
}
|
||||
// cache for anons only
|
||||
$this->getRequest()->response()->header( 'Vary: Accept-Encoding, Cookie' );
|
||||
// TODO: purge the squid cache when a category page is invalidated
|
||||
}
|
||||
$this->getMain()->setCacheMode( 'public' );
|
||||
|
||||
$this->getResult()->addContentValue( $this->getModuleName(), 'html', $html );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue