From 04cabfe0f3f8ae879054facf45317a7adfd2bfe1 Mon Sep 17 00:00:00 2001 From: rMalie Date: Mon, 23 Jan 2012 17:46:16 +0000 Subject: [PATCH] // Db::autoExecute() call are now replaced by Db::insert() or Db::update() --- install-new/classes/xmlLoader.php | 6 +++--- .../upgrade/php/generate_root_category_for_multishop.php | 4 ++-- install-new/upgrade/php/generate_tax_rules.php | 2 +- install-new/upgrade/php/migrate_block_info_to_cms_block.php | 6 +++--- install-new/upgrade/php/module_reinstall_blockmyaccount.php | 2 +- install-new/upgrade/php/module_reinstall_blocksearch.php | 2 +- install-new/upgrade/php/setAllGroupsOnHomeCategory.php | 6 +++--- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/install-new/classes/xmlLoader.php b/install-new/classes/xmlLoader.php index b55a5294c..55034ee27 100644 --- a/install-new/classes/xmlLoader.php +++ b/install-new/classes/xmlLoader.php @@ -391,11 +391,11 @@ class InstallXmlLoader { foreach ($this->delayed_inserts as $entity => $queries) { - $type = 'INSERT IGNORE'; + $type = Db::INSERT_IGNORE; if ($entity == 'access') - $type = 'REPLACE'; + $type = Db::REPLACE; - if (!Db::getInstance()->autoExecute(_DB_PREFIX_.$entity, $queries, $type)) + if (!Db::getInstance()->insert($entity, $queries, false, true, $type)) $this->setError($this->language->l('An SQL error occured for entity %1$s: %2$s', $entity, Db::getInstance()->getMsgError())); unset($this->delayed_inserts[$entity]); } diff --git a/install-new/upgrade/php/generate_root_category_for_multishop.php b/install-new/upgrade/php/generate_root_category_for_multishop.php index 33a933524..bec22ab7d 100644 --- a/install-new/upgrade/php/generate_root_category_for_multishop.php +++ b/install-new/upgrade/php/generate_root_category_for_multishop.php @@ -32,7 +32,7 @@ function generate_root_category_for_multishop() 'name' => 'Root', 'link_rewrite' => '', ); - Db::getInstance()->autoExecute(_DB_PREFIX_.'category_lang', $data, 'INSERT'); + Db::getInstance()->insert('category_lang', $data); $categories = Db::getInstance()->executeS(' SELECT `id_category` @@ -45,7 +45,7 @@ function generate_root_category_for_multishop() 'id_category' => $category['id_category'], 'id_shop' => $shop['id_shop'] ); - Db::getInstance()->autoExecute(_DB_PREFIX_.'category_shop', $data, 'INSERT'); + Db::getInstance()->insert('category_shop', $data); Db::getInstance()->execute(' UPDATE `'._DB_PREFIX_.'category` diff --git a/install-new/upgrade/php/generate_tax_rules.php b/install-new/upgrade/php/generate_tax_rules.php index 044ff4a63..343f8517b 100644 --- a/install-new/upgrade/php/generate_tax_rules.php +++ b/install-new/upgrade/php/generate_tax_rules.php @@ -40,7 +40,7 @@ function generate_tax_rules() 'id_tax' => $id_tax, 'name' => 'Rule '.$tax['rate'].'%', ); - Db::getInstance()->AutoExecute(_DB_PREFIX_.'category_group', $row, 'INSERT'); + Db::getInstance()->insert('category_group', $row); $id_tax_rules_group = Db::getInstance()->insert_id; diff --git a/install-new/upgrade/php/migrate_block_info_to_cms_block.php b/install-new/upgrade/php/migrate_block_info_to_cms_block.php index 6419e17fe..eae462321 100644 --- a/install-new/upgrade/php/migrate_block_info_to_cms_block.php +++ b/install-new/upgrade/php/migrate_block_info_to_cms_block.php @@ -44,8 +44,8 @@ function migrate_block_info_to_cms_block() FROM `'._DB_PREFIX_.'configuration` WHERE name="PS_LANG_DEFAULT"'); // 2) parent::install() - $result = Db::getInstance()->AutoExecute(_DB_PREFIX_.'module', - array('name' => 'blockcms', 'active' => 1), 'INSERT'); + $result = Db::getInstance()->insert('module', + array('name' => 'blockcms', 'active' => 1)); $id_module = Db::getInstance()->insert_Id(); // 3) hooks $hooks = array('leftColumn', 'rightColumn', 'footer', 'header'); @@ -56,7 +56,7 @@ function migrate_block_info_to_cms_block() FROM `'._DB_PREFIX_.'hook_module` hm LEFT JOIN `'._DB_PREFIX_.'hook` h on hm.id_hook=h.id_hook WHERE h.name = "'.$hook_name.'" group by id_hook'); - $res &= Db::getInstance()->AutoExecute(_DB_PREFIX_.'hook_module', $row, 'INSERT'); + $res &= Db::getInstance()->insert('hook_module', $row); } // module install diff --git a/install-new/upgrade/php/module_reinstall_blockmyaccount.php b/install-new/upgrade/php/module_reinstall_blockmyaccount.php index 1160fd549..4809d094d 100644 --- a/install-new/upgrade/php/module_reinstall_blockmyaccount.php +++ b/install-new/upgrade/php/module_reinstall_blockmyaccount.php @@ -43,7 +43,7 @@ function module_reinstall_blockmyaccount() FROM `'._DB_PREFIX_.'hook_module` hm LEFT JOIN `'._DB_PREFIX_.'hook` h on hm.id_hook=h.id_hook WHERE h.name = "'.$hook_name.'" group by id_hook'); - $res &= Db::getInstance()->AutoExecute(_DB_PREFIX_.'hook_module', $row, 'INSERT'); + $res &= Db::getInstance()->insert('hook_module', $row); } return $res; } diff --git a/install-new/upgrade/php/module_reinstall_blocksearch.php b/install-new/upgrade/php/module_reinstall_blocksearch.php index 879699e4b..dc70fa6a9 100644 --- a/install-new/upgrade/php/module_reinstall_blocksearch.php +++ b/install-new/upgrade/php/module_reinstall_blocksearch.php @@ -43,7 +43,7 @@ function module_reinstall_blocksearch() FROM `'._DB_PREFIX_.'hook_module` hm LEFT JOIN `'._DB_PREFIX_.'hook` h on hm.id_hook=h.id_hook WHERE h.name = "'.$hook_name.'" group by id_hook'); - $res &= Db::getInstance()->AutoExecute(_DB_PREFIX_.'hook_module', $row, 'INSERT'); + $res &= Db::getInstance()->insert('hook_module', $row); } return $res; } diff --git a/install-new/upgrade/php/setAllGroupsOnHomeCategory.php b/install-new/upgrade/php/setAllGroupsOnHomeCategory.php index 892807ca9..169c13e28 100755 --- a/install-new/upgrade/php/setAllGroupsOnHomeCategory.php +++ b/install-new/upgrade/php/setAllGroupsOnHomeCategory.php @@ -35,13 +35,13 @@ function setAllGroupsOnHomeCategory() foreach ($results AS $result) $groups[] = $result['id_group']; - if (is_array($groups) && sizeof($groups)) + if (is_array($groups) && count($groups)) { // cleanGroups Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'category_group` WHERE `id_category` = 1'); // addGroups($groups); - $row = array('id_category' => 1, 'id_group' => (int)($groups)); - Db::getInstance()->autoExecute(_DB_PREFIX_.'category_group', $row, 'INSERT'); + $row = array('id_category' => 1, 'id_group' => (int)$groups); + Db::getInstance()->insert('category_group', $row); } }