Shmasser Posted August 29, 2016 Share Posted August 29, 2016 (edited) Hi. v.1.6.0.9 Does anyone know, why when you refresh the cache every time the Files is rewritten the JS and CSS with a new name? Even if these files have not been changed. This leads to inadequate display of pages in the cache of search engines. In the file /classes/Media.php has the following lines: public static function clearCache() { foreach (array(_PS_THEME_DIR_.'cache') as $dir) if (file_exists($dir)) foreach (scandir($dir) as $file) if ($file[0] != '.' && $file != 'index.php') Tools::deleteFile($dir.DIRECTORY_SEPARATOR.$file, array('index.php')); $version = (int)Configuration::get('PS_CCCJS_VERSION'); Configuration::updateValue('PS_CCCJS_VERSION', ++$version); $version = (int)Configuration::get('PS_CCCCSS_VERSION'); Configuration::updateValue('PS_CCCCSS_VERSION', ++$version); } which change the version number (and change the name of the site). What is the meaning of these changes and what will happen, if to remove these lines from your code and leave the file names unchanged? Edited August 29, 2016 by Shmasser (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted August 29, 2016 Share Posted August 29, 2016 it is for browser caching purpose if you will have, for example XXXXXXXX.css file name all the time browser will display old contents of this file (because browser will display cached version of file) new file name = new load of file contents. Link to comment Share on other sites More sharing options...
Shmasser Posted August 29, 2016 Author Share Posted August 29, 2016 (edited) But why the old CSS and JS files are renamed when you upgrade the cache? To the version number is the last. For example, there was v_355_XXX, v_356_XXX now Edited August 29, 2016 by Shmasser (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now