// fix upgrade fail when blockcms was not installed

This commit is contained in:
mMarinetti
2012-02-14 17:21:47 +00:00
parent 3af1c7664f
commit 5f32555837
3 changed files with 21 additions and 10 deletions
@@ -0,0 +1,19 @@
<?php
function upgrade_cms_15()
{
$res = true;
$id_module_cms = Db::getInstance()->getValue('SELECT id_module from `'._DB_PREFIX_.'_module where name="blockcms"`');
if (!$id_module_cms)
return true;
$res &= 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=ENGINE_TYPE DEFAULT CHARSET=utf8;');
$res &= Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'_cms_shop` (id_shop, id_cms) (SELECT 1, id_cms FROM '._DB_PREFIX_.'_cms)');
$res &= Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'._cms_block` ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT "1" AFTER `id_cms_block`');
return $res;
}
+1 -9
View File
@@ -105,15 +105,7 @@ CREATE TABLE `PREFIX_carrier_shop` (
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
INSERT INTO `PREFIX_carrier_shop` (id_shop, id_carrier) (SELECT 1, id_carrier FROM PREFIX_carrier);
CREATE TABLE `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=ENGINE_TYPE DEFAULT CHARSET=utf8;
INSERT INTO `PREFIX_cms_shop` (id_shop, id_cms) (SELECT 1, id_cms FROM PREFIX_cms);
ALTER TABLE `PREFIX_cms_block` ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_cms_block`;
/* PHP:upgrade_cms_15(); */;
CREATE TABLE `PREFIX_lang_shop` (
`id_lang` INT( 11 ) UNSIGNED NOT NULL,
+1 -1
View File
@@ -65,7 +65,7 @@ else
// need for upgrade before 1.5
if (!defined('__PS_BASE_URI__'))
define('__PS_BASE_URI__', str_replace('//', '/', '/'.trim(preg_replace('#/(install(-dev|-new)?)$#', '/', str_replace('\\', '/', dirname($_SERVER['REQUEST_URI']))), '/').'/'));
define('__PS_BASE_URI__', str_replace('//', '/', '/'.trim(preg_replace('#/(install(-dev)?)$#', '/', str_replace('\\', '/', dirname($_SERVER['REQUEST_URI']))), '/').'/'));
// need for upgrade before 1.5
if (!defined('_THEME_NAME_'))