// various fix in upgrader (for 1.2.1.0 and 1.1.0.3 + convert_product_price ObjectModel no more used)
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12546 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -6,31 +6,49 @@ function create_multistore()
|
||||
{
|
||||
$res = true;
|
||||
|
||||
$themes = scandir(dirname(__FILE__).'/../../themes');
|
||||
// @todo : use _PS_ROOT_DIR_
|
||||
if (defined('__PS_BASE_URI__'))
|
||||
$INSTALLER__PS_BASE_URI = __PS_BASE_URI__;
|
||||
else
|
||||
{
|
||||
// note: create_multistore is called for 1.5.0.0 upgrade
|
||||
// so, __PS_BASE_URI__ should be always defined in settings.inc.php
|
||||
// @todo generate __PS_BASE_URI__ using $_SERVER['REQUEST_URI'], just in case
|
||||
return false;
|
||||
}
|
||||
$all_themes_dir = _PS_ROOT_DIR_.'/themes';
|
||||
$themes = scandir($all_themes_dir);
|
||||
foreach ($themes AS $theme)
|
||||
if (is_dir(dirname(__FILE__).'/../../themes/'.$theme) && $theme[0] != '.' && $theme != 'prestashop')
|
||||
$res &= Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'theme (`id_theme`, `name`) VALUES(\'\', \''.pSQL($theme).'\')');
|
||||
if (is_dir($all_themes_dir.'/'.$theme)
|
||||
&& $theme[0] != '.'
|
||||
&& $theme != 'prestashop')
|
||||
{
|
||||
$sql = 'INSERT INTO
|
||||
'._DB_PREFIX_.'theme (`id_theme`, name)
|
||||
VALUES("", "'.Db::getInstance()->escape($theme).'")';
|
||||
$res &= Db::getInstance()->execute($sql);
|
||||
}
|
||||
$res &= Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'shop
|
||||
SET
|
||||
name = (SELECT value
|
||||
FROM '._DB_PREFIX_.'configuration
|
||||
WHERE name = "PS_SHOP_NAME"
|
||||
),
|
||||
id_theme = (SELECT id_theme FROM '._DB_PREFIX_.'theme WHERE name=\''.pSQL(_THEME_NAME_).'\')
|
||||
id_theme = (SELECT id_theme FROM '._DB_PREFIX_.'theme WHERE name="'.Db::getInstance()->escape(_THEME_NAME_).'")
|
||||
WHERE id_shop = 1');
|
||||
$shop_domain = Db::getInstance()->getValue('SELECT `value`
|
||||
FROM `'._DB_PREFIX_.'_configuration`
|
||||
WHERE `name`=\'PS_SHOP_DOMAIN\'');
|
||||
WHERE `name`="PS_SHOP_DOMAIN"');
|
||||
$shop_domain_ssl = Db::getInstance()->getValue('SELECT `value`
|
||||
FROM `'._DB_PREFIX_.'_configuration`
|
||||
WHERE `name`=\'PS_SHOP_DOMAIN_SSL\'');
|
||||
WHERE `name`="PS_SHOP_DOMAIN_SSL"');
|
||||
if(empty($shop_domain))
|
||||
{
|
||||
$shop_domain = Tools::getHttpHost();
|
||||
$shop_domain_ssl = Tools::getHttpHost();
|
||||
$shop_domain = create_multistore_getHttpHost();
|
||||
$shop_domain_ssl = create_multistore_getHttpHost();
|
||||
}
|
||||
|
||||
$_PS_DIRECTORY_ = trim(str_replace(' ', '%20', INSTALLER__PS_BASE_URI), '/');
|
||||
$_PS_DIRECTORY_ = trim(str_replace(' ', '%20', $INSTALLER__PS_BASE_URI), '/');
|
||||
$_PS_DIRECTORY_ = ($_PS_DIRECTORY_) ? '/'.$_PS_DIRECTORY_.'/' : '/';
|
||||
$res &= Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'shop_url` (`id_shop`, `domain`, `domain_ssl`, `physical_uri`, `virtual_uri`, `main`, `active`)
|
||||
VALUES(1, \''.pSQL($shop_domain).'\', \''.pSQL($shop_domain_ssl).'\', \''.pSQL($_PS_DIRECTORY_).'\', \'\', 1, 1)');
|
||||
@@ -51,3 +69,9 @@ function create_multistore()
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
function create_multistore_getHttpHost()
|
||||
{
|
||||
$host = (isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST']);
|
||||
return $host;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user