85 lines
3.2 KiB
PHP
85 lines
3.2 KiB
PHP
<?php
|
|
/*
|
|
* 2007-2018 PrestaShop
|
|
*
|
|
* NOTICE OF LICENSE
|
|
*
|
|
* This source file is subject to the Academic Free License (AFL 3.0)
|
|
* that is bundled with this package in the file LICENSE.txt.
|
|
* It is also available through the world-wide-web at this URL:
|
|
* http://opensource.org/licenses/afl-3.0.php
|
|
* If you did not receive a copy of the license and are unable to
|
|
* obtain it through the world-wide-web, please send an email
|
|
* to license@prestashop.com so we can send you a copy immediately.
|
|
*
|
|
* DISCLAIMER
|
|
*
|
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
|
* versions in the future. If you wish to customize PrestaShop for your
|
|
* needs please refer to http://www.prestashop.com for more information.
|
|
*
|
|
* @author Sarbacane Software <contact@sarbacane.com>
|
|
* @copyright 2018 Sarbacane Software
|
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
|
*/
|
|
|
|
if ( ! defined('_PS_VERSION_')) {
|
|
exit;
|
|
}
|
|
|
|
function upgrade_module_1_0_9($object)
|
|
{
|
|
try {
|
|
$object->unregisterHook('actionObjectCustomerUpdateAfter');
|
|
} catch (Exception $e) {
|
|
}
|
|
try {
|
|
Db::getInstance()->execute('DROP TRIGGER IF EXISTS `sd_userupdate`');
|
|
} catch (Exception $e) {
|
|
}
|
|
Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'sarbacanedesktop`');
|
|
Db::getInstance()->execute('DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'sarbacanedesktop_users`');
|
|
$result1 = Db::getInstance()->execute('DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'sd_users`');
|
|
$result2 = Db::getInstance()->execute('DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'sd_updates`');
|
|
$result3 = Db::getInstance()->execute('
|
|
CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'sd_users` (
|
|
`sd_id` varchar(200) NOT NULL,
|
|
`list_id` varchar(50) NOT NULL,
|
|
`newsletter_module_status` varchar(30) NOT NULL,
|
|
`last_call_date` datetime NOT NULL,
|
|
PRIMARY KEY (`sd_id`, `list_id`)
|
|
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8');
|
|
$result4 = Db::getInstance()->execute('
|
|
CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'sd_updates` (
|
|
`email` varchar(255) NOT NULL,
|
|
`id_shop` int(11) unsigned NOT NULL,
|
|
`id_shop_group` int(11) unsigned NOT NULL,
|
|
`list_type` varchar(10) NOT NULL,
|
|
`action` varchar(5) NOT NULL,
|
|
`update_date` datetime NOT NULL,
|
|
PRIMARY KEY (`email`, `list_type`, `id_shop`, `id_shop_group`)
|
|
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8');
|
|
$result5 = Configuration::updateGlobalValue('SARBACANEDESKTOP_LAST_UPDATE', '');
|
|
$result6 = Configuration::updateGlobalValue('SARBACANEDESKTOP_FAILED', '');
|
|
if ( ! $result1 || ! $result2 || ! $result3 || ! $result4 || ! $result5 || ! $result6) {
|
|
return false;
|
|
}
|
|
$result = $object->registerHook('actionObjectCustomerUpdateBefore');
|
|
if ( ! $result) {
|
|
return false;
|
|
}
|
|
$result = $object->registerHook('actionObjectCustomerDeleteBefore');
|
|
if ( ! $result) {
|
|
return false;
|
|
}
|
|
$result = $object->registerHook('displayHeader');
|
|
if ( ! $result) {
|
|
return false;
|
|
}
|
|
$result = $object->registerHook('displayBackOfficeHeader');
|
|
if ( ! $result) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|