diff --git a/application/datatable.class.inc.php b/application/datatable.class.inc.php
index d47287fb4..185ccef42 100644
--- a/application/datatable.class.inc.php
+++ b/application/datatable.class.inc.php
@@ -298,7 +298,7 @@ EOF;
if (!$oPage->IsPrintableVersion())
{
$sMenuTitle = Dict::S('UI:ConfigureThisList');
- $sHtml = '
';
@@ -1104,7 +1104,7 @@ EOF;
$sHtml .= ' ';
$sHtml .= ' ';
@@ -1112,7 +1112,7 @@ EOF;
$sHtml .= ' ';
// $sHtml .= ' ';
// $sHtml .= ' ';
diff --git a/application/loginwebpage.class.inc.php b/application/loginwebpage.class.inc.php
index 98d99dcc2..8a7419610 100644
--- a/application/loginwebpage.class.inc.php
+++ b/application/loginwebpage.class.inc.php
@@ -98,10 +98,10 @@ class LoginWebPage extends NiceWebPage
}
$sVersionShort = Dict::Format('UI:iTopVersion:Short', ITOP_APPLICATION, ITOP_VERSION);
$sIconUrl = Utils::GetConfig()->Get('app_icon_url');
- $sDisplayIcon = utils::GetAbsoluteUrlAppRoot().'images/'.$sLogo.'?itopversion='.ITOP_VERSION;
+ $sDisplayIcon = utils::GetAbsoluteUrlAppRoot().'images/'.$sLogo.'?t='.utils::GetCacheBusterTimestamp();
if (file_exists(MODULESROOT.'branding/'.$sBrandingLogo))
{
- $sDisplayIcon = utils::GetAbsoluteUrlModulesRoot().'branding/'.$sBrandingLogo.'?itopversion='.ITOP_VERSION;
+ $sDisplayIcon = utils::GetAbsoluteUrlModulesRoot().'branding/'.$sBrandingLogo.'?t='.utils::GetCacheBusterTimestamp();
}
$this->add("\n");
}
diff --git a/application/ui.extkeywidget.class.inc.php b/application/ui.extkeywidget.class.inc.php
index e019ea963..1ddb35e0b 100644
--- a/application/ui.extkeywidget.class.inc.php
+++ b/application/ui.extkeywidget.class.inc.php
@@ -265,7 +265,7 @@ EOF
// the input for the auto-complete
$sHTMLValue .= "Count()."\" type=\"text\" id=\"label_$this->iId\" value=\"$sDisplayValue\"/>";
- $sHTMLValue .= "
iId}\" style=\"border:0;vertical-align:middle;cursor:pointer;\" src=\"../images/mini_search.gif?itopversion=".ITOP_VERSION."\" onClick=\"oACWidget_{$this->iId}.Search();\"/>";
+ $sHTMLValue .= "
iId}\" style=\"border:0;vertical-align:middle;cursor:pointer;\" src=\"../images/mini_search.gif?t=".utils::GetCacheBusterTimestamp()."\" onClick=\"oACWidget_{$this->iId}.Search();\"/>";
// another hidden input to store & pass the object's Id
$sHTMLValue .= "iId\" name=\"{$sAttrFieldPrefix}{$sFieldName}\" value=\"".htmlentities($value, ENT_QUOTES, 'UTF-8')."\" />\n";
@@ -289,7 +289,7 @@ EOF
}
if ($bExtensions && MetaModel::IsHierarchicalClass($this->sTargetClass) !== false)
{
- $sHTMLValue .= "
iId}\" style=\"border:0;vertical-align:middle;cursor:pointer;\" src=\"../images/mini_tree.gif?itopversion=".ITOP_VERSION."\" onClick=\"oACWidget_{$this->iId}.HKDisplay();\"/>";
+ $sHTMLValue .= "
iId}\" style=\"border:0;vertical-align:middle;cursor:pointer;\" src=\"../images/mini_tree.gif?t=".utils::GetCacheBusterTimestamp()."\" onClick=\"oACWidget_{$this->iId}.HKDisplay();\"/>";
$oPage->add_ready_script(
<<iId}').length == 0)
@@ -303,7 +303,7 @@ EOF
{
$sCallbackName = (MetaModel::IsAbstract($this->sTargetClass)) ? 'SelectObjectClass' : 'CreateObject';
- $sHTMLValue .= "
iId}\" style=\"border:0;vertical-align:middle;cursor:pointer;\" src=\"../images/mini_add.gif?itopversion=".ITOP_VERSION."\" onClick=\"oACWidget_{$this->iId}.{$sCallbackName}();\"/>";
+ $sHTMLValue .= "
iId}\" style=\"border:0;vertical-align:middle;cursor:pointer;\" src=\"../images/mini_add.gif?t=".utils::GetCacheBusterTimestamp()."\" onClick=\"oACWidget_{$this->iId}.{$sCallbackName}();\"/>";
$oPage->add_ready_script(
<<iId}').length == 0)
diff --git a/application/utils.inc.php b/application/utils.inc.php
index 84b37326c..6bd953ab4 100644
--- a/application/utils.inc.php
+++ b/application/utils.inc.php
@@ -1887,4 +1887,19 @@ class utils
}
return $aCleanHeaders;
}
+
+ /**
+ * Return a string based on compilation time or (if not available because the datamodel has not been loaded)
+ * the version of iTop. This string is useful to prevent browser side caching of content that may vary at each
+ * (re)installation of iTop (especially during development).
+ * @return string
+ */
+ public function GetCacheBusterTimestamp()
+ {
+ if(!defined('COMPILATION_TIMESTAMP'))
+ {
+ return ITOP_VERSION;
+ }
+ return COMPILATION_TIMESTAMP;
+ }
}
diff --git a/application/webpage.class.inc.php b/application/webpage.class.inc.php
index 018d57251..ea1708cee 100644
--- a/application/webpage.class.inc.php
+++ b/application/webpage.class.inc.php
@@ -541,11 +541,11 @@ class WebPage implements Page
// so that the new script do NOT get reloaded from the cache when the application is upgraded
if (strpos($s_script, '?') === false)
{
- $s_script .= "?itopversion=".ITOP_VERSION;
+ $s_script .= "?t=".utils::GetCacheBusterTimestamp();
}
else
{
- $s_script .= "&itopversion=".ITOP_VERSION;
+ $s_script .= "&t=".utils::GetCacheBusterTimestamp();
}
echo "\n";
}
@@ -562,11 +562,11 @@ class WebPage implements Page
{
if (strpos($a_stylesheet['link'], '?') === false)
{
- $s_stylesheet = $a_stylesheet['link']."?itopversion=".ITOP_VERSION;
+ $s_stylesheet = $a_stylesheet['link']."?t=".utils::GetCacheBusterTimestamp();
}
else
{
- $s_stylesheet = $a_stylesheet['link']."&itopversion=".ITOP_VERSION;
+ $s_stylesheet = $a_stylesheet['link']."&t=".utils::GetCacheBusterTimestamp();
}
if ($a_stylesheet['condition'] != "")
{
@@ -590,7 +590,7 @@ class WebPage implements Page
}
if (class_exists('MetaModel') && MetaModel::GetConfig())
{
- echo "\n";
+ echo "\n";
}
echo "\n";
echo "\n";
diff --git a/pages/ajax.render.php b/pages/ajax.render.php
index a9c408d98..cda35039e 100644
--- a/pages/ajax.render.php
+++ b/pages/ajax.render.php
@@ -1276,7 +1276,7 @@ EOF
$oPage->add('');
$oPage->add('
');
$oPage->add('');
- $oPage->add(' | ');
+ $oPage->add('.') | ');
$oPage->add('');
$oPage->add($sVersionString.' ');
$oPage->add(Dict::S('UI:About:DataModel').': '.$sDataModelVersion.' ');
diff --git a/setup/compiler.class.inc.php b/setup/compiler.class.inc.php
index 57e01a920..9a900c8f0 100644
--- a/setup/compiler.class.inc.php
+++ b/setup/compiler.class.inc.php
@@ -65,6 +65,8 @@ class MFCompiler
$this->sMainPHPCode .= "/**\n";
$this->sMainPHPCode .= " * This file was automatically generated by the compiler on ".date('Y-m-d H:i:s')." -- DO NOT EDIT\n";
$this->sMainPHPCode .= " */\n";
+ $this->sMainPHPCode .= "\n";
+ $this->sMainPHPCode .= "define('COMPILATION_TIMESTAMP', '".microtime(true)."');\n";
$this->aSnippets = array();
$this->aRelations = array();
}
diff --git a/setup/setuppage.class.inc.php b/setup/setuppage.class.inc.php
index 0c6448da3..a73fd38ea 100644
--- a/setup/setuppage.class.inc.php
+++ b/setup/setuppage.class.inc.php
@@ -268,7 +268,7 @@ h3.clickable.open {
public function output()
{
- $this->s_content = "{$this->s_content}\n \n";
+ $this->s_content = "{$this->s_content}\n \n";
return parent::output();
}
|