//fix for 1.5.2.0

This commit is contained in:
vAugagneur
2012-10-22 12:41:28 +00:00
parent f38ef7b915
commit fc94b42d7d
20 changed files with 266 additions and 187 deletions
+2 -2
View File
@@ -36,7 +36,7 @@ function editorial_update()
`id_editorial` int(10) unsigned NOT NULL auto_increment,
`body_home_logo_link` varchar(255) NOT NULL,
PRIMARY KEY (`id_editorial`))
ENGINE=MyISAM DEFAULT CHARSET=utf8');
ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8');
Db::getInstance()->execute('
CREATE TABLE `'._DB_PREFIX_.'editorial_lang` (
@@ -47,7 +47,7 @@ function editorial_update()
`body_paragraph` text NOT NULL,
`body_logo_subheading` varchar(255) NOT NULL,
PRIMARY KEY (`id_editorial`, `id_lang`))
ENGINE=MyISAM DEFAULT CHARSET=utf8');
ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8');
if (file_exists(dirname(__FILE__).'/../../modules/editorial/editorial.xml'))
{
+67
View File
@@ -0,0 +1,67 @@
<?php
/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 15469 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
function fix_cms_shop_1520()
{
$res = true;
$db = Db::getInstance();
//test if cms_shop with 2 underscore is present to rename it.
$result = $db->executeS('SHOW TABLES LIKE "'._DB_PREFIX_.'_cms_shop"');
if (!is_array($result) || !count($result) || !$result)
{
$res &= create_table_cms_shop();
if ($res)
insert_table_cms_to_cms_shop();
}
//test if cms_shop with 1 underscore is present and create if not.
$result = $db->executeS('SHOW TABLES LIKE "'._DB_PREFIX_.'cms_shop"');
if (!is_array($result) || !count($result) || !$result)
{
$res &= create_table_cms_shop();
if ($res)
insert_table_cms_to_cms_shop();
}
}
function insert_table_cms_to_cms_shop()
{
// /!\ : _cms_shop and _cms are wrong tables name (fixed in 1.5.0.12.sql : upgrade_cms_15_rename() )
$res &= Db::getInstance()->execute(
'INSERT INTO `'._DB_PREFIX_.'cms_shop` (id_shop, id_cms)
(SELECT 1, id_cms FROM '._DB_PREFIX_.'_cms)');
}
function create_table_cms_shop()
{
return Db::getInstance()->execute(
'CREATE TABLE `'._DB_PREFIX_.'cms_shop` (
`id_cms` INT( 11 ) UNSIGNED NOT NULL,
`id_shop` INT( 11 ) UNSIGNED NOT NULL ,
PRIMARY KEY (`id_cms`, `id_shop`),
KEY `id_shop` (`id_shop`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;');
}
@@ -68,7 +68,7 @@ function migrate_block_info_to_cms_block()
`position` int(10) unsigned NOT NULL default \'0\',
`display_store` tinyint(1) unsigned NOT NULL default \'1\',
PRIMARY KEY (`id_cms_block`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8');
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8');
$res &= Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'cms_block` (`id_cms_category`, `location`, `position`) VALUES(1, 0, 0)');
$res &= Db::getInstance()->execute('
@@ -77,7 +77,7 @@ function migrate_block_info_to_cms_block()
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(40) NOT NULL default \'\',
PRIMARY KEY (`id_cms_block`, `id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8');
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8');
$query_lang = 'INSERT INTO `'._DB_PREFIX_.'cms_block_lang` (`id_cms_block`, `id_lang`) VALUES';
foreach ($languages AS $language)
@@ -92,7 +92,7 @@ function migrate_block_info_to_cms_block()
`id_cms` int(10) unsigned NOT NULL,
`is_category` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`id_cms_block_page`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8');
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8');
$res &= Db::getInstance()->getValue('REPLACE INTO `'._DB_PREFIX_.'configuration`
(name, value) VALUES ("FOOTER_CMS", "")');
@@ -35,14 +35,14 @@ function update_module_product_comments()
`id_customer` int(10) unsigned NOT NULL,
`usefulness` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`id_product_comment`, `id_customer`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8');
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8');
Db::getInstance()->execute('
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'product_comment_report` (
`id_product_comment` int(10) unsigned NOT NULL,
`id_customer` int(10) unsigned NOT NULL,
PRIMARY KEY (`id_product_comment`, `id_customer`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8');
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8');
}
}
@@ -9,14 +9,14 @@ function update_modules_multishop()
`id_blocklink` int(2) NOT NULL AUTO_INCREMENT,
`id_shop` varchar(255) NOT NULL,
PRIMARY KEY(`id_blocklink`, `id_shop`))
ENGINE=MyISAM default CHARSET=utf8');
ENGINE='._MYSQL_ENGINE_.' default CHARSET=utf8');
Db::getInstance()->execute('
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'cms_block_shop` (
`id_cms_block` int(10) unsigned NOT NULL auto_increment,
`id_shop` int(10) unsigned NOT NULL,
PRIMARY KEY (`id_cms_block`, `id_shop`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8');
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8');
Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'cms_block_shop (cms_block, id_shop)
(SELECT id_cms_block, 1 FROM '._DB_PREFIX_.'cms_block)');
@@ -30,7 +30,7 @@ function update_modules_multishop()
`id_blocklink` int(2) NOT NULL AUTO_INCREMENT,
`id_shop` varchar(255) NOT NULL,
PRIMARY KEY(`id_blocklink`, `id_shop`))
ENGINE=MyISAM default CHARSET=utf8');
ENGINE='._MYSQL_ENGINE_.' default CHARSET=utf8');
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'blocklink_shop` (id_blocklink, id_shop)
(SELECT id_blocklink, 1 FROM `'._DB_PREFIX_.'blocklink`)');
}
@@ -38,7 +38,7 @@ function update_order_canada()
`tax_name` varchar(40) NOT NULL,
`tax_rate` decimal(6,3) NOT NULL,
`amount` decimal(20,6) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8');
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8');
$address_field = Db::getInstance()->getValue('SELECT value
@@ -24,7 +24,7 @@ function update_stock_mvt_reason()
//Recreate new standards movements
Db::getInstance()->execute('
INSERT INTO `PREFIX_stock_mvt_reason` (`id_stock_mvt_reason`, `sign`, `date_add`, `date_upd`)
INSERT INTO `'._DB_PREFIX_.'stock_mvt_reason` (`id_stock_mvt_reason`, `sign`, `date_add`, `date_upd`)
VALUES
(1, 1, NOW(), NOW()),
(2, -1, NOW(), NOW()),
@@ -37,7 +37,7 @@ function update_stock_mvt_reason()
');
Db::getInstance()->execute("
INSERT INTO `PREFIX_stock_mvt_reason_lang` (`id_stock_mvt_reason`, `id_lang`, `name`)
INSERT INTO `"._DB_PREFIX_."stock_mvt_reason_lang` (`id_stock_mvt_reason`, `id_lang`, `name`)
VALUES
(1, 1, 'Increase'),
(1, 2, 'Augmenter'),
@@ -87,7 +87,7 @@ function update_stock_mvt_reason()
foreach ($mvts as $mvt)
{
Db::getInstance()->execute('
INSERT INTO `PREFIX_stock_mvt_reason` (`sign`, `date_add`, `date_upd`)
INSERT INTO `'._DB_PREFIX_.'stock_mvt_reason` (`sign`, `date_add`, `date_upd`)
VALUES ("'.(int)$mvt['sign'].'", "'.pSQL($mvt['date_add']).'", "'.pSQL($mvt['date_upd']).'")
');
@@ -99,7 +99,7 @@ function update_stock_mvt_reason()
continue;
Db::getInstance()->execute('
INSERT INTO `PREFIX_stock_mvt_reason_lang` (`id_stock_mvt_reason`, `id_lang`, `name`)
INSERT INTO `'._DB_PREFIX_.'stock_mvt_reason_lang` (`id_stock_mvt_reason`, `id_lang`, `name`)
VALUES ("'.(int)$row_id.'", "'.(int)$mvt_lang['id_lang'].'", "'.pSQL($mvt_lang['name']).'")
');
}
+1 -1
View File
@@ -36,7 +36,7 @@ function upgrade_cms_15()
`id_shop` INT( 11 ) UNSIGNED NOT NULL ,
PRIMARY KEY (`id_cms`, `id_shop`),
KEY `id_shop` (`id_shop`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;');
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;');
// /!\ : _cms_shop and _cms are wrong tables name (fixed in 1.5.0.12.sql : upgrade_cms_15_rename() )
$res &= Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'_cms_shop` (id_shop, id_cms)