first commit
This commit is contained in:
28
modules/psgdpr/upgrade/index.php
Normal file
28
modules/psgdpr/upgrade/index.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
37
modules/psgdpr/upgrade/install-1.1.0.php
Normal file
37
modules/psgdpr/upgrade/install-1.1.0.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function upgrade_module_1_1_0($object)
|
||||
{
|
||||
$result = true;
|
||||
|
||||
if (!$object->isRegisteredInHook('actionCustomerAccountAdd')) {
|
||||
$result &= $object->registerHook('actionCustomerAccountAdd');
|
||||
}
|
||||
|
||||
if ($object->isRegisteredInHook('validateCustomerFormFields')) {
|
||||
$result &= $object->unregisterHook('validateCustomerFormFields');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
40
modules/psgdpr/upgrade/install-1.1.1.php
Normal file
40
modules/psgdpr/upgrade/install-1.1.1.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function upgrade_module_1_1_1($object)
|
||||
{
|
||||
$gdprCustomer = Configuration::get('PSGDPR_ANONYMOUS_CUSTOMER');
|
||||
|
||||
$query = 'SELECT email FROM `' . _DB_PREFIX_ . 'customer` c WHERE id_customer = ' . (int) $gdprCustomer;
|
||||
$emailGdprCustomer = Db::getInstance()->getValue($query);
|
||||
|
||||
if (empty($emailGdprCustomer) || $emailGdprCustomer !== 'anonymous@anonymous.com') {
|
||||
return true;
|
||||
}
|
||||
|
||||
$query = 'UPDATE `' . _DB_PREFIX_ . 'customer`
|
||||
SET email = "anonymous@psgdpr.com"
|
||||
WHERE id_customer =' . (int) $gdprCustomer;
|
||||
|
||||
return (bool) Db::getInstance()->execute($query);
|
||||
}
|
||||
43
modules/psgdpr/upgrade/upgrade-1.1.4.php
Normal file
43
modules/psgdpr/upgrade/upgrade-1.1.4.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Psgdpr $module
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function upgrade_module_1_1_4($module)
|
||||
{
|
||||
$result = true;
|
||||
|
||||
// Remove our ModuleAdminControllers from SEO & URLs page
|
||||
$metaCollection = new PrestaShopCollection('Meta');
|
||||
$metaCollection->where('page', 'like', 'module-' . $module->name . '-Admin%');
|
||||
|
||||
foreach ($metaCollection->getAll() as $meta) {
|
||||
/** @var Meta $meta */
|
||||
$result = $result && (bool) $meta->delete();
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
42
modules/psgdpr/upgrade/upgrade-1.4.0.php
Normal file
42
modules/psgdpr/upgrade/upgrade-1.4.0.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Psgdpr $module
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function upgrade_module_1_4_0($module)
|
||||
{
|
||||
// Update database
|
||||
$sql = ' ALTER TABLE `' . _DB_PREFIX_ . 'psgdpr_log`
|
||||
ADD INDEX `idx_id_customer` ( `id_customer`, `id_guest`, `client_name`, `id_module`, `date_add`, `date_upd`); ';
|
||||
|
||||
if (Db::getInstance()->execute($sql) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remove hook
|
||||
return $module->unregisterHook('registerGDPRConsent')
|
||||
&& $module->unregisterHook('actionDeleteGDPRCustomer');
|
||||
}
|
||||
45
modules/psgdpr/upgrade/upgrade-1.4.2.php
Normal file
45
modules/psgdpr/upgrade/upgrade-1.4.2.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright since 2007 PrestaShop SA and Contributors
|
||||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
|
||||
* that is bundled with this package in the file LICENSE.md.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* 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.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright Since 2007 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
*/
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
use PrestaShop\PrestaShop\Adapter\ServiceLocator;
|
||||
use PrestaShop\PrestaShop\Core\Crypto\Hashing;
|
||||
|
||||
/**
|
||||
* @param Psgdpr $module
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function upgrade_module_1_4_2($module)
|
||||
{
|
||||
// Only change password when it's "prestashop"
|
||||
$customer = new Customer((int) Configuration::get('PSGDPR_ANONYMOUS_CUSTOMER'));
|
||||
// @phpstan-ignore-next-line
|
||||
if (Validate::isLoadedObject($customer) && $customer->passwd === 'prestashop') {
|
||||
/** @var Hashing $crypto */
|
||||
$crypto = ServiceLocator::get(Hashing::class);
|
||||
$customer->passwd = $crypto->hash(Tools::passwdGen(64)); // Generate a long random password
|
||||
$customer->save();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user