From 4f99dfd2d6d0c886a0ed23baa8f8879a9eb8034b Mon Sep 17 00:00:00 2001 From: dMetzger Date: Thu, 9 Aug 2012 07:24:03 +0000 Subject: [PATCH] // Removed some warnings in the updater git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16770 b9a71923-0436-4b27-9f14-aed3839534dd --- .../update_mailalerts_add_column_idshop.php | 13 +++---------- install-dev/upgrade/upgrade.php | 18 +++++++++--------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/install-dev/upgrade/php/update_mailalerts_add_column_idshop.php b/install-dev/upgrade/php/update_mailalerts_add_column_idshop.php index 318f3a366..bfe479a40 100644 --- a/install-dev/upgrade/php/update_mailalerts_add_column_idshop.php +++ b/install-dev/upgrade/php/update_mailalerts_add_column_idshop.php @@ -6,15 +6,8 @@ function update_mailalerts_add_column_idshop() { - $id_mailalerts = Db::getInstance()->getValue('SELECT id_module FROM `'._DB_PREFIX_.'module` WHERE name = "mailalerts"'); - - if($id_mailalerts) - { - $res = Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'mailalert_customer_oos` ADD COLUMN `id_shop` int(11) NOT NULL default "0" AFTER `id_customer`'); - if ($res) - return true; - else - return array('error' => 1, 'msg' => sprintf('unable to create column id_shop (%s)', Db::getInstance ()->getMsgError())); - } + $installed = Db::getInstance()->getValue('SELECT id_module FROM `'._DB_PREFIX_.'module` WHERE name = "mailalerts"'); + if ($installed && !Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'mailalert_customer_oos` ADD COLUMN `id_shop` int(11) NOT NULL default "0" AFTER `id_customer`')) + return array('error' => 1, 'msg' => sprintf('unable to create column id_shop (%s)', Db::getInstance ()->getMsgError())); return true; } diff --git a/install-dev/upgrade/upgrade.php b/install-dev/upgrade/upgrade.php index b2a1fdb9d..43885b0e4 100644 --- a/install-dev/upgrade/upgrade.php +++ b/install-dev/upgrade/upgrade.php @@ -362,22 +362,22 @@ if (empty($fail_result)) } // Settings updated, compile and cache directories must be emptied +$tools_dir = rtrim(_PS_INSTALL_PATH_, '\\/').DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'tools'.DIRECTORY_SEPARATOR; $arrayToClean = array( - _PS_INSTALL_PATH_.'/../tools/smarty/cache/', - _PS_INSTALL_PATH_.'/../tools/smarty/compile/', - _PS_INSTALL_PATH_.'/../tools/smarty_v2/cache/', - _PS_INSTALL_PATH_.'/../tools/smarty_v2/compile/'); + $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)) - $logger->logError('directory '.$dir." doesn't exist and can't be emptied.\r\n"); - else + if (file_exists($dir)) foreach (scandir($dir) as $file) if ($file[0] != '.' AND $file != 'index.php' AND $file != '.htaccess') - unlink($dir.$file); + 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) +if (defined('_PS_CACHE_ENABLED_') && _PS_CACHE_ENABLED_ && $depth) { CacheFs::deleteCacheDirectory(); CacheFs::createCacheDirectories((int)$depth);