feat(main): Add alert type; add template override support

This commit is contained in:
2026-08-13 15:31:23 +02:00
parent ce480314f3
commit 34fb95a699
18 changed files with 202 additions and 8 deletions
+31
View File
@@ -0,0 +1,31 @@
<?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;
}
+20
View File
@@ -0,0 +1,20 @@
<?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
@@ -0,0 +1,20 @@
<?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`'
);
}