Purge browser cache using a timestamp variable when switching templates.
This should hopefully fix Ian and my problems.
This commit is contained in:
parent
18dcec7bdd
commit
71ee300143
@ -3,8 +3,12 @@
|
||||
Version 2.0 ()
|
||||
------------------------------------------------------------------------
|
||||
|
||||
* When switching templates, both the backend and the frontend
|
||||
will remember the timestamp of the last template change,
|
||||
to make sure that the browser will not cache a mismatching CSS.
|
||||
|
||||
* Use Smarty for backend display output
|
||||
|
||||
|
||||
Version 1.7 ()
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
@ -65,6 +65,7 @@ if ($serendipity['GET']['adminAction'] == 'install' ) {
|
||||
|
||||
serendipity_set_config_var('template', htmlspecialchars($serendipity['GET']['theme']));
|
||||
serendipity_set_config_var('template_engine', isset($themeInfo['engine']) ? $themeInfo['engine'] : 'default');
|
||||
serendipity_set_config_var('last_template_change', time());
|
||||
|
||||
$data["adminAction"] = "install";
|
||||
$data["install_template"] = htmlspecialchars($serendipity['GET']['theme']);
|
||||
|
@ -967,6 +967,14 @@ function serendipity_smarty_init($vars = array()) {
|
||||
|
||||
if (!isset($serendipity['smarty_vars']['head_link_stylesheet'])) {
|
||||
$serendipity['smarty_vars']['head_link_stylesheet'] = serendipity_rewriteURL('serendipity.css');
|
||||
|
||||
// When templates are switched, append a specific version string to make sure the browser does not cache the CSS
|
||||
if (strstr($serendipity['smarty_vars']['head_link_stylesheet'], '?')) {
|
||||
$serendipity['smarty_vars']['head_link_stylesheet'] .= '&v=' . $serendipity['last_template_change'];
|
||||
} else {
|
||||
$serendipity['smarty_vars']['head_link_stylesheet'] .= '?v=' . $serendipity['last_template_change'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$serendipity['smarty']->assign(
|
||||
|
@ -14,9 +14,24 @@ if (IS_installed === false) {
|
||||
require(S9Y_INCLUDE_PATH . 'include/functions_permalinks.inc.php');
|
||||
require(S9Y_INCLUDE_PATH . 'include/functions_installer.inc.php');
|
||||
require(S9Y_INCLUDE_PATH . 'include/functions_config.inc.php');
|
||||
$css_file = 'serendipity.css.php?serendipity[css_mode]=serendipity_admin.css';
|
||||
$css_file = 'serendipity.css.php?serendipity[css_mode]=serendipity_admin.css&v=' . time();
|
||||
} else {
|
||||
$css_file = serendipity_rewriteURL('serendipity_admin.css');
|
||||
|
||||
// This is a bit of an ugly hack, but when switching templates, the HTML head is already emitted,
|
||||
// so we need a way to actually enforce switching/updating the CSS. So we need to do it at
|
||||
// this place.
|
||||
if ($serendipity['GET']['adminAction'] == 'install' && $serendipity['GET']['adminModule'] == 'templates') {
|
||||
$serendipity['last_template_change'] = time();
|
||||
}
|
||||
|
||||
// When templates are switched, append a specific version string to make sure the browser does not cache the CSS
|
||||
if (strstr($css_file, '?')) {
|
||||
$css_file .= '&v=' . $serendipity['last_template_change'];
|
||||
} else {
|
||||
$css_file .= '?v=' . $serendipity['last_template_change'];
|
||||
}
|
||||
|
||||
if (defined('IS_up2date') && IS_up2date === true) {
|
||||
serendipity_plugin_api::hook_event('backend_configure', $serendipity);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user