Jump to content

Change file names when updating the cache


Recommended Posts

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 by Shmasser (see edit history)
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...