Converted several other migrations
This commit is contained in:
parent
f54c9bbd03
commit
c99f75c908
15
install/migrations/AbstractUpdateMigration.php
Normal file
15
install/migrations/AbstractUpdateMigration.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
abstract class AbstractUpdateMigration extends AbstractMigration {
|
||||||
|
abstract function getUpVersion();
|
||||||
|
|
||||||
|
abstract function getDownVersion();
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->updateVersion($this->getUpVersion(), $hesk_settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->updateVersion($this->getDownVersion(), $hesk_settings);
|
||||||
|
}
|
||||||
|
}
|
@ -35,5 +35,31 @@ function getAllMigrations() {
|
|||||||
24 => new \v200\AddMissingKeyToTickets(),
|
24 => new \v200\AddMissingKeyToTickets(),
|
||||||
25 => new \v200\MigrateIpAndEmailBans(),
|
25 => new \v200\MigrateIpAndEmailBans(),
|
||||||
26 => new \v200\UpdateVersion(),
|
26 => new \v200\UpdateVersion(),
|
||||||
|
//2.0.1
|
||||||
|
27 => new \v201\UpdateVersion(),
|
||||||
|
//2.1.0
|
||||||
|
28 => new \v210\UpdateVersion(),
|
||||||
|
//2.1.1
|
||||||
|
29 => new \v211\FixStageTicketsTable(),
|
||||||
|
30 => new \v211\UpdateVersion(),
|
||||||
|
//2.2.0
|
||||||
|
31 => new \v220\AddIsAutocloseOptionToStatuses(),
|
||||||
|
32 => new \v220\AddClosableColumnToStatuses(),
|
||||||
|
33 => new \v220\UpdateVersion(),
|
||||||
|
//2.2.1
|
||||||
|
34 => new \v221\UpdateVersion(),
|
||||||
|
//2.3.0
|
||||||
|
35 => new \v230\AddIconToServiceMessages(),
|
||||||
|
36 => new \v230\ConsolidateStatusColumns(),
|
||||||
|
37 => new \v230\AddCoordinatesToTickets(),
|
||||||
|
38 => new \v230\AddCategoryManager(),
|
||||||
|
39 => new \v230\MovePermissionsToHeskPrivilegesColumn(),
|
||||||
|
40 => new \v230\UpdateVersion(),
|
||||||
|
//2.3.1
|
||||||
|
41 => new \v231\UpdateVersion(),
|
||||||
|
//2.3.2
|
||||||
|
42 => new \v232\UpdateVersion(),
|
||||||
|
//2.4.0
|
||||||
|
43 => new \v240\CreateQuickHelpSectionsTable(),
|
||||||
);
|
);
|
||||||
}
|
}
|
15
install/migrations/v201/UpdateVersion.php
Normal file
15
install/migrations/v201/UpdateVersion.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v201;
|
||||||
|
|
||||||
|
|
||||||
|
class UpdateVersion extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->updateVersion('2.0.1', $hesk_settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->updateVersion('2.0.0', $hesk_settings);
|
||||||
|
}
|
||||||
|
}
|
15
install/migrations/v210/UpdateVersion.php
Normal file
15
install/migrations/v210/UpdateVersion.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v210;
|
||||||
|
|
||||||
|
|
||||||
|
class UpdateVersion extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->updateVersion('2.1.0', $hesk_settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->updateVersion('2.0.1', $hesk_settings);
|
||||||
|
}
|
||||||
|
}
|
36
install/migrations/v211/FixStageTicketsTable.php
Normal file
36
install/migrations/v211/FixStageTicketsTable.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v211;
|
||||||
|
|
||||||
|
class FixStageTicketsTable extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` CHANGE `dt` `dt` TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00'");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets`
|
||||||
|
CHANGE `email` `email` VARCHAR( 1000 ) NOT NULL DEFAULT '',
|
||||||
|
CHANGE `ip` `ip` VARCHAR(45) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
|
||||||
|
ADD `firstreply` TIMESTAMP NULL DEFAULT NULL AFTER `lastchange`,
|
||||||
|
ADD `closedat` TIMESTAMP NULL DEFAULT NULL AFTER `firstreply`,
|
||||||
|
ADD `articles` VARCHAR(255) NULL DEFAULT NULL AFTER `closedat`,
|
||||||
|
ADD `openedby` MEDIUMINT(8) DEFAULT '0' AFTER `status`,
|
||||||
|
ADD `firstreplyby` SMALLINT(5) UNSIGNED NULL DEFAULT NULL AFTER `openedby`,
|
||||||
|
ADD `closedby` MEDIUMINT(8) NULL DEFAULT NULL AFTER `firstreplyby`,
|
||||||
|
ADD `replies` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `closedby`,
|
||||||
|
ADD `staffreplies` SMALLINT( 5 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `replies`,
|
||||||
|
ADD INDEX ( `openedby` , `firstreplyby` , `closedby` ),
|
||||||
|
ADD INDEX(`dt`)");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets`
|
||||||
|
CHANGE `email` `email` VARCHAR(255) NOT NULL DEFAULT '',
|
||||||
|
CHANGE `ip` `ip` VARCHAR(46) NOT NULL DEFAULT '',
|
||||||
|
DROP `firstreply`,
|
||||||
|
DROP `closedat`,
|
||||||
|
DROP `articles`,
|
||||||
|
DROP `firstreplyby`,
|
||||||
|
DROP `closedby`,
|
||||||
|
DROP `replies`,
|
||||||
|
DROP `staffreplies`");
|
||||||
|
}
|
||||||
|
}
|
15
install/migrations/v211/UpdateVersion.php
Normal file
15
install/migrations/v211/UpdateVersion.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v211;
|
||||||
|
|
||||||
|
|
||||||
|
class UpdateVersion extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->updateVersion('2.1.1', $hesk_settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->updateVersion('2.1.0', $hesk_settings);
|
||||||
|
}
|
||||||
|
}
|
16
install/migrations/v220/AddClosableColumnToStatuses.php
Normal file
16
install/migrations/v220/AddClosableColumnToStatuses.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v220;
|
||||||
|
|
||||||
|
|
||||||
|
class AddClosableColumnToStatuses extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` ADD COLUMN `Closable` VARCHAR(10) NOT NULL");
|
||||||
|
$this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` SET `Closable` = 'yes'");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` DROP COLUMN `Closable`");
|
||||||
|
}
|
||||||
|
}
|
15
install/migrations/v220/AddIsAutocloseOptionToStatuses.php
Normal file
15
install/migrations/v220/AddIsAutocloseOptionToStatuses.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v220;
|
||||||
|
|
||||||
|
class AddIsAutocloseOptionToStatuses extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` ADD COLUMN `IsAutocloseOption` INT NOT NULL DEFAULT 0");
|
||||||
|
$this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` SET `IsAutocloseOption` = 1 WHERE `IsStaffClosedOption` = 1");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` DROP COLUMN `IsAutocloseOption`");
|
||||||
|
}
|
||||||
|
}
|
15
install/migrations/v220/UpdateVersion.php
Normal file
15
install/migrations/v220/UpdateVersion.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v220;
|
||||||
|
|
||||||
|
|
||||||
|
class UpdateVersion extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->updateVersion('2.2.0', $hesk_settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->updateVersion('2.1.1', $hesk_settings);
|
||||||
|
}
|
||||||
|
}
|
15
install/migrations/v221/UpdateVersion.php
Normal file
15
install/migrations/v221/UpdateVersion.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v221;
|
||||||
|
|
||||||
|
|
||||||
|
class UpdateVersion extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->updateVersion('2.2.1', $hesk_settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->updateVersion('2.2.0', $hesk_settings);
|
||||||
|
}
|
||||||
|
}
|
15
install/migrations/v230/AddCategoryManager.php
Normal file
15
install/migrations/v230/AddCategoryManager.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v230;
|
||||||
|
|
||||||
|
|
||||||
|
class AddCategoryManager extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `manager` INT NOT NULL DEFAULT 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `manager`");
|
||||||
|
}
|
||||||
|
}
|
21
install/migrations/v230/AddCoordinatesToTickets.php
Normal file
21
install/migrations/v230/AddCoordinatesToTickets.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v230;
|
||||||
|
|
||||||
|
|
||||||
|
class AddCoordinatesToTickets extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `latitude` VARCHAR(100) NOT NULL DEFAULT 'E-0'");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `longitude` VARCHAR(100) NOT NULL DEFAULT 'E-0'");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `latitude` VARCHAR(100) NOT NULL DEFAULT 'E-0'");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `longitude` VARCHAR(100) NOT NULL DEFAULT 'E-0'");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `latitude`");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `longitude`");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `latitude`");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` DROP COLUMN `longitude`");
|
||||||
|
}
|
||||||
|
}
|
15
install/migrations/v230/AddIconToServiceMessages.php
Normal file
15
install/migrations/v230/AddIconToServiceMessages.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v230;
|
||||||
|
|
||||||
|
|
||||||
|
class AddIconToServiceMessages extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "service_messages` ADD COLUMN `icon` VARCHAR(150)");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "service_messages` DROP COLUMN `icon`");
|
||||||
|
}
|
||||||
|
}
|
21
install/migrations/v230/ConsolidateStatusColumns.php
Normal file
21
install/migrations/v230/ConsolidateStatusColumns.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v230;
|
||||||
|
|
||||||
|
|
||||||
|
class ConsolidateStatusColumns extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` ADD COLUMN `Key` TEXT");
|
||||||
|
$this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` SET `Key` = `ShortNameContentKey`");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` DROP COLUMN `ShortNameContentKey`");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` DROP COLUMN `TicketViewContentKey`");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` ADD COLUMN `TicketViewContentKey` TEXT");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` ADD COLUMN `ShortNameContentKey` TEXT");
|
||||||
|
$this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` SET `TicketViewContentKey` = `Key`, `ShortNameContentKey` = `Key`");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` DROP COLUMN `Key`");
|
||||||
|
}
|
||||||
|
}
|
24
install/migrations/v230/CreatePermissionTemplates.php
Normal file
24
install/migrations/v230/CreatePermissionTemplates.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v230;
|
||||||
|
|
||||||
|
|
||||||
|
class CreatePermissionTemplates extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `permission_template` INT");
|
||||||
|
$this->executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "permission_templates` (`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`name` VARCHAR(255) NOT NULL,
|
||||||
|
`heskprivileges` VARCHAR(1000),
|
||||||
|
`categories` VARCHAR(500))");
|
||||||
|
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "permission_templates` (`name`, `heskprivileges`, `categories`)
|
||||||
|
VALUES ('Administrator', 'ALL', 'ALL')");
|
||||||
|
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "permission_templates` (`name`, `heskprivileges`, `categories`)
|
||||||
|
VALUES ('Staff', 'can_view_tickets,can_reply_tickets,can_change_cat,can_assign_self,can_view_unassigned,can_view_online', '1')");
|
||||||
|
$this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `permission_template` = 1 WHERE `isadmin` = '1'");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
// TODO: Implement down() method.
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v230;
|
||||||
|
|
||||||
|
|
||||||
|
class MovePermissionsToHeskPrivilegesColumn extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
// Move can_manage_settings and can_change_notification_settings into the heskprivileges list
|
||||||
|
$res = $this->executeQuery("SELECT `id`, `heskprivileges` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `isadmin` = '0'
|
||||||
|
AND `can_manage_settings` = '1'");
|
||||||
|
while ($row = hesk_dbFetchAssoc($res)) {
|
||||||
|
if ($row['heskprivileges'] != '') {
|
||||||
|
$currentPrivileges = explode(',', $row['heskprivileges']);
|
||||||
|
array_push($currentPrivileges, 'can_man_settings');
|
||||||
|
$newPrivileges = implode(',', $currentPrivileges);
|
||||||
|
$this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `heskprivileges` = '" . hesk_dbEscape($newPrivileges) . "'
|
||||||
|
WHERE `id` = " . intval($row['id']));
|
||||||
|
} else {
|
||||||
|
$this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `heskprivileges` = 'can_man_settings'
|
||||||
|
WHERE `id` = " . intval($row['id']));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$res = $this->executeQuery("SELECT `id`, `heskprivileges` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `isadmin` = '0'
|
||||||
|
AND `can_change_notification_settings` = '1'");
|
||||||
|
while ($row = hesk_dbFetchAssoc($res)) {
|
||||||
|
if ($row['heskprivileges'] != '') {
|
||||||
|
$currentPrivileges = explode(',', $row['heskprivileges']);
|
||||||
|
array_push($currentPrivileges, 'can_change_notification_settings');
|
||||||
|
$newPrivileges = implode(',', $currentPrivileges);
|
||||||
|
$this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `heskprivileges` = '" . hesk_dbEscape($newPrivileges) . "'
|
||||||
|
WHERE `id` = " . intval($row['id']));
|
||||||
|
} else {
|
||||||
|
$this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `heskprivileges` = 'can_change_notification_settings'
|
||||||
|
WHERE `id` = " . intval($row['id']));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `can_manage_settings`");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `can_change_notification_settings`");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `can_change_notification_settings` ENUM('0', '1') NOT NULL DEFAULT '1'");
|
||||||
|
$this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `can_manage_settings` ENUM ('0', '1') NOT NULL DEFAULT '1'");
|
||||||
|
|
||||||
|
$this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users`
|
||||||
|
SET `can_change_settings` = '0'
|
||||||
|
WHERE `heskprivileges` NOT LIKE '%can_man_settings%'");
|
||||||
|
$this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users`
|
||||||
|
SET `can_change_notification_settings` = '0'
|
||||||
|
WHERE `heskprivileges` NOT LIKE '%can_change_notification_settings%'");
|
||||||
|
}
|
||||||
|
}
|
15
install/migrations/v230/UpdateVersion.php
Normal file
15
install/migrations/v230/UpdateVersion.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v230;
|
||||||
|
|
||||||
|
|
||||||
|
class UpdateVersion extends \AbstractUpdateMigration {
|
||||||
|
|
||||||
|
function getUpVersion() {
|
||||||
|
return '2.3.0';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDownVersion() {
|
||||||
|
return '2.2.1';
|
||||||
|
}
|
||||||
|
}
|
15
install/migrations/v231/UpdateVersion.php
Normal file
15
install/migrations/v231/UpdateVersion.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v231;
|
||||||
|
|
||||||
|
|
||||||
|
class UpdateVersion extends \AbstractUpdateMigration {
|
||||||
|
|
||||||
|
function getUpVersion() {
|
||||||
|
return '2.3.1';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDownVersion() {
|
||||||
|
return '2.3.0';
|
||||||
|
}
|
||||||
|
}
|
15
install/migrations/v232/UpdateVersion.php
Normal file
15
install/migrations/v232/UpdateVersion.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v232;
|
||||||
|
|
||||||
|
|
||||||
|
class UpdateVersion extends \AbstractUpdateMigration {
|
||||||
|
|
||||||
|
function getUpVersion() {
|
||||||
|
return '2.3.2';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDownVersion() {
|
||||||
|
return '2.3.1';
|
||||||
|
}
|
||||||
|
}
|
30
install/migrations/v240/CreateQuickHelpSectionsTable.php
Normal file
30
install/migrations/v240/CreateQuickHelpSectionsTable.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace v240;
|
||||||
|
|
||||||
|
|
||||||
|
class CreateQuickHelpSectionsTable extends \AbstractMigration {
|
||||||
|
|
||||||
|
function up($hesk_settings) {
|
||||||
|
$this->executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (
|
||||||
|
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`location` VARCHAR(100) NOT NULL,
|
||||||
|
`show` ENUM('0','1') NOT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
|
||||||
|
|
||||||
|
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`)
|
||||||
|
VALUES ('create_ticket', '1')");
|
||||||
|
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`)
|
||||||
|
VALUES ('view_ticket_form', '1')");
|
||||||
|
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`)
|
||||||
|
VALUES ('view_ticket', '1')");
|
||||||
|
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`)
|
||||||
|
VALUES ('knowledgebase', '1')");
|
||||||
|
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`)
|
||||||
|
VALUES ('staff_create_ticket', '1')");
|
||||||
|
}
|
||||||
|
|
||||||
|
function down($hesk_settings) {
|
||||||
|
$this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections`");
|
||||||
|
}
|
||||||
|
}
|
@ -37,165 +37,6 @@ function executeQuery($sql)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Version 2.0.1
|
|
||||||
function execute201Scripts()
|
|
||||||
{
|
|
||||||
global $hesk_settings;
|
|
||||||
|
|
||||||
hesk_dbConnect();
|
|
||||||
executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.0.1' WHERE `Key` = 'modsForHeskVersion'");
|
|
||||||
}
|
|
||||||
|
|
||||||
// BEGIN Version 2.1.0
|
|
||||||
function execute210Scripts()
|
|
||||||
{
|
|
||||||
global $hesk_settings;
|
|
||||||
|
|
||||||
hesk_dbConnect();
|
|
||||||
executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.1.0' WHERE `Key` = 'modsForHeskVersion'");
|
|
||||||
|
|
||||||
// Some old tables may not have been dropped during the 2.0.0 upgrade. Check and drop if necessary
|
|
||||||
executeQuery("DROP TABLE IF EXISTS `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_ips`");
|
|
||||||
executeQuery("DROP TABLE IF EXISTS `" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_emails`");
|
|
||||||
}
|
|
||||||
// END Version 2.1.0
|
|
||||||
|
|
||||||
// BEGIN Version 2.1.1
|
|
||||||
function execute211Scripts()
|
|
||||||
{
|
|
||||||
global $hesk_settings;
|
|
||||||
|
|
||||||
hesk_dbConnect();
|
|
||||||
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` CHANGE `dt` `dt` TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00'");
|
|
||||||
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets`
|
|
||||||
CHANGE `email` `email` VARCHAR( 1000 ) NOT NULL DEFAULT '',
|
|
||||||
CHANGE `ip` `ip` VARCHAR(45) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
|
|
||||||
ADD `firstreply` TIMESTAMP NULL DEFAULT NULL AFTER `lastchange`,
|
|
||||||
ADD `closedat` TIMESTAMP NULL DEFAULT NULL AFTER `firstreply`,
|
|
||||||
ADD `articles` VARCHAR(255) NULL DEFAULT NULL AFTER `closedat`,
|
|
||||||
ADD `openedby` MEDIUMINT(8) DEFAULT '0' AFTER `status`,
|
|
||||||
ADD `firstreplyby` SMALLINT(5) UNSIGNED NULL DEFAULT NULL AFTER `openedby`,
|
|
||||||
ADD `closedby` MEDIUMINT(8) NULL DEFAULT NULL AFTER `firstreplyby`,
|
|
||||||
ADD `replies` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `closedby`,
|
|
||||||
ADD `staffreplies` SMALLINT( 5 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `replies`,
|
|
||||||
ADD INDEX ( `openedby` , `firstreplyby` , `closedby` ),
|
|
||||||
ADD INDEX(`dt`)");
|
|
||||||
executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.1.1' WHERE `Key` = 'modsForHeskVersion'");
|
|
||||||
}
|
|
||||||
// END Version 2.1.1
|
|
||||||
|
|
||||||
// BEGIN Version 2.2.0
|
|
||||||
function execute220Scripts()
|
|
||||||
{
|
|
||||||
global $hesk_settings;
|
|
||||||
|
|
||||||
hesk_dbConnect();
|
|
||||||
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` ADD COLUMN `IsAutocloseOption` INT NOT NULL DEFAULT 0");
|
|
||||||
|
|
||||||
// There will only ever be one row
|
|
||||||
executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` SET `IsAutocloseOption` = 1 WHERE `IsStaffClosedOption` = 1");
|
|
||||||
|
|
||||||
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` ADD COLUMN `Closable` VARCHAR(10) NOT NULL");
|
|
||||||
executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` SET `Closable` = 'yes'");
|
|
||||||
executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.2.0' WHERE `Key` = 'modsForHeskVersion'");
|
|
||||||
}
|
|
||||||
// END Version 2.2.0
|
|
||||||
|
|
||||||
// BEGIN Version 2.2.1
|
|
||||||
function execute221Scripts()
|
|
||||||
{
|
|
||||||
global $hesk_settings;
|
|
||||||
|
|
||||||
hesk_dbConnect();
|
|
||||||
executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.2.1' WHERE `Key` = 'modsForHeskVersion'");
|
|
||||||
}
|
|
||||||
|
|
||||||
// END Version 2.2.1
|
|
||||||
|
|
||||||
// BEGIN Version 2.3.0
|
|
||||||
function execute230Scripts()
|
|
||||||
{
|
|
||||||
global $hesk_settings;
|
|
||||||
|
|
||||||
hesk_dbConnect();
|
|
||||||
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "service_messages` ADD COLUMN `icon` VARCHAR(150)");
|
|
||||||
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` ADD COLUMN `Key` TEXT");
|
|
||||||
executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` SET `Key` = `ShortNameContentKey`");
|
|
||||||
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` DROP COLUMN `ShortNameContentKey`");
|
|
||||||
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` DROP COLUMN `TicketViewContentKey`");
|
|
||||||
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `latitude` VARCHAR(100) NOT NULL DEFAULT 'E-0'");
|
|
||||||
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `longitude` VARCHAR(100) NOT NULL DEFAULT 'E-0'");
|
|
||||||
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `latitude` VARCHAR(100) NOT NULL DEFAULT 'E-0'");
|
|
||||||
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "stage_tickets` ADD COLUMN `longitude` VARCHAR(100) NOT NULL DEFAULT 'E-0'");
|
|
||||||
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `manager` INT NOT NULL DEFAULT 0");
|
|
||||||
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `permission_template` INT");
|
|
||||||
executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "permission_templates` (`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
`name` VARCHAR(255) NOT NULL,
|
|
||||||
`heskprivileges` VARCHAR(1000),
|
|
||||||
`categories` VARCHAR(500))");
|
|
||||||
executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "permission_templates` (`name`, `heskprivileges`, `categories`)
|
|
||||||
VALUES ('Administrator', 'ALL', 'ALL')");
|
|
||||||
executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "permission_templates` (`name`, `heskprivileges`, `categories`)
|
|
||||||
VALUES ('Staff', 'can_view_tickets,can_reply_tickets,can_change_cat,can_assign_self,can_view_unassigned,can_view_online', '1')");
|
|
||||||
executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `permission_template` = 1 WHERE `isadmin` = '1'");
|
|
||||||
|
|
||||||
// Move can_manage_settings and can_change_notification_settings into the heskprivileges list
|
|
||||||
$res = executeQuery("SELECT `id`, `heskprivileges` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `isadmin` = '0'
|
|
||||||
AND `can_manage_settings` = '1'");
|
|
||||||
while ($row = hesk_dbFetchAssoc($res)) {
|
|
||||||
if ($row['heskprivileges'] != '') {
|
|
||||||
$currentPrivileges = explode(',', $row['heskprivileges']);
|
|
||||||
array_push($currentPrivileges, 'can_man_settings');
|
|
||||||
$newPrivileges = implode(',', $currentPrivileges);
|
|
||||||
executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `heskprivileges` = '" . hesk_dbEscape($newPrivileges) . "'
|
|
||||||
WHERE `id` = " . intval($row['id']));
|
|
||||||
} else {
|
|
||||||
executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `heskprivileges` = 'can_man_settings'
|
|
||||||
WHERE `id` = " . intval($row['id']));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$res = executeQuery("SELECT `id`, `heskprivileges` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `isadmin` = '0'
|
|
||||||
AND `can_change_notification_settings` = '1'");
|
|
||||||
while ($row = hesk_dbFetchAssoc($res)) {
|
|
||||||
if ($row['heskprivileges'] != '') {
|
|
||||||
$currentPrivileges = explode(',', $row['heskprivileges']);
|
|
||||||
array_push($currentPrivileges, 'can_change_notification_settings');
|
|
||||||
$newPrivileges = implode(',', $currentPrivileges);
|
|
||||||
executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `heskprivileges` = '" . hesk_dbEscape($newPrivileges) . "'
|
|
||||||
WHERE `id` = " . intval($row['id']));
|
|
||||||
} else {
|
|
||||||
executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `heskprivileges` = 'can_change_notification_settings'
|
|
||||||
WHERE `id` = " . intval($row['id']));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `can_manage_settings`");
|
|
||||||
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `can_change_notification_settings`");
|
|
||||||
|
|
||||||
executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.3.0' WHERE `Key` = 'modsForHeskVersion'");
|
|
||||||
}
|
|
||||||
// END Version 2.3.0
|
|
||||||
|
|
||||||
|
|
||||||
// BEGIN Version 2.3.1
|
|
||||||
function execute231Scripts()
|
|
||||||
{
|
|
||||||
global $hesk_settings;
|
|
||||||
|
|
||||||
hesk_dbConnect();
|
|
||||||
executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.3.1' WHERE `Key` = 'modsForHeskVersion'");
|
|
||||||
}
|
|
||||||
|
|
||||||
// END Verison 2.3.1
|
|
||||||
|
|
||||||
// BEGIN Version 2.3.2
|
|
||||||
function execute232Scripts()
|
|
||||||
{
|
|
||||||
global $hesk_settings;
|
|
||||||
|
|
||||||
hesk_dbConnect();
|
|
||||||
executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.3.2' WHERE `Key` = 'modsForHeskVersion'");
|
|
||||||
}
|
|
||||||
|
|
||||||
// END Version 2.3.2
|
// END Version 2.3.2
|
||||||
|
|
||||||
// BEGIN Version 2.4.0
|
// BEGIN Version 2.4.0
|
||||||
@ -205,23 +46,6 @@ function execute240Scripts()
|
|||||||
|
|
||||||
hesk_dbConnect();
|
hesk_dbConnect();
|
||||||
|
|
||||||
// Setup quick help sections
|
|
||||||
executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (
|
|
||||||
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
`location` VARCHAR(100) NOT NULL,
|
|
||||||
`show` ENUM('0','1') NOT NULL
|
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
|
|
||||||
|
|
||||||
executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`)
|
|
||||||
VALUES ('create_ticket', '1')");
|
|
||||||
executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`)
|
|
||||||
VALUES ('view_ticket_form', '1')");
|
|
||||||
executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`)
|
|
||||||
VALUES ('view_ticket', '1')");
|
|
||||||
executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`)
|
|
||||||
VALUES ('knowledgebase', '1')");
|
|
||||||
executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` (`location`, `show`)
|
|
||||||
VALUES ('staff_create_ticket', '1')");
|
|
||||||
|
|
||||||
// Setup status improvement tables
|
// Setup status improvement tables
|
||||||
executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "text_to_status_xref` (
|
executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "text_to_status_xref` (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user