// Fix PSCFV-3967

This commit is contained in:
rGaillard
2012-09-10 08:59:44 +00:00
parent 3ff989ac30
commit 89d9638f23
+24 -25
View File
@@ -134,7 +134,7 @@ elseif ($versionCompare === false)
$fail_result .= '<action result="fail" error="29" />'."\n"; $fail_result .= '<action result="fail" error="29" />'."\n";
} }
if((defined('_PS_CACHE_ENABLED_') && _PS_CACHE_ENABLED_ )) if((defined('_PS_CACHE_ENABLED_') && _PS_CACHE_ENABLED_))
{ {
$logger->logError('The cache is activated. Please deactivate it first before lauching this script.'); $logger->logError('The cache is activated. Please deactivate it first before lauching this script.');
$fail_result .= '<action result="fail" error="35" />'."\n"; $fail_result .= '<action result="fail" error="35" />'."\n";
@@ -282,10 +282,8 @@ if (empty($fail_result))
} }
} }
Configuration::loadConfiguration();
if (empty($fail_result)) if (empty($fail_result))
{
foreach ($sqlContentVersion as $version => $sqlContent) foreach ($sqlContentVersion as $version => $sqlContent)
foreach ($sqlContent as $query) foreach ($sqlContent as $query)
{ {
@@ -360,29 +358,31 @@ if (empty($fail_result))
</request>'."\n"; </request>'."\n";
} }
} }
Configuration::loadConfiguration();
// Settings updated, compile and cache directories must be emptied
$tools_dir = rtrim(_PS_INSTALL_PATH_, '\\/').DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'tools'.DIRECTORY_SEPARATOR;
$arrayToClean = array(
$tools_dir.'smarty'.DIRECTORY_SEPARATOR.'cache',
$tools_dir.'smarty'.DIRECTORY_SEPARATOR.'compile',
$tools_dir.'smarty_v2'.DIRECTORY_SEPARATOR.'cache',
$tools_dir.'smarty_v2'.DIRECTORY_SEPARATOR.'compile'
);
foreach ($arrayToClean as $dir)
if (file_exists($dir))
foreach (scandir($dir) as $file)
if ($file[0] != '.' AND $file != 'index.php' AND $file != '.htaccess')
unlink($dir.DIRECTORY_SEPARATOR.$file);
// delete cache filesystem if activated // Settings updated, compile and cache directories must be emptied
$depth = Configuration::get('PS_CACHEFS_DIRECTORY_DEPTH'); $tools_dir = rtrim(_PS_INSTALL_PATH_, '\\/').DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'tools'.DIRECTORY_SEPARATOR;
if (defined('_PS_CACHE_ENABLED_') && _PS_CACHE_ENABLED_ && $depth) $arrayToClean = array(
{ $tools_dir.'smarty'.DIRECTORY_SEPARATOR.'cache',
CacheFs::deleteCacheDirectory(); $tools_dir.'smarty'.DIRECTORY_SEPARATOR.'compile',
CacheFs::createCacheDirectories((int)$depth); $tools_dir.'smarty_v2'.DIRECTORY_SEPARATOR.'cache',
$tools_dir.'smarty_v2'.DIRECTORY_SEPARATOR.'compile'
);
foreach ($arrayToClean as $dir)
if (file_exists($dir))
foreach (scandir($dir) as $file)
if ($file[0] != '.' AND $file != 'index.php' AND $file != '.htaccess')
unlink($dir.DIRECTORY_SEPARATOR.$file);
// delete cache filesystem if activated
$depth = Configuration::get('PS_CACHEFS_DIRECTORY_DEPTH');
if (defined('_PS_CACHE_ENABLED_') && _PS_CACHE_ENABLED_ && $depth)
{
CacheFs::deleteCacheDirectory();
CacheFs::createCacheDirectories((int)$depth);
}
} }
$result = '<?xml version="1.0" encoding="UTF-8"?>'; $result = '<?xml version="1.0" encoding="UTF-8"?>';
if (empty($fail_result)) if (empty($fail_result))
{ {
@@ -444,4 +444,3 @@ else
} }
} }
} }