| ResourceLoader: $wgResourceLoaderMaxage | |
|---|---|
| How long a CDN or browser may cache a ResourceLoader HTTP response. |
|
| Introduced in version: | 1.17.0 (r73568) |
| Removed in version: | still in use |
| Allowed values: | (array) |
| Default value: | see below |
| Other settings: Alphabetical | By function | |
Details
How long a CDN or browser may cache a ResourceLoader HTTP response. Maximum time in seconds. Used for the 'max-age' and 's-maxage' Cache-Control headers.
Default value
| MediaWiki version: | ≥ 1.39 |
$wgResourceLoaderMaxage = [];
| MediaWiki versions: | 1.35 – 1.38 |
$wgResourceLoaderMaxage = [
'versioned' => 30 * 24 * 60 * 60, // <translate nowrap><!--T:12--> 30 days</translate>
'unversioned' => 5 * 60 // <translate nowrap><!--T:13--> 5 minutes</translate>
];
| MediaWiki versions: | 1.17 – 1.34 |
$wgResourceLoaderMaxage = array(
'versioned' => array(
// <translate nowrap><!--T:5--> Squid/Varnish but also any other public proxy cache between the client and MediaWiki</translate>
'server' => 30 * 24 * 60 * 60, // 30 days
// <translate nowrap><!--T:6--> On the client side (e.g. in the browser cache).</translate>
'client' => 30 * 24 * 60 * 60, // 30 days
),
'unversioned' => array(
'server' => 5 * 60, // <translate nowrap><!--T:7--> 5 minutes</translate>
'client' => 5 * 60, // <translate nowrap><!--T:8--> 5 minutes</translate>
),
);
This syntax is not compatible anymore. This happened after this change: phab:T235314
To simplify troubleshooting, here is a known exception related to this old syntax:
/load.php?lang=it&modules=skins.vector.styles.legacy%2Cresponsive&only=styles&skin=vector Error from line 1073 of includes/resourceloader/ResourceLoader.php: Unsupported operand types
#0 includes/resourceloader/ResourceLoader.php(891): ResourceLoader->tryRespondFromFileCache(ResourceFileCache, ResourceLoaderContext, string)
#1 load.php(51): ResourceLoader->respond(ResourceLoaderContext)
#2 load.php(38): wfLoadMain()
#3 {main}
To fix this issue just migrate to the new syntax without the "server" and "client" distinction.
See also
- ResourceLoader
$wgResourceModules- Register modules that can later be loaded on a page$wgResourceModuleSkinStyles- Register skin-provided stylesheets to add to an existing ResourceLoader module$wgResourceLoaderDebug- Configure the default debug mode for MediaWiki.- Internal configuration settings:
$wgExtensionAssetsPath,$wgResourceLoaderMaxage - ResourceLoaderRegisterModules hook
- Developing with ResourceLoader – Learn how to use ResourceLoader in MediaWiki
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.