// Fixed upgrade to 1.6.0.1

This commit is contained in:
Damien Metzger
2013-12-02 15:28:02 +01:00
parent 0d7a48095c
commit c8ca67eef5
8 changed files with 62 additions and 65 deletions
+7 -7
View File
@@ -2101,14 +2101,14 @@ exit;
*/
public static function displayAsDeprecated($message = null)
{
$backtrace = debug_backtrace();
$callee = next($backtrace);
$class = isset($callee['class']) ? $callee['class'] : null;
if ($message === null)
$message = 'The function '.$callee['function'].' (Line '.$callee['line'].') is deprecated and will be removed in the next major version.';
$error = 'Function <b>'.$callee['function'].'()</b> is deprecated in <b>'.$callee['file'].'</b> on line <b>'.$callee['line'].'</b><br />';
$backtrace = debug_backtrace();
$callee = next($backtrace);
$class = isset($callee['class']) ? $callee['class'] : null;
if ($message === null)
$message = 'The function '.$callee['function'].' (Line '.$callee['line'].') is deprecated and will be removed in the next major version.';
$error = 'Function <b>'.$callee['function'].'()</b> is deprecated in <b>'.$callee['file'].'</b> on line <b>'.$callee['line'].'</b><br />';
Tools::throwDeprecated($error, $message, $class);
Tools::throwDeprecated($error, $message, $class);
}
/**
+19 -31
View File
@@ -44,39 +44,27 @@ function create_multistore()
$all_themes_dir = _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.'themes';
$themes = scandir($all_themes_dir);
foreach ($themes AS $theme)
if (is_dir($all_themes_dir.DIRECTORY_SEPARATOR.$theme.DIRECTORY_SEPARATOR)
&& $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="'.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"');
$shop_domain_ssl = Db::getInstance()->getValue('SELECT `value`
FROM `'._DB_PREFIX_.'configuration`
WHERE `name`="PS_SHOP_DOMAIN_SSL"');
if(empty($shop_domain))
{
$shop_domain = create_multistore_getHttpHost();
if (is_dir($all_themes_dir.DIRECTORY_SEPARATOR.$theme.DIRECTORY_SEPARATOR) && $theme[0] != '.' && $theme != 'prestashop')
$res &= Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'theme (`id_theme`, name) VALUES("", "'.Db::getInstance()->escape($theme).'")');
$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 = "'.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"');
$shop_domain_ssl = Db::getInstance()->getValue('SELECT `value` FROM `'._DB_PREFIX_.'configuration` WHERE `name` = "PS_SHOP_DOMAIN_SSL"');
if (empty($shop_domain))
$shop_domain = $shop_domain_ssl = create_multistore_getHttpHost();
if (empty($shop_domain_ssl))
$shop_domain_ssl = create_multistore_getHttpHost();
}
$_PS_DIRECTORY_ = trim(str_replace(' ', '%20', $INSTALLER__PS_BASE_URI), DIRECTORY_SEPARATOR);
$_PS_DIRECTORY_ = ($_PS_DIRECTORY_) ? '/'.$_PS_DIRECTORY_.DIRECTORY_SEPARATOR : DIRECTORY_SEPARATOR;
$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)');
$physical_uri = str_replace(' ', '%20', $INSTALLER__PS_BASE_URI);
$physical_uri = trim($physical_uri, '/\\');
$physical_uri = ($physical_uri ? '/'.$physical_uri.'/' : '/');
$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($physical_uri).'\', \'\', 1, 1)');
// Stock conversion
$sql = 'INSERT INTO `'._DB_PREFIX_.'stock` (`id_product`, `id_product_attribute`, `id_group_shop`, `id_shop`, `quantity`)
+8
View File
@@ -0,0 +1,8 @@
SET NAMES 'utf8';
INSERT INTO `PREFIX_hook_module` (`id_module`, `id_shop`, `id_hook`, `position`) (
SELECT m.id_module, s.id_shop, h.id_hook, 0
FROM `PREFIX_module` m, `PREFIX_shop` s, `PREFIX_hook` h
WHERE m.name IN ('dashgoals', 'dashactivity', 'dashtrends', 'dashproducts')
AND h.name IN ('displayBackOfficeHeader')
);
+15 -17
View File
@@ -50,21 +50,19 @@ class Dashactivity extends Module
Configuration::updateValue('DASHACTIVITY_CART_ABANDONED_MAX', 48);
Configuration::updateValue('DASHACTIVITY_VISITOR_ONLINE', 24);
if (!parent::install()
|| !$this->registerHook('dashboardZoneOne')
|| !$this->registerHook('dashboardData')
|| !$this->registerHook('actionObjectOrderAddAfter')
|| !$this->registerHook('actionObjectCustomerAddAfter')
|| !$this->registerHook('actionObjectCustomerMessageAddAfter')
|| !$this->registerHook('actionObjectCustomerThreadAddAfter')
|| !$this->registerHook('actionObjectOrderReturnAddAfter')
|| !$this->registerHook('displayBackOfficeHeader')
)
return false;
return true;
return (parent::install()
&& $this->registerHook('dashboardZoneOne')
&& $this->registerHook('dashboardData')
&& $this->registerHook('actionObjectOrderAddAfter')
&& $this->registerHook('actionObjectCustomerAddAfter')
&& $this->registerHook('actionObjectCustomerMessageAddAfter')
&& $this->registerHook('actionObjectCustomerThreadAddAfter')
&& $this->registerHook('actionObjectOrderReturnAddAfter')
&& $this->registerHook('actionAdminControllerSetMedia')
);
}
public function hookDisplayBackOfficeHeader()
public function hookActionAdminControllerSetMedia()
{
if (get_class($this->context->controller) == 'AdminDashboardController')
{
@@ -78,20 +76,20 @@ class Dashactivity extends Module
public function hookDashboardZoneOne($params)
{
$gapi_mode = 'configure';
if (!Module::isInstalled('gapi'))
$gapi_mode = 'install';
elseif (($gapi = Module::getInstanceByName('gapi')) && Validate::isLoadedObject($gapi) && $gapi->isConfigured())
$gapi_mode = false;
else
$gapi_mode = 'configure';
$this->context->smarty->assign(array_merge(array(
$this->context->smarty->assign($this->getConfigFieldsValues());
$this->context->smarty->assign(array(
'gapi_mode' => $gapi_mode,
'dashactivity_config_form' => $this->renderConfigForm(),
'date_subtitle' => $this->l('(from %s to %s)'),
'date_format' => $this->context->language->date_format_lite,
'link' => $this->context->link,
), $this->getConfigFieldsValues()));
));
return $this->display(__FILE__, 'dashboard_zone_one.tpl');
}
+2 -2
View File
@@ -89,7 +89,7 @@ class Dashgoals extends Module
&& parent::install()
&& $this->registerHook('dashboardZoneTwo')
&& $this->registerHook('dashboardData')
&& $this->registerHook('displayBackOfficeHeader')
&& $this->registerHook('actionAdminControllerSetMedia')
);
}
@@ -104,7 +104,7 @@ class Dashgoals extends Module
return parent::uninstall();
}
public function hookDisplayBackOfficeHeader()
public function hookActionAdminControllerSetMedia()
{
if (get_class($this->context->controller) == 'AdminDashboardController')
$this->context->controller->addJs($this->_path.'views/js/'.$this->name.'.js');
+4 -3
View File
@@ -47,9 +47,10 @@ class Dashproducts extends Module
Configuration::updateValue('DASHPRODUCT_NBR_SHOW_MOST_VIEWED', 10);
Configuration::updateValue('DASHPRODUCT_NBR_SHOW_TOP_SEARCH', 10);
if (!parent::install() || !$this->registerHook('dashboardZoneTwo') || !$this->registerHook('dashboardData'))
return false;
return true;
return (parent::install()
&& $this->registerHook('dashboardZoneTwo')
&& $this->registerHook('dashboardData')
);
}
public function hookDashboardZoneTwo($params)
+6 -4
View File
@@ -48,12 +48,14 @@ class Dashtrends extends Module
public function install()
{
if (!parent::install() || !$this->registerHook('dashboardZoneTwo') || !$this->registerHook('dashboardData') || !$this->registerHook('displayBackOfficeHeader'))
return false;
return true;
return (parent::install()
&& $this->registerHook('dashboardZoneTwo')
&& $this->registerHook('dashboardData')
&& $this->registerHook('actionAdminControllerSetMedia')
);
}
public function hookDisplayBackOfficeHeader()
public function hookActionAdminControllerSetMedia()
{
if (get_class($this->context->controller) == 'AdminDashboardController')
$this->context->controller->addJs($this->_path.'views/js/'.$this->name.'.js');
+1 -1
View File
@@ -125,7 +125,7 @@ class HomeFeatured extends Module
/* Retro Compatibility < 1.6.0.1 */
public function hookDisplayHome($params)
{
return $this->hookDisplayHomeTabContent();
return $this->hookDisplayHomeTabContent($params);
}
public function hookAddProduct($params)