diff --git a/js/ajax.js b/js/ajax.js
index 13e388a58c..71219cc4a5 100644
--- a/js/ajax.js
+++ b/js/ajax.js
@@ -571,6 +571,7 @@ var AJAX = {
}
}
request.push("call_done=1");
+ request.push("v=" + encodeURIComponent(PMA_commonParams.get('PMA_VERSION')));
// Download the composite js file, if necessary
if (needRequest) {
this.appendScript("js/get_scripts.js.php?" + request.join("&"));
diff --git a/libraries/Header.class.php b/libraries/Header.class.php
index 767f13012f..05c37cb5cd 100644
--- a/libraries/Header.class.php
+++ b/libraries/Header.class.php
@@ -257,6 +257,7 @@ class PMA_Header
'confirm' => $GLOBALS['cfg']['Confirm'],
'LoginCookieValidity' => $GLOBALS['cfg']['LoginCookieValidity'],
'logged_in' => isset($GLOBALS['userlink']) ? true : false,
+ 'PMA_VERSION' => PMA_VERSION
);
if (isset($GLOBALS['cfg']['Server'])
&& isset($GLOBALS['cfg']['Server']['auth_type'])
@@ -649,27 +650,28 @@ class PMA_Header
$basedir = defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : '';
$theme_id = $GLOBALS['PMA_Config']->getThemeUniqueValue();
$theme_path = $GLOBALS['pmaThemePath'];
+ $v = self::getVersionParameter();
if ($this->_isPrintView) {
$retval .= '';
+ . $basedir . 'print.css?' . $v . '" />';
} else {
// load jQuery's CSS prior to our theme's CSS, to let the theme
// override jQuery's CSS
$retval .= '';
$retval .= '';
+ . $basedir . 'js/codemirror/lib/codemirror.css?' . $v . '" />';
$retval .= '';
+ . $basedir . 'js/codemirror/addon/hint/show-hint.css?' . $v . '" />';
$retval .= '';
+ . $basedir . 'js/codemirror/addon/lint/lint.css?' . $v . '" />';
$retval .= '';
// load Print view's CSS last, so that it overrides all other CSS while 'printing'
$retval .= '';
+ . $theme_path . '/css/printview.css?' . $v . '" />';
}
return $retval;
@@ -777,5 +779,16 @@ class PMA_Header
}
return $retval;
}
+
+ /**
+ * Returns the phpMyAdmin version to be appended to the url to avoid caching
+ * between versions
+ *
+ * @return string urlenocded pma version as a parameter
+ */
+ public static function getVersionParameter()
+ {
+ return "v=" . urlencode(PMA_VERSION);
+ }
}
diff --git a/libraries/Scripts.class.php b/libraries/Scripts.class.php
index 7e9f6a01a8..8c4b7aab79 100644
--- a/libraries/Scripts.class.php
+++ b/libraries/Scripts.class.php
@@ -53,15 +53,18 @@ class PMA_Scripts
$first_dynamic_scripts = "";
$dynamic_scripts = "";
$scripts = array();
+ $separator = PMA_URL_getArgSeparator();
foreach ($files as $value) {
if (/*overload*/mb_strpos($value['filename'], "?") !== false) {
+ $file_name = $value['filename'] . $separator
+ . PMA_Header::getVersionParameter();
if ($value['before_statics'] === true) {
$first_dynamic_scripts
.= "";
+ . $file_name . "'>";
} else {
$dynamic_scripts .= "";
+ . $file_name . "'>";
}
continue;
}
@@ -81,8 +84,8 @@ class PMA_Scripts
$scripts[] = "scripts%5B%5D=" . $value['filename'];
}
}
- $separator = PMA_URL_getArgSeparator();
- $url = 'js/get_scripts.js.php?' . implode($separator, $scripts);
+ $url = 'js/get_scripts.js.php?' . implode($separator, $scripts)
+ . $separator . PMA_Header::getVersionParameter();
$static_scripts = sprintf(
'',
diff --git a/test/classes/PMA_Scripts_test.php b/test/classes/PMA_Scripts_test.php
index 49af79bc2f..4b3a372e0c 100644
--- a/test/classes/PMA_Scripts_test.php
+++ b/test/classes/PMA_Scripts_test.php
@@ -81,7 +81,7 @@ class PMA_Scripts_Test extends PHPUnit_Framework_TestCase
$this->assertEquals(
'',
+ . 'scripts%5B%5D=common.js&v=' . PMA_VERSION . '">',
$this->_callPrivateFunction(
'_includeFiles',
array(
@@ -111,7 +111,7 @@ class PMA_Scripts_Test extends PHPUnit_Framework_TestCase
$this->assertRegExp(
'@'
+ . 'scripts%5B%5D=common.js&v=' . PMA_VERSION . '">'
. '