Fix cache_bust
Cache busting was preventing changing css due to leaving symlinks behind. Adding the css name to each symlink prevents the need for a forced refresh since mtime is the same on unchanged files but filename does not change between css sets.
This commit is contained in:
parent
b58efe6a36
commit
b655689f47
|
@ -2067,7 +2067,7 @@ function cache_bust( $file ) {
|
|||
# Use the last modified timestamp to create a link that gets a different filename
|
||||
# To defeat caching. Should probably use md5 hash
|
||||
$parts = pathinfo($file);
|
||||
$cacheFile = 'cache/'.$parts['filename'].'-'.filemtime($file).'.'.$parts['extension'];
|
||||
$cacheFile = 'cache/'.$parts['filename'].'-'.$_COOKIE['zmCSS'].'-'.filemtime($file).'.'.$parts['extension'];
|
||||
if ( file_exists( ZM_PATH_WEB.'/'.$cacheFile ) or symlink( ZM_PATH_WEB.'/'.$file, ZM_PATH_WEB.'/'.$cacheFile ) ) {
|
||||
return $cacheFile;
|
||||
} else {
|
||||
|
|
|
@ -65,6 +65,7 @@ if ( $tab == 'skins' ) {
|
|||
$current_css = $_COOKIE['zmCSS'];
|
||||
if ( isset($_GET['css-choice']) and ( $_GET['css-choice'] != $current_css ) ) {
|
||||
setcookie('zmCSS',$_GET['css-choice'], time()+3600*24*30*12*10 );
|
||||
array_map('unlink', glob(ZM_PATH_WEB.'/cache/*')); //cleanup symlinks from cache_bust
|
||||
//header("Location: index.php?view=options&tab=skins&reset_parent=1");
|
||||
$reload = true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue