// Fixed upgrade to 1.6.0.1

This commit is contained in:
Damien Metzger committed 2013-12-02 15:28:02 +01:00
1 parent 0d7a48095c
commit c8ca67eef5
8 files changed
+62 -65

No files matched your search

+7 -7
View File
@@ -2101,14 +2101,14 @@ exit;
*/ */
public static function displayAsDeprecated($message = null) public static function displayAsDeprecated($message = null)
{ {
$backtrace = debug_backtrace(); $backtrace = debug_backtrace();
$callee = next($backtrace); $callee = next($backtrace);
$class = isset($callee['class']) ? $callee['class'] : null; $class = isset($callee['class']) ? $callee['class'] : null;
if ($message === null) if ($message === null)
$message = 'The function '.$callee['function'].' (Line '.$callee['line'].') is deprecated and will be removed in the next major version.'; $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 />'; $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'; $all_themes_dir = _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.'themes';
$themes = scandir($all_themes_dir); $themes = scandir($all_themes_dir);
foreach ($themes AS $theme) foreach ($themes AS $theme)
if (is_dir($all_themes_dir.DIRECTORY_SEPARATOR.$theme.DIRECTORY_SEPARATOR) if (is_dir($all_themes_dir.DIRECTORY_SEPARATOR.$theme.DIRECTORY_SEPARATOR) && $theme[0] != '.' && $theme != 'prestashop')
&& $theme[0] != '.' $res &= Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'theme (`id_theme`, name) VALUES("", "'.Db::getInstance()->escape($theme).'")');
&& $theme != 'prestashop') $res &= Db::getInstance()->execute('
{ UPDATE '._DB_PREFIX_.'shop
$sql = 'INSERT INTO SET
'._DB_PREFIX_.'theme (`id_theme`, name) name = (SELECT value FROM '._DB_PREFIX_.'configuration WHERE name = "PS_SHOP_NAME"),
VALUES("", "'.Db::getInstance()->escape($theme).'")'; id_theme = (SELECT id_theme FROM '._DB_PREFIX_.'theme WHERE name = "'.Db::getInstance()->escape(_THEME_NAME_).'")
$res &= Db::getInstance()->execute($sql); WHERE id_shop = 1');
} $shop_domain = Db::getInstance()->getValue('SELECT `value` FROM `'._DB_PREFIX_.'configuration` WHERE `name` = "PS_SHOP_DOMAIN"');
$res &= Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'shop $shop_domain_ssl = Db::getInstance()->getValue('SELECT `value` FROM `'._DB_PREFIX_.'configuration` WHERE `name` = "PS_SHOP_DOMAIN_SSL"');
SET if (empty($shop_domain))
name = (SELECT value $shop_domain = $shop_domain_ssl = create_multistore_getHttpHost();
FROM '._DB_PREFIX_.'configuration if (empty($shop_domain_ssl))
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();
$shop_domain_ssl = create_multistore_getHttpHost(); $shop_domain_ssl = create_multistore_getHttpHost();
}
$_PS_DIRECTORY_ = trim(str_replace(' ', '%20', $INSTALLER__PS_BASE_URI), DIRECTORY_SEPARATOR); $physical_uri = str_replace(' ', '%20', $INSTALLER__PS_BASE_URI);
$_PS_DIRECTORY_ = ($_PS_DIRECTORY_) ? '/'.$_PS_DIRECTORY_.DIRECTORY_SEPARATOR : DIRECTORY_SEPARATOR; $physical_uri = trim($physical_uri, '/\\');
$res &= Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'shop_url` (`id_shop`, `domain`, `domain_ssl`, `physical_uri`, `virtual_uri`, `main`, `active`) $physical_uri = ($physical_uri ? '/'.$physical_uri.'/' : '/');
VALUES(1, \''.pSQL($shop_domain).'\', \''.pSQL($shop_domain_ssl).'\', \''.pSQL($_PS_DIRECTORY_).'\', \'\', 1, 1)'); $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 // Stock conversion
$sql = 'INSERT INTO `'._DB_PREFIX_.'stock` (`id_product`, `id_product_attribute`, `id_group_shop`, `id_shop`, `quantity`) $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_CART_ABANDONED_MAX', 48);
Configuration::updateValue('DASHACTIVITY_VISITOR_ONLINE', 24); Configuration::updateValue('DASHACTIVITY_VISITOR_ONLINE', 24);
if (!parent::install() return (parent::install()
|| !$this->registerHook('dashboardZoneOne') && $this->registerHook('dashboardZoneOne')
|| !$this->registerHook('dashboardData') && $this->registerHook('dashboardData')
|| !$this->registerHook('actionObjectOrderAddAfter') && $this->registerHook('actionObjectOrderAddAfter')
|| !$this->registerHook('actionObjectCustomerAddAfter') && $this->registerHook('actionObjectCustomerAddAfter')
|| !$this->registerHook('actionObjectCustomerMessageAddAfter') && $this->registerHook('actionObjectCustomerMessageAddAfter')
|| !$this->registerHook('actionObjectCustomerThreadAddAfter') && $this->registerHook('actionObjectCustomerThreadAddAfter')
|| !$this->registerHook('actionObjectOrderReturnAddAfter') && $this->registerHook('actionObjectOrderReturnAddAfter')
|| !$this->registerHook('displayBackOfficeHeader') && $this->registerHook('actionAdminControllerSetMedia')
) );
return false;
return true;
} }
public function hookDisplayBackOfficeHeader() public function hookActionAdminControllerSetMedia()
{ {
if (get_class($this->context->controller) == 'AdminDashboardController') if (get_class($this->context->controller) == 'AdminDashboardController')
{ {
@@ -78,20 +76,20 @@ class Dashactivity extends Module
public function hookDashboardZoneOne($params) public function hookDashboardZoneOne($params)
{ {
$gapi_mode = 'configure';
if (!Module::isInstalled('gapi')) if (!Module::isInstalled('gapi'))
$gapi_mode = 'install'; $gapi_mode = 'install';
elseif (($gapi = Module::getInstanceByName('gapi')) && Validate::isLoadedObject($gapi) && $gapi->isConfigured()) elseif (($gapi = Module::getInstanceByName('gapi')) && Validate::isLoadedObject($gapi) && $gapi->isConfigured())
$gapi_mode = false; $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, 'gapi_mode' => $gapi_mode,
'dashactivity_config_form' => $this->renderConfigForm(), 'dashactivity_config_form' => $this->renderConfigForm(),
'date_subtitle' => $this->l('(from %s to %s)'), 'date_subtitle' => $this->l('(from %s to %s)'),
'date_format' => $this->context->language->date_format_lite, 'date_format' => $this->context->language->date_format_lite,
'link' => $this->context->link, 'link' => $this->context->link,
), $this->getConfigFieldsValues())); ));
return $this->display(__FILE__, 'dashboard_zone_one.tpl'); return $this->display(__FILE__, 'dashboard_zone_one.tpl');
} }
+2 -2
View File
@@ -89,7 +89,7 @@ class Dashgoals extends Module
&& parent::install() && parent::install()
&& $this->registerHook('dashboardZoneTwo') && $this->registerHook('dashboardZoneTwo')
&& $this->registerHook('dashboardData') && $this->registerHook('dashboardData')
&& $this->registerHook('displayBackOfficeHeader') && $this->registerHook('actionAdminControllerSetMedia')
); );
} }
@@ -104,7 +104,7 @@ class Dashgoals extends Module
return parent::uninstall(); return parent::uninstall();
} }
public function hookDisplayBackOfficeHeader() public function hookActionAdminControllerSetMedia()
{ {
if (get_class($this->context->controller) == 'AdminDashboardController') if (get_class($this->context->controller) == 'AdminDashboardController')
$this->context->controller->addJs($this->_path.'views/js/'.$this->name.'.js'); $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_MOST_VIEWED', 10);
Configuration::updateValue('DASHPRODUCT_NBR_SHOW_TOP_SEARCH', 10); Configuration::updateValue('DASHPRODUCT_NBR_SHOW_TOP_SEARCH', 10);
if (!parent::install() || !$this->registerHook('dashboardZoneTwo') || !$this->registerHook('dashboardData')) return (parent::install()
return false; && $this->registerHook('dashboardZoneTwo')
return true; && $this->registerHook('dashboardData')
);
} }
public function hookDashboardZoneTwo($params) public function hookDashboardZoneTwo($params)
+6 -4
View File
@@ -48,12 +48,14 @@ class Dashtrends extends Module
public function install() public function install()
{ {
if (!parent::install() || !$this->registerHook('dashboardZoneTwo') || !$this->registerHook('dashboardData') || !$this->registerHook('displayBackOfficeHeader')) return (parent::install()
return false; && $this->registerHook('dashboardZoneTwo')
return true; && $this->registerHook('dashboardData')
&& $this->registerHook('actionAdminControllerSetMedia')
);
} }
public function hookDisplayBackOfficeHeader() public function hookActionAdminControllerSetMedia()
{ {
if (get_class($this->context->controller) == 'AdminDashboardController') if (get_class($this->context->controller) == 'AdminDashboardController')
$this->context->controller->addJs($this->_path.'views/js/'.$this->name.'.js'); $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 */ /* Retro Compatibility < 1.6.0.1 */
public function hookDisplayHome($params) public function hookDisplayHome($params)
{ {
return $this->hookDisplayHomeTabContent(); return $this->hookDisplayHomeTabContent($params);
} }
public function hookAddProduct($params) public function hookAddProduct($params)