From 62c059b38414e5fba64af6e5750625ab0160a1df Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Wed, 4 Oct 2017 13:07:12 -0400 Subject: [PATCH] Finished rewriting all of the migrations --- install/migrations/core.php | 13 ++ .../v310/AddApiUrlRewriteSetting.php | 15 ++ .../migrations/v310/AddCustomNavElements.php | 28 +++ .../v310/AddMoreColorOptionsToCategories.php | 20 ++ .../migrations/v310/AddNewLoginSettings.php | 21 +++ .../migrations/v310/AddStackTraceToLogs.php | 15 ++ .../v310/ConvertPresetToIndividualColors.php | 125 +++++++++++++ install/migrations/v320/AddAuditTrail.php | 26 +++ ...DescriptionToCategoriesAndCustomFields.php | 33 ++++ .../ajax/install-database-ajax.php | 100 ---------- install/mods-for-hesk/ajax/task-ajax.php | 32 ---- .../ajax/uninstall-database-ajax.php | 17 -- install/mods-for-hesk/sql/installSql.php | 175 ------------------ install/mods-for-hesk/sql/uninstallSql.php | 110 ----------- 14 files changed, 296 insertions(+), 434 deletions(-) create mode 100644 install/migrations/v310/AddApiUrlRewriteSetting.php create mode 100644 install/migrations/v310/AddCustomNavElements.php create mode 100644 install/migrations/v310/AddMoreColorOptionsToCategories.php create mode 100644 install/migrations/v310/AddNewLoginSettings.php create mode 100644 install/migrations/v310/AddStackTraceToLogs.php create mode 100644 install/migrations/v310/ConvertPresetToIndividualColors.php create mode 100644 install/migrations/v320/AddAuditTrail.php create mode 100644 install/migrations/v320/AddDescriptionToCategoriesAndCustomFields.php delete mode 100644 install/mods-for-hesk/ajax/install-database-ajax.php delete mode 100644 install/mods-for-hesk/ajax/task-ajax.php delete mode 100644 install/mods-for-hesk/ajax/uninstall-database-ajax.php delete mode 100644 install/mods-for-hesk/sql/installSql.php delete mode 100644 install/mods-for-hesk/sql/uninstallSql.php diff --git a/install/migrations/core.php b/install/migrations/core.php index 8032096b..c7a93a1d 100644 --- a/install/migrations/core.php +++ b/install/migrations/core.php @@ -117,5 +117,18 @@ function getAllMigrations() { 80 => new UpdateMigration('3.0.5', '3.0.4'), 81 => new UpdateMigration('3.0.6', '3.0.5'), 82 => new UpdateMigration('3.0.7', '3.0.6'), + //3.1.0 + 83 => new \v310\AddStackTraceToLogs(), + 84 => new \v310\AddCustomNavElements(), + 85 => new \v310\AddMoreColorOptionsToCategories(), + 86 => new \v310\AddNewLoginSettings(), + 87 => new \v310\AddApiUrlRewriteSetting(), + 88 => new \v310\ConvertPresetToIndividualColors(), + 89 => new UpdateMigration('3.1.0', '3.0.7'), + //3.1.1 + 90 => new UpdateMigration('3.1.1', '3.1.0'), + //3.2.0 + 91 => new \v320\AddDescriptionToCategoriesAndCustomFields(), + 92 => new \v320\AddAuditTrail(), ); } \ No newline at end of file diff --git a/install/migrations/v310/AddApiUrlRewriteSetting.php b/install/migrations/v310/AddApiUrlRewriteSetting.php new file mode 100644 index 00000000..cf1d6846 --- /dev/null +++ b/install/migrations/v310/AddApiUrlRewriteSetting.php @@ -0,0 +1,15 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('api_url_rewrite', '0')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'api_url_rewrite'"); + } +} \ No newline at end of file diff --git a/install/migrations/v310/AddCustomNavElements.php b/install/migrations/v310/AddCustomNavElements.php new file mode 100644 index 00000000..a3585df6 --- /dev/null +++ b/install/migrations/v310/AddCustomNavElements.php @@ -0,0 +1,28 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "custom_nav_element` + (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + image_url TEXT, + font_icon VARCHAR(200), + place INT NOT NULL, + url VARCHAR(500) NOT NULL, + sort INT NOT NULL)"); + $this->executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "custom_nav_element_to_text` + (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + nav_element_id INT NOT NULL, + language VARCHAR(200) NOT NULL, + text VARCHAR(200) NOT NULL, + subtext VARCHAR(200))"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "custom_nav_element`"); + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "custom_nav_element_to_text`"); + } +} \ No newline at end of file diff --git a/install/migrations/v310/AddMoreColorOptionsToCategories.php b/install/migrations/v310/AddMoreColorOptionsToCategories.php new file mode 100644 index 00000000..41e21d2d --- /dev/null +++ b/install/migrations/v310/AddMoreColorOptionsToCategories.php @@ -0,0 +1,20 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `foreground_color` VARCHAR(7) NOT NULL DEFAULT 'AUTO'"); + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `display_border_outline` ENUM('0','1') NOT NULL DEFAULT '0'"); + $this->executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `color` = '#FFFFFF' WHERE `color` IS NULL"); + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` CHANGE `color` `background_color` VARCHAR(7) NOT NULL DEFAULT '#FFFFFF'"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `foreground_color`"); + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `display_border_outline`"); + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` CHANGE `background_color` `color` VARCHAR(7) NOT NULL DEFAULT '#FFFFFF'"); + } +} \ No newline at end of file diff --git a/install/migrations/v310/AddNewLoginSettings.php b/install/migrations/v310/AddNewLoginSettings.php new file mode 100644 index 00000000..d37184d6 --- /dev/null +++ b/install/migrations/v310/AddNewLoginSettings.php @@ -0,0 +1,21 @@ +executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('login_background_type', 'color')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('login_background', '#d2d6de')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('login_box_header', 'helpdesk-title')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('login_box_header_image', '')"); + } + + function down($hesk_settings) { + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'login_background_type'"); + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'login_background'"); + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'login_box_header'"); + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'login_box_header_image'"); + } +} \ No newline at end of file diff --git a/install/migrations/v310/AddStackTraceToLogs.php b/install/migrations/v310/AddStackTraceToLogs.php new file mode 100644 index 00000000..ec89b916 --- /dev/null +++ b/install/migrations/v310/AddStackTraceToLogs.php @@ -0,0 +1,15 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "logging` ADD COLUMN `stack_trace` TEXT"); + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "logging` DROP COLUMN `stack_trace`"); + } +} \ No newline at end of file diff --git a/install/migrations/v310/ConvertPresetToIndividualColors.php b/install/migrations/v310/ConvertPresetToIndividualColors.php new file mode 100644 index 00000000..b3c0127b --- /dev/null +++ b/install/migrations/v310/ConvertPresetToIndividualColors.php @@ -0,0 +1,125 @@ +executeQuery("SELECT `Value` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'admin_color_scheme'"); + if (hesk_dbNumRows($theme_preset_rs) === 0) { + $theme = 'skin-blue'; + } else { + $theme_preset_row = hesk_dbFetchAssoc($theme_preset_rs); + $theme = $theme_preset_row['Value']; + } + + $light_theme = preg_match('/.*-light/g', $theme); + $navbar = array( + 'background' => '', + 'text' => '#fff', + 'text_hover' => '#fff', + 'background_hover' => '' + ); + $navbar_brand = array( + 'background' => '', + 'text' => '#fff', + 'text_hover' => '#fff', + 'background_hover' => '' + ); + $sidebar = array( + 'background' => $light_theme ? '#f9fafc' : '#222d32', + 'text' => $light_theme ? '#444' : '#b8c7ce', + 'text_hover' => $light_theme ? '#444' : '#fff', + 'background_hover' => $light_theme ? '#f4f4f5' : '#1e282c', + 'font_weight' => $light_theme ? 'bold' : 'normal' + ); + $sidebar_header = array( + 'background' => $light_theme ? '#f9fafc' : '#1a2226', + 'text' => $light_theme ? '#848484' : '#4b646f', + ); + if (preg_match('/skin-blue.*/', $theme)) { + $navbar['background'] = '#3c8dbc'; + $navbar['background_hover'] = '#367fa9'; + + $navbar_brand['background'] = $light_theme ? '#3c8dbc' : '#367fa9'; + $navbar_brand['background_hover'] = $light_theme ? '#3b8ab8' : '#357ca5'; + } elseif (preg_match('/skin-yellow.*/', $theme)) { + $navbar['background'] = '#f39c12'; + $navbar['background_hover'] = '#da8c10'; + + $navbar_brand['background'] = $light_theme ? '#f39c12' : '#e08e0b'; + $navbar_brand['background_hover'] = $light_theme ? '#f39a0d' : '#db8b0b'; + } elseif (preg_match('/skin-green.*/', $theme)) { + $navbar['background'] = '#00a65a'; + $navbar['background_hover'] = '#009551'; + + $navbar_brand['background'] = $light_theme ? '#00a65a' : '#008d4c'; + $navbar_brand['background_hover'] = $light_theme ? '#00a157' : '#008749'; + } elseif (preg_match('/skin-purple.*/', $theme)) { + $navbar['background'] = '#605ca8'; + $navbar['background_hover'] = '#565397'; + + $navbar_brand['background'] = $light_theme ? '#605ca8' : '#555299'; + $navbar_brand['background_hover'] = $light_theme ? '#5d59a6' : '#545096'; + } elseif (preg_match('/skin-red.*/', $theme)) { + $navbar['background'] = '#dd4b39'; + $navbar['background_hover'] = '#c64333'; + + $navbar_brand['background'] = $light_theme ? '#dd4b39' : '#d73925'; + $navbar_brand['background_hover'] = $light_theme ? '#dc4735' : '#d33724'; + } else { + $navbar['background'] = '#fff'; + $navbar['background_hover'] = '#eee'; + $navbar['text_color'] = '#333'; + $navbar['text_hover'] = '#333'; + + $navbar_brand['background'] = '#fff'; + $navbar_brand['background_hover'] = '#fcfcfc'; + $navbar_brand['text'] = '#333'; + $navbar_brand['text_hover'] = '#333'; + } + + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_navbar_background', '{$navbar['background']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_navbar_background_hover', '{$navbar['background_hover']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_navbar_text', '{$navbar['text']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_navbar_text_hover', '{$navbar['text_hover']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_navbar_brand_background', '{$navbar_brand['background']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_navbar_brand_background_hover', '{$navbar_brand['background_hover']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_navbar_brand_text', '{$navbar_brand['text']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_navbar_brand_text_hover', '{$navbar_brand['text_hover']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_sidebar_background', '{$sidebar['background']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_sidebar_background_hover', '{$sidebar['background_hover']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_sidebar_text', '{$sidebar['text']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_sidebar_text_hover', '{$sidebar['text_hover']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_sidebar_font_weight', '{$sidebar['font_weight']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_sidebar_header_background', '{$sidebar_header['background']}')"); + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_sidebar_header_text', '{$sidebar_header['text']}')"); + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` IN ('rtl', 'admin_color_scheme')"); + } + + function down($hesk_settings) { + $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) + VALUES ('admin_color_scheme', 'skin-blue')"); + $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` IN ('admin_navbar_background', + 'admin_navbar_background_hover', 'admin_navbar_text', 'admin_navbar_text_hover', 'admin_navbar_brand_background', + 'admin_navbar_brand_background_hover', 'admin_navbar_brand_text', 'admin_navbar_brand_text_hover', 'admin_sidebar_background', + 'admin_sidebar_background_hover', 'admin_sidebar_text', 'admin_sidebar_text_hover', 'admin_sidebar_font_weight', + 'admin_sidebar_header_background', 'admin_sidebar_header_text')"); + } +} \ No newline at end of file diff --git a/install/migrations/v320/AddAuditTrail.php b/install/migrations/v320/AddAuditTrail.php new file mode 100644 index 00000000..7c0dc66f --- /dev/null +++ b/install/migrations/v320/AddAuditTrail.php @@ -0,0 +1,26 @@ +executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "audit_trail` ( + `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + `entity_id` INT NOT NULL, + `entity_type` VARCHAR(50) NOT NULL, + `language_key` VARCHAR(100) NOT NULL, + `date` TIMESTAMP NOT NULL)"); + $this->executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "audit_trail_to_replacement_values` ( + `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + `audit_trail_id` INT NOT NULL, + `replacement_index` INT NOT NULL, + `replacement_value` TEXT NOT NULL)"); + } + + function down($hesk_settings) { + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "audit_trail`"); + $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "audit_trail_to_replacement_values`"); + } +} \ No newline at end of file diff --git a/install/migrations/v320/AddDescriptionToCategoriesAndCustomFields.php b/install/migrations/v320/AddDescriptionToCategoriesAndCustomFields.php new file mode 100644 index 00000000..e242dc2f --- /dev/null +++ b/install/migrations/v320/AddDescriptionToCategoriesAndCustomFields.php @@ -0,0 +1,33 @@ +executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` + ADD COLUMN `mfh_description` TEXT"); + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "custom_fields` + ADD COLUMN `mfh_description` TEXT"); + + // Purge the custom field caches as we're adding a new field + foreach ($hesk_settings['languages'] as $key => $value) { + $language_hash = sha1($key); + hesk_unlink(HESK_PATH . "cache/cf_{$language_hash}.cache.php"); + } + } + + function down($hesk_settings) { + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` + DROP COLUMN `mfh_description`"); + $this->executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "custom_fields` + DROP COLUMN `mfh_description`"); + + // Purge the custom field caches as we're adding a new field + foreach ($hesk_settings['languages'] as $key => $value) { + $language_hash = sha1($key); + hesk_unlink(HESK_PATH . "cache/cf_{$language_hash}.cache.php"); + } + } +} \ No newline at end of file diff --git a/install/mods-for-hesk/ajax/install-database-ajax.php b/install/mods-for-hesk/ajax/install-database-ajax.php deleted file mode 100644 index 77aed493..00000000 --- a/install/mods-for-hesk/ajax/install-database-ajax.php +++ /dev/null @@ -1,100 +0,0 @@ - 0) { - $jsonToSend['status'] = 'ATTENTION'; - $jsonToSend['users'] = array(); - $users = getUsers(); - foreach ($users as $user) { - array_push($jsonToSend['users'], $user); - } - } else { - $jsonToSend['status'] = 'SUCCESS'; - } - print json_encode($jsonToSend); -} elseif ($task == 'migrate-bans') { - migrateBans($_POST['user']); -} elseif ($task == 'initialize-statuses') { - initializeXrefTable(); -} else { - $response = 'The task "' . $task . '" was not recognized. Check your spelling and try again.'; - print $response; - http_response_code(400); -} \ No newline at end of file diff --git a/install/mods-for-hesk/ajax/uninstall-database-ajax.php b/install/mods-for-hesk/ajax/uninstall-database-ajax.php deleted file mode 100644 index 92c3af7c..00000000 --- a/install/mods-for-hesk/ajax/uninstall-database-ajax.php +++ /dev/null @@ -1,17 +0,0 @@ - '', - 'text' => '#fff', - 'text_hover' => '#fff', - 'background_hover' => '' - ); - $navbar_brand = array( - 'background' => '', - 'text' => '#fff', - 'text_hover' => '#fff', - 'background_hover' => '' - ); - $sidebar = array( - 'background' => $light_theme ? '#f9fafc' : '#222d32', - 'text' => $light_theme ? '#444' : '#b8c7ce', - 'text_hover' => $light_theme ? '#444' : '#fff', - 'background_hover' => $light_theme ? '#f4f4f5' : '#1e282c', - 'font_weight' => $light_theme ? 'bold' : 'normal' - ); - $sidebar_header = array( - 'background' => $light_theme ? '#f9fafc' : '#1a2226', - 'text' => $light_theme ? '#848484' : '#4b646f', - ); - if (preg_match('/skin-blue.*/', $theme)) { - $navbar['background'] = '#3c8dbc'; - $navbar['background_hover'] = '#367fa9'; - - $navbar_brand['background'] = $light_theme ? '#3c8dbc' : '#367fa9'; - $navbar_brand['background_hover'] = $light_theme ? '#3b8ab8' : '#357ca5'; - } elseif (preg_match('/skin-yellow.*/', $theme)) { - $navbar['background'] = '#f39c12'; - $navbar['background_hover'] = '#da8c10'; - - $navbar_brand['background'] = $light_theme ? '#f39c12' : '#e08e0b'; - $navbar_brand['background_hover'] = $light_theme ? '#f39a0d' : '#db8b0b'; - } elseif (preg_match('/skin-green.*/', $theme)) { - $navbar['background'] = '#00a65a'; - $navbar['background_hover'] = '#009551'; - - $navbar_brand['background'] = $light_theme ? '#00a65a' : '#008d4c'; - $navbar_brand['background_hover'] = $light_theme ? '#00a157' : '#008749'; - } elseif (preg_match('/skin-purple.*/', $theme)) { - $navbar['background'] = '#605ca8'; - $navbar['background_hover'] = '#565397'; - - $navbar_brand['background'] = $light_theme ? '#605ca8' : '#555299'; - $navbar_brand['background_hover'] = $light_theme ? '#5d59a6' : '#545096'; - } elseif (preg_match('/skin-red.*/', $theme)) { - $navbar['background'] = '#dd4b39'; - $navbar['background_hover'] = '#c64333'; - - $navbar_brand['background'] = $light_theme ? '#dd4b39' : '#d73925'; - $navbar_brand['background_hover'] = $light_theme ? '#dc4735' : '#d33724'; - } else { - $navbar['background'] = '#fff'; - $navbar['background_hover'] = '#eee'; - $navbar['text_color'] = '#333'; - $navbar['text_hover'] = '#333'; - - $navbar_brand['background'] = '#fff'; - $navbar_brand['background_hover'] = '#fcfcfc'; - $navbar_brand['text'] = '#333'; - $navbar_brand['text_hover'] = '#333'; - } - - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_navbar_background', '{$navbar['background']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_navbar_background_hover', '{$navbar['background_hover']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_navbar_text', '{$navbar['text']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_navbar_text_hover', '{$navbar['text_hover']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_navbar_brand_background', '{$navbar_brand['background']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_navbar_brand_background_hover', '{$navbar_brand['background_hover']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_navbar_brand_text', '{$navbar_brand['text']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_navbar_brand_text_hover', '{$navbar_brand['text_hover']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_sidebar_background', '{$sidebar['background']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_sidebar_background_hover', '{$sidebar['background_hover']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_sidebar_text', '{$sidebar['text']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_sidebar_text_hover', '{$sidebar['text_hover']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_sidebar_font_weight', '{$sidebar['font_weight']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_sidebar_header_background', '{$sidebar_header['background']}')"); - executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) - VALUES ('admin_sidebar_header_text', '{$sidebar_header['text']}')"); - executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` IN ('rtl', 'admin_color_scheme')"); - - updateVersion('3.1.0'); -} - -function execute311Scripts() { - global $hesk_settings; - hesk_dbConnect(); - - updateVersion('3.1.1'); -} - -function execute320Scripts() { - global $hesk_settings; - hesk_dbConnect(); - - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` - ADD COLUMN `mfh_description` TEXT"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "custom_fields` - ADD COLUMN `mfh_description` TEXT"); - - // Purge the custom field caches as we're adding a new field - foreach ($hesk_settings['languages'] as $key => $value) { - $language_hash = sha1($key); - hesk_unlink(HESK_PATH . "cache/cf_{$language_hash}.cache.php"); - } - - executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "audit_trail` ( - `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - `entity_id` INT NOT NULL, - `entity_type` VARCHAR(50) NOT NULL, - `language_key` VARCHAR(100) NOT NULL, - `date` TIMESTAMP NOT NULL)"); - executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "audit_trail_to_replacement_values` ( - `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - `audit_trail_id` INT NOT NULL, - `replacement_index` INT NOT NULL, - `replacement_value` TEXT NOT NULL)"); - - updateVersion('3.2.0'); -} \ No newline at end of file diff --git a/install/mods-for-hesk/sql/uninstallSql.php b/install/mods-for-hesk/sql/uninstallSql.php deleted file mode 100644 index 6d12cda5..00000000 --- a/install/mods-for-hesk/sql/uninstallSql.php +++ /dev/null @@ -1,110 +0,0 @@ -