From 5123d2505e414a309ef01118ce8c50106def832e Mon Sep 17 00:00:00 2001 From: gRoussac Date: Tue, 13 Aug 2013 16:29:40 +0200 Subject: [PATCH] [-] CORE : Do not delete index.php in smarty cache or /img/tmp/ --- install-dev/models/install.php | 11 +++++++---- .../sysplugins/smarty_internal_cacheresource_file.php | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/install-dev/models/install.php b/install-dev/models/install.php index e652d8528..2d83c6707 100644 --- a/install-dev/models/install.php +++ b/install-dev/models/install.php @@ -369,10 +369,13 @@ class InstallModelInstall extends InstallAbstractModel { // Clear smarty cache Tools::clearSmartyCache(); - + //clear image cache in tmp folder - Tools::deleteDirectory(_PS_TMP_IMG_DIR_, false); - + if (file_exists(_PS_TMP_IMG_DIR_)) + foreach (scandir(_PS_TMP_IMG_DIR_) as $file) + if ($file[0] != '.' && $file != 'index.php') + self::deleteDirectory($dir.DIRECTORY_SEPARATOR.$file); + $default_data = array( 'shop_name' => 'My Shop', 'shop_activity' => '', @@ -395,7 +398,7 @@ class InstallModelInstall extends InstallAbstractModel // use the old image system if the safe_mod is enabled otherwise the installer will fail with the fixtures installation if (InstallSession::getInstance()->safe_mode) - Configuration::updateGlobalValue('PS_LEGACY_IMAGES', 1); + Configuration::updateGlobalValue('PS_LEGACY_IMAGES', 1); $id_country = Country::getByIso($data['shop_country']); diff --git a/tools/smarty/sysplugins/smarty_internal_cacheresource_file.php b/tools/smarty/sysplugins/smarty_internal_cacheresource_file.php index fca897d9f..cf6dba95a 100644 --- a/tools/smarty/sysplugins/smarty_internal_cacheresource_file.php +++ b/tools/smarty/sysplugins/smarty_internal_cacheresource_file.php @@ -178,7 +178,7 @@ $_cacheDirs = new RecursiveDirectoryIterator($_dir); $_cache = new RecursiveIteratorIterator($_cacheDirs, RecursiveIteratorIterator::CHILD_FIRST); foreach ($_cache as $_file) { - if (substr(basename($_file->getPathname()),0,1) == '.' || strpos($_file, '.svn') !== false) continue; + if (substr(basename($_file->getPathname()),0,1) == '.' || strpos($_file, '.svn') !== false || strpos($_file, 'index.php') !== false) continue; // directory ? if ($_file->isDir()) { if (!$_cache->isDot()) {