// fix upgrade fail when blockcms was not installed
This commit is contained in:
@@ -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;
|
||||||
|
}
|
||||||
@@ -105,15 +105,7 @@ CREATE TABLE `PREFIX_carrier_shop` (
|
|||||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||||
INSERT INTO `PREFIX_carrier_shop` (id_shop, id_carrier) (SELECT 1, id_carrier FROM PREFIX_carrier);
|
INSERT INTO `PREFIX_carrier_shop` (id_shop, id_carrier) (SELECT 1, id_carrier FROM PREFIX_carrier);
|
||||||
|
|
||||||
CREATE TABLE `PREFIX_cms_shop` (
|
/* PHP:upgrade_cms_15(); */;
|
||||||
`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`;
|
|
||||||
|
|
||||||
CREATE TABLE `PREFIX_lang_shop` (
|
CREATE TABLE `PREFIX_lang_shop` (
|
||||||
`id_lang` INT( 11 ) UNSIGNED NOT NULL,
|
`id_lang` INT( 11 ) UNSIGNED NOT NULL,
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ else
|
|||||||
|
|
||||||
// need for upgrade before 1.5
|
// need for upgrade before 1.5
|
||||||
if (!defined('__PS_BASE_URI__'))
|
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
|
// need for upgrade before 1.5
|
||||||
if (!defined('_THEME_NAME_'))
|
if (!defined('_THEME_NAME_'))
|
||||||
|
|||||||
Reference in New Issue
Block a user