Compare commits

...
2 Commits
Author SHA1 Message Date
isabelle e97af7a1da fix(mian): Add silence files; add casting
Everything now casts right at the SQL interpolation point
2026-09-10 11:46:36 +02:00
isabelle 150e068550 feat(main): Remove dead code 2026-09-10 09:43:00 +02:00
56 changed files with 258 additions and 875 deletions
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
@@ -45,7 +45,7 @@ final class CustomHtmlGroupChoiceProvider implements
'SELECT g.`id_ws_customhtml_group`, gl.`title`, g.`default_block_class` 'SELECT g.`id_ws_customhtml_group`, gl.`title`, g.`default_block_class`
FROM `' . _DB_PREFIX_ . 'ws_customhtml_group` g FROM `' . _DB_PREFIX_ . 'ws_customhtml_group` g
LEFT JOIN `' . _DB_PREFIX_ . 'ws_customhtml_group_lang` gl LEFT JOIN `' . _DB_PREFIX_ . 'ws_customhtml_group_lang` gl
ON gl.`id_ws_customhtml_group` = g.`id_ws_customhtml_group` AND gl.`id_lang` = ' . $idLang . ' ON gl.`id_ws_customhtml_group` = g.`id_ws_customhtml_group` AND gl.`id_lang` = ' . (int) $idLang . '
ORDER BY gl.`title` ASC' ORDER BY gl.`title` ASC'
); );
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
@@ -135,7 +135,7 @@ final class CustomHtmlBlockDataHandler implements FormDataHandlerInterface
{ {
$maxOrdering = Db::getInstance()->getValue( $maxOrdering = Db::getInstance()->getValue(
'SELECT MAX(`ordering`) FROM `' . _DB_PREFIX_ . 'ws_customhtml` 'SELECT MAX(`ordering`) FROM `' . _DB_PREFIX_ . 'ws_customhtml`
WHERE `id_ws_customhtml_group` = ' . $idGroup WHERE `id_ws_customhtml_group` = ' . (int) $idGroup
); );
return $maxOrdering === false || $maxOrdering === null ? 0 : ((int) $maxOrdering + 1); return $maxOrdering === false || $maxOrdering === null ? 0 : ((int) $maxOrdering + 1);
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
@@ -1,10 +0,0 @@
{if !empty($block.link)}<a href="{$block.link|escape:'html':'UTF-8'}">{/if}
<p class="h1 usp__name text-center">
<span>{$block.title|escape:'html':'UTF-8'}</span>
</p>
{if !empty($block.description)}
<p class="usp__description text-center">
{$block.description|escape:'html':'UTF-8'|nl2br}
</p>
{/if}
{if !empty($block.link)}</a>{/if}
-11
View File
@@ -1,11 +0,0 @@
{if !empty($block.link)}<a href="{$block.link|escape:'html':'UTF-8'}">{/if}
<small class="uppercase-mono-red">/{$iteration|string_format:"%02d"}</small>
<p class="h3 font-default usp__name mt2 mt-lg-3">
<span>{$block.title|escape:'html':'UTF-8'}</span>
</p>
{if !empty($block.description)}
<p class="usp__description">
{$block.description|escape:'html':'UTF-8'|nl2br}
</p>
{/if}
{if !empty($block.link)}</a>{/if}
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
-31
View File
@@ -1,31 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_10_0($module)
{
$columnsToAdd = [
'alert_type' => 'VARCHAR(16) NOT NULL DEFAULT \'info\'',
'timeout' => 'INT(11) NOT NULL DEFAULT 0',
];
foreach ($columnsToAdd as $column => $definition) {
$existing = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'' . $column . '\''
);
if (!empty($existing)) {
continue;
}
if (!Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml` ADD COLUMN `' . $column . '` ' . $definition
)) {
return false;
}
}
return true;
}
-24
View File
@@ -1,24 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_11_0($module)
{
$groups = Db::getInstance()->executeS(
'SELECT `id_ws_customhtml_group` FROM `' . _DB_PREFIX_ . 'ws_customhtml_group` ORDER BY `id_ws_customhtml_group` ASC'
);
foreach ($groups as $index => $group) {
if (!Db::getInstance()->update(
'ws_customhtml_group',
['ordering' => (int) $index],
'`id_ws_customhtml_group` = ' . (int) $group['id_ws_customhtml_group']
)) {
return false;
}
}
return true;
}
-21
View File
@@ -1,21 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_13_0($module)
{
$existing = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml_group` LIKE \'custom_class\''
);
if (!empty($existing)) {
return true;
}
return Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml_group`
ADD COLUMN `custom_class` VARCHAR(128) NOT NULL DEFAULT \'\' AFTER `title`'
);
}
-21
View File
@@ -1,21 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_15_0($module)
{
$existing = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'link_text\''
);
if (!empty($existing)) {
return true;
}
return Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml`
ADD COLUMN `link_text` VARCHAR(128) NOT NULL DEFAULT \'\' AFTER `link`'
);
}
-48
View File
@@ -1,48 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_16_0($module)
{
$columnsToAdd = [
'slides_per_view_mobile' => 'DECIMAL(4,2) NOT NULL DEFAULT 1',
'slides_per_view_tablet' => 'DECIMAL(4,2) NOT NULL DEFAULT 2',
'slides_per_view_desktop' => 'DECIMAL(4,2) NOT NULL DEFAULT 3',
'autoplay_delay' => 'INT(11) NOT NULL DEFAULT 0',
];
foreach ($columnsToAdd as $column => $definition) {
$existing = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'' . $column . '\''
);
if (!empty($existing)) {
continue;
}
if (!Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml` ADD COLUMN `' . $column . '` ' . $definition
)) {
return false;
}
}
return Db::getInstance()->execute(
'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'ws_customhtml_slide` (
`id_ws_customhtml_slide` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`id_ws_customhtml` INT(11) NOT NULL,
`title` VARCHAR(256) NOT NULL DEFAULT \'\',
`description` TEXT,
`extra_description` TEXT,
`link` VARCHAR(512) NOT NULL DEFAULT \'\',
`link_text` VARCHAR(128) NOT NULL DEFAULT \'\',
`image` VARCHAR(255) NOT NULL DEFAULT \'\',
`ordering` INT(11) NOT NULL DEFAULT 0,
`date_add` DATETIME NOT NULL,
`date_upd` DATETIME NOT NULL,
KEY `id_ws_customhtml` (`id_ws_customhtml`)
)'
);
}
-21
View File
@@ -1,21 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_17_0($module)
{
$existing = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'slider_mode\''
);
if (!empty($existing)) {
return true;
}
return Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml`
ADD COLUMN `slider_mode` VARCHAR(16) NOT NULL DEFAULT \'always\' AFTER `timeout`'
);
}
-21
View File
@@ -1,21 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_19_0($module)
{
$existing = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml_group` LIKE \'default_block_class\''
);
if (!empty($existing)) {
return true;
}
return Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml_group`
ADD COLUMN `default_block_class` VARCHAR(128) NOT NULL DEFAULT \'\' AFTER `custom_class`'
);
}
-38
View File
@@ -1,38 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_2_0($module)
{
$columns = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'type\''
);
if (empty($columns)) {
if (!Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml`
ADD COLUMN `type` VARCHAR(32) NOT NULL DEFAULT \'html\' AFTER `title`'
)) {
return false;
}
}
if (!Db::getInstance()->execute(
'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'ws_customhtml_faq` (
`id_ws_customhtml_faq` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`id_ws_customhtml` INT(11) NOT NULL,
`question` VARCHAR(512) NOT NULL DEFAULT \'\',
`answer` TEXT,
`ordering` INT(11) NOT NULL DEFAULT 0,
`date_add` DATETIME NOT NULL,
`date_upd` DATETIME NOT NULL,
KEY `id_ws_customhtml` (`id_ws_customhtml`)
)'
)) {
return false;
}
return $module->registerHook('actionCustomhtmlblockGridDataModifier');
}
-88
View File
@@ -1,88 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_20_0($module)
{
if (!createGroupLangTable()) {
return false;
}
if (!migrateGroupTitlesToLangTable()) {
return false;
}
return dropGroupTitleColumn();
}
function createGroupLangTable(): bool
{
return Db::getInstance()->execute(
'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'ws_customhtml_group_lang` (
`id_ws_customhtml_group` INT(11) NOT NULL,
`id_lang` INT(11) NOT NULL,
`title` VARCHAR(256) NOT NULL DEFAULT \'\',
PRIMARY KEY (`id_ws_customhtml_group`, `id_lang`)
);'
);
}
function migrateGroupTitlesToLangTable(): bool
{
$groupColumns = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml_group` LIKE \'title\''
);
if (empty($groupColumns)) {
// Already migrated in a previous run of this upgrade.
return true;
}
$groups = Db::getInstance()->executeS(
'SELECT `id_ws_customhtml_group`, `title` FROM `' . _DB_PREFIX_ . 'ws_customhtml_group`'
);
$languages = Language::getLanguages(false);
foreach ($groups as $group) {
foreach ($languages as $language) {
$existing = Db::getInstance()->executeS(
'SELECT 1 FROM `' . _DB_PREFIX_ . 'ws_customhtml_group_lang`
WHERE `id_ws_customhtml_group` = ' . (int) $group['id_ws_customhtml_group'] . '
AND `id_lang` = ' . (int) $language['id_lang']
);
if (!empty($existing)) {
continue;
}
$result = Db::getInstance()->insert('ws_customhtml_group_lang', [
'id_ws_customhtml_group' => (int) $group['id_ws_customhtml_group'],
'id_lang' => (int) $language['id_lang'],
'title' => pSQL($group['title']),
]);
if (!$result) {
return false;
}
}
}
return true;
}
function dropGroupTitleColumn(): bool
{
$groupColumns = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml_group` LIKE \'title\''
);
if (empty($groupColumns)) {
return true;
}
return Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml_group` DROP COLUMN `title`'
);
}
-102
View File
@@ -1,102 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_21_0($module)
{
if (!createBlockLangTable()) {
return false;
}
if (!migrateBlockFieldsToLangTable()) {
return false;
}
return dropBlockLangColumns();
}
function createBlockLangTable(): bool
{
return Db::getInstance()->execute(
'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'ws_customhtml_lang` (
`id_ws_customhtml` INT(11) NOT NULL,
`id_lang` INT(11) NOT NULL,
`title` VARCHAR(256) NOT NULL DEFAULT \'\',
`content` LONGTEXT,
`description` TEXT,
`extra_description` TEXT,
`link_text` VARCHAR(128) NOT NULL DEFAULT \'\',
PRIMARY KEY (`id_ws_customhtml`, `id_lang`)
);'
);
}
function migrateBlockFieldsToLangTable(): bool
{
$columns = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'title\''
);
if (empty($columns)) {
// Already migrated in a previous run of this upgrade.
return true;
}
$blocks = Db::getInstance()->executeS(
'SELECT `id_ws_customhtml`, `title`, `content`, `description`, `extra_description`, `link_text`
FROM `' . _DB_PREFIX_ . 'ws_customhtml`'
);
$languages = Language::getLanguages(false);
foreach ($blocks as $block) {
foreach ($languages as $language) {
$existing = Db::getInstance()->executeS(
'SELECT 1 FROM `' . _DB_PREFIX_ . 'ws_customhtml_lang`
WHERE `id_ws_customhtml` = ' . (int) $block['id_ws_customhtml'] . '
AND `id_lang` = ' . (int) $language['id_lang']
);
if (!empty($existing)) {
continue;
}
$result = Db::getInstance()->insert('ws_customhtml_lang', [
'id_ws_customhtml' => (int) $block['id_ws_customhtml'],
'id_lang' => (int) $language['id_lang'],
'title' => pSQL($block['title']),
'content' => pSQL($block['content'], true),
'description' => pSQL($block['description']),
'extra_description' => pSQL($block['extra_description']),
'link_text' => pSQL($block['link_text']),
]);
if (!$result) {
return false;
}
}
}
return true;
}
function dropBlockLangColumns(): bool
{
$columns = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'title\''
);
if (empty($columns)) {
return true;
}
return Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml`
DROP COLUMN `title`,
DROP COLUMN `content`,
DROP COLUMN `description`,
DROP COLUMN `extra_description`,
DROP COLUMN `link_text`'
);
}
-79
View File
@@ -1,79 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_22_0($module)
{
if (!addLinkColumnToLangTable()) {
return false;
}
if (!migrateBlockLinkToLangTable()) {
return false;
}
return dropBlockLinkColumn();
}
function addLinkColumnToLangTable(): bool
{
$existing = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml_lang` LIKE \'link\''
);
if (!empty($existing)) {
return true;
}
return Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml_lang`
ADD COLUMN `link` VARCHAR(512) NOT NULL DEFAULT \'\' AFTER `extra_description`'
);
}
function migrateBlockLinkToLangTable(): bool
{
$columns = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'link\''
);
if (empty($columns)) {
// Already migrated in a previous run of this upgrade.
return true;
}
$blocks = Db::getInstance()->executeS(
'SELECT `id_ws_customhtml`, `link` FROM `' . _DB_PREFIX_ . 'ws_customhtml`'
);
foreach ($blocks as $block) {
$result = Db::getInstance()->update(
'ws_customhtml_lang',
['link' => pSQL($block['link'])],
'`id_ws_customhtml` = ' . (int) $block['id_ws_customhtml']
);
if (!$result) {
return false;
}
}
return true;
}
function dropBlockLinkColumn(): bool
{
$columns = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'link\''
);
if (empty($columns)) {
return true;
}
return Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml` DROP COLUMN `link`'
);
}
-102
View File
@@ -1,102 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_23_0($module)
{
if (!createSlideLangTable()) {
return false;
}
if (!migrateSlideFieldsToLangTable()) {
return false;
}
return dropSlideLangColumns();
}
function createSlideLangTable(): bool
{
return Db::getInstance()->execute(
'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'ws_customhtml_slide_lang` (
`id_ws_customhtml_slide` INT(11) NOT NULL,
`id_lang` INT(11) NOT NULL,
`title` VARCHAR(256) NOT NULL DEFAULT \'\',
`description` TEXT,
`extra_description` TEXT,
`link` VARCHAR(512) NOT NULL DEFAULT \'\',
`link_text` VARCHAR(128) NOT NULL DEFAULT \'\',
PRIMARY KEY (`id_ws_customhtml_slide`, `id_lang`)
);'
);
}
function migrateSlideFieldsToLangTable(): bool
{
$columns = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml_slide` LIKE \'title\''
);
if (empty($columns)) {
// Already migrated in a previous run of this upgrade.
return true;
}
$slides = Db::getInstance()->executeS(
'SELECT `id_ws_customhtml_slide`, `title`, `description`, `extra_description`, `link`, `link_text`
FROM `' . _DB_PREFIX_ . 'ws_customhtml_slide`'
);
$languages = Language::getLanguages(false);
foreach ($slides as $slide) {
foreach ($languages as $language) {
$existing = Db::getInstance()->executeS(
'SELECT 1 FROM `' . _DB_PREFIX_ . 'ws_customhtml_slide_lang`
WHERE `id_ws_customhtml_slide` = ' . (int) $slide['id_ws_customhtml_slide'] . '
AND `id_lang` = ' . (int) $language['id_lang']
);
if (!empty($existing)) {
continue;
}
$result = Db::getInstance()->insert('ws_customhtml_slide_lang', [
'id_ws_customhtml_slide' => (int) $slide['id_ws_customhtml_slide'],
'id_lang' => (int) $language['id_lang'],
'title' => pSQL($slide['title']),
'description' => pSQL($slide['description']),
'extra_description' => pSQL($slide['extra_description']),
'link' => pSQL($slide['link']),
'link_text' => pSQL($slide['link_text']),
]);
if (!$result) {
return false;
}
}
}
return true;
}
function dropSlideLangColumns(): bool
{
$columns = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml_slide` LIKE \'title\''
);
if (empty($columns)) {
return true;
}
return Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml_slide`
DROP COLUMN `title`,
DROP COLUMN `description`,
DROP COLUMN `extra_description`,
DROP COLUMN `link`,
DROP COLUMN `link_text`'
);
}
-93
View File
@@ -1,93 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_24_0($module)
{
if (!createFaqLangTable()) {
return false;
}
if (!migrateFaqFieldsToLangTable()) {
return false;
}
return dropFaqLangColumns();
}
function createFaqLangTable(): bool
{
return Db::getInstance()->execute(
'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'ws_customhtml_faq_lang` (
`id_ws_customhtml_faq` INT(11) NOT NULL,
`id_lang` INT(11) NOT NULL,
`question` VARCHAR(512) NOT NULL DEFAULT \'\',
`answer` TEXT,
PRIMARY KEY (`id_ws_customhtml_faq`, `id_lang`)
);'
);
}
function migrateFaqFieldsToLangTable(): bool
{
$columns = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml_faq` LIKE \'question\''
);
if (empty($columns)) {
// Already migrated in a previous run of this upgrade.
return true;
}
$faqs = Db::getInstance()->executeS(
'SELECT `id_ws_customhtml_faq`, `question`, `answer`
FROM `' . _DB_PREFIX_ . 'ws_customhtml_faq`'
);
$languages = Language::getLanguages(false);
foreach ($faqs as $faq) {
foreach ($languages as $language) {
$existing = Db::getInstance()->executeS(
'SELECT 1 FROM `' . _DB_PREFIX_ . 'ws_customhtml_faq_lang`
WHERE `id_ws_customhtml_faq` = ' . (int) $faq['id_ws_customhtml_faq'] . '
AND `id_lang` = ' . (int) $language['id_lang']
);
if (!empty($existing)) {
continue;
}
$result = Db::getInstance()->insert('ws_customhtml_faq_lang', [
'id_ws_customhtml_faq' => (int) $faq['id_ws_customhtml_faq'],
'id_lang' => (int) $language['id_lang'],
'question' => pSQL($faq['question']),
'answer' => pSQL($faq['answer'], true),
]);
if (!$result) {
return false;
}
}
}
return true;
}
function dropFaqLangColumns(): bool
{
$columns = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml_faq` LIKE \'question\''
);
if (empty($columns)) {
return true;
}
return Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml_faq`
DROP COLUMN `question`,
DROP COLUMN `answer`'
);
}
-23
View File
@@ -1,23 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_3_0($module)
{
$columns = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'column_class\''
);
if (empty($columns)) {
if (!Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml`
ADD COLUMN `column_class` VARCHAR(128) NOT NULL DEFAULT \'col-12\' AFTER `content`'
)) {
return false;
}
}
return true;
}
-14
View File
@@ -1,14 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_4_0($module)
{
if (!Hook::isModuleRegisteredOnHook($module, 'actionFrontControllerSetMedia', (int) Context::getContext()->shop->id)) {
return $module->registerHook('actionFrontControllerSetMedia');
}
return true;
}
-32
View File
@@ -1,32 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_5_0($module)
{
$newColumn = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'custom_class\''
);
if (!empty($newColumn)) {
return true;
}
$oldColumn = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'column_class\''
);
if (!empty($oldColumn)) {
return Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml`
CHANGE `column_class` `custom_class` VARCHAR(128) NOT NULL DEFAULT \'\''
);
}
return Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml`
ADD COLUMN `custom_class` VARCHAR(128) NOT NULL DEFAULT \'\' AFTER `content`'
);
}
-34
View File
@@ -1,34 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_6_0($module)
{
$columnsToAdd = [
'description' => 'TEXT',
'extra_description' => 'TEXT',
'link' => 'VARCHAR(512) NOT NULL DEFAULT \'\'',
'template' => 'VARCHAR(32) NOT NULL DEFAULT \'image_left\'',
'image' => 'VARCHAR(255) NOT NULL DEFAULT \'\'',
];
foreach ($columnsToAdd as $column => $definition) {
$existing = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'' . $column . '\''
);
if (!empty($existing)) {
continue;
}
if (!Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml` ADD COLUMN `' . $column . '` ' . $definition
)) {
return false;
}
}
return true;
}
-20
View File
@@ -1,20 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_7_0($module)
{
$existing = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'template\''
);
if (empty($existing)) {
return true;
}
return Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml` DROP COLUMN `template`'
);
}
-20
View File
@@ -1,20 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_8_0($module)
{
$existing = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'template_key\''
);
if (!empty($existing)) {
return true;
}
return Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml` ADD COLUMN `template_key` VARCHAR(64) NOT NULL DEFAULT \'\''
);
}
-20
View File
@@ -1,20 +0,0 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
function upgrade_module_1_9_0($module)
{
$existing = Db::getInstance()->executeS(
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'template_key\''
);
if (empty($existing)) {
return true;
}
return Db::getInstance()->execute(
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml` DROP COLUMN `template_key`'
);
}
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;
+8
View File
@@ -0,0 +1,8 @@
<?php
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;