Manual:$wgResourceLoaderMaxage/en
From Linux Web Expert
<translate> ResourceLoader</translate>: $wgResourceLoaderMaxage | |
---|---|
How long a CDN or browser may cache a ResourceLoader HTTP response. |
|
<translate> Introduced in version:</translate> | 1.17.0 (r73568) |
<translate> Removed in version:</translate> | <translate> still in use</translate> |
<translate> Allowed values:</translate> | (array) |
<translate> Default value:</translate> | see below |
<translate> Other settings:</translate> <translate> Alphabetical</translate> | <translate> By function</translate> |
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
<td class="mw-version-versionbox" title="<translate nowrap> The latest stable version is <tvar name=1>1.41</tvar></translate>"><translate> ≥</translate> 1.39
<translate> MediaWiki version:</translate> |
$wgResourceLoaderMaxage = [];
1.35 – 1.38
<translate> MediaWiki versions:</translate> |
$wgResourceLoaderMaxage = [
'versioned' => 30 * 24 * 60 * 60, // 30 days
'unversioned' => 5 * 60 // 5 minutes
];
1.17 – 1.34
<translate> MediaWiki versions:</translate> |
$wgResourceLoaderMaxage = array(
'versioned' => array(
// Squid/Varnish but also any other public proxy cache between the client and MediaWiki
'server' => 30 * 24 * 60 * 60, // 30 days
// On the client side (e.g. in the browser cache).
'client' => 30 * 24 * 60 * 60, // 30 days
),
'unversioned' => array(
'server' => 5 * 60, // 5 minutes
'client' => 5 * 60, // 5 minutes
),
);
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.