mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-30 14:08:46 +02:00
TwigBase: Change "add_itop_version" TWIG function to use cache buster timestamp
This commit is contained in:
@@ -84,15 +84,18 @@ class Extension
|
||||
})
|
||||
);
|
||||
|
||||
// Filter to add itopversion to an url
|
||||
// Filter to add a parameter at the end of the URL to force cache invalidation after an upgrade.
|
||||
// Previously we put the iTop version but now it's the last setup/toolkit timestamp to avoid cache issues when building several times the same version during tests
|
||||
//
|
||||
// Note: This could be rename "add_cache_buster" instead.
|
||||
$oTwigEnv->addFilter(new Twig_SimpleFilter('add_itop_version', function ($sUrl) {
|
||||
if (strpos($sUrl, '?') === false)
|
||||
{
|
||||
$sUrl = $sUrl."?itopversion=".ITOP_VERSION;
|
||||
$sUrl = $sUrl."?t=".utils::GetCacheBusterTimestamp();
|
||||
}
|
||||
else
|
||||
{
|
||||
$sUrl = $sUrl."&itopversion=".ITOP_VERSION;
|
||||
$sUrl = $sUrl."&t=".utils::GetCacheBusterTimestamp();
|
||||
}
|
||||
|
||||
return $sUrl;
|
||||
|
||||
Reference in New Issue
Block a user