Handbuch:$wgResourceLoaderMaxage
Appearance
| ResourceLoader: $wgResourceLoaderMaxage | |
|---|---|
| Wie lange ein CDN oder Browser eine ResourceLoader-HTTP-Antwort zwischenspeichern darf. |
|
| Eingeführt in Version: | 1.17.0 (r73568) |
| Entfernt in Version: | Weiterhin vorhanden |
| Erlaubte Werte: | (Array) |
| Standardwert: | siehe unten |
| Andere Einstellungen: Alphabetisch | Nach Funktion | |
Details
Wie lange ein CDN oder Browser eine ResourceLoader-HTTP-Antwort zwischenspeichern darf. Maximalzeit in Sekunden. Used for the 'max-age' and 's-maxage' Cache-Control headers.
Standardwert
| MediaWiki Version: | ≥ 1.39 Gerrit change 776355 |
The default value has since been moved to the constructor of ResourceLoader in ResourceLoader.php.
$wgResourceLoaderMaxage = [];
| MediaWiki Versions: | 1.35 – 1.38 |
$wgResourceLoaderMaxage = [
'versioned' => 30 * 24 * 60 * 60, // 30 Tage
'unversioned' => 5 * 60 // 5 Minuten
];
| MediaWiki Versions: | 1.17 – 1.34 |
$wgResourceLoaderMaxage = array(
'versioned' => array(
// Squid/Varnish aber auch jeder andere öffentlicher Proxy-Cache zwischen den Client und MediaWiki
'server' => 30 * 24 * 60 * 60, // 30 days
// Auf der Client-Seite (z.B. im Browsercache)
'client' => 30 * 24 * 60 * 60, // 30 days
),
'unversioned' => array(
'server' => 5 * 60, // 5 Minuten
'client' => 5 * 60, // 5 Minuten
),
);
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.
Siehe auch
- 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.- Interne Konfigurationseinstellungen:
$wgExtensionAssetsPath,$wgResourceLoaderMaxage - ResourceLoaderRegisterModules-Hook
- Developing with ResourceLoader – Learn how to use ResourceLoader in MediaWiki