@@ -65,145 +65,147 @@ hesk_dbConnect();
output_header_row('1.0.0 - 1.3.x');
$all_good = run_table_check('statuses');
- $all_good = $all_good & run_column_check('statuses', 'ID');
- $all_good = $all_good & run_column_check('statuses', 'TextColor');
- $all_good = $all_good & run_column_check('statuses', 'IsNewTicketStatus');
- $all_good = $all_good & run_column_check('statuses', 'IsClosed');
- $all_good = $all_good & run_column_check('statuses', 'IsClosedByClient');
- $all_good = $all_good & run_column_check('statuses', 'IsCustomerReplyStatus');
- $all_good = $all_good & run_column_check('statuses', 'IsStaffClosedOption');
- $all_good = $all_good & run_column_check('statuses', 'IsStaffReopenedStatus');
- $all_good = $all_good & run_column_check('statuses', 'IsDefaultStaffReplyStatus');
- $all_good = $all_good & run_column_check('statuses', 'LockedTicketStatus');
- $all_good = $all_good & run_column_check('statuses', 'IsAutocloseOption');
- $all_good = $all_good & run_column_check('statuses', 'Closable');
+ $all_good &= run_column_check('statuses', 'ID');
+ $all_good &= run_column_check('statuses', 'TextColor');
+ $all_good &= run_column_check('statuses', 'IsNewTicketStatus');
+ $all_good &= run_column_check('statuses', 'IsClosed');
+ $all_good &= run_column_check('statuses', 'IsClosedByClient');
+ $all_good &= run_column_check('statuses', 'IsCustomerReplyStatus');
+ $all_good &= run_column_check('statuses', 'IsStaffClosedOption');
+ $all_good &= run_column_check('statuses', 'IsStaffReopenedStatus');
+ $all_good &= run_column_check('statuses', 'IsDefaultStaffReplyStatus');
+ $all_good &= run_column_check('statuses', 'LockedTicketStatus');
output_header_row('1.5.0');
- $all_good = $all_good & run_column_check('users', 'active');
- $all_good = $all_good & run_column_check('users', 'notify_note_unassigned');
+ $all_good &= run_column_check('users', 'active');
+ $all_good &= run_column_check('users', 'notify_note_unassigned');
output_header_row('1.6.0');
- $all_good = $all_good & run_table_check('settings');
+ $all_good &= run_table_check('settings');
output_header_row('1.7.0');
- $all_good = $all_good & run_table_check('verified_emails');
- $all_good = $all_good & run_table_check('pending_verification_emails');
- $all_good = $all_good & run_table_check('stage_tickets');
+ $all_good &= run_table_check('verified_emails');
+ $all_good &= run_table_check('pending_verification_emails');
+ $all_good &= run_table_check('stage_tickets');
+ output_header_row('2.2.0');
+ $all_good &= run_column_check('statuses', 'IsAutocloseOption');
+ $all_good &= run_column_check('statuses', 'Closable');
output_header_row('2.3.0');
- $all_good = $all_good & run_column_check('service_messages', 'icon');
- $all_good = $all_good & run_column_check('statuses', 'Key');
- $all_good = $all_good & run_column_check('tickets', 'latitude');
- $all_good = $all_good & run_column_check('tickets', 'longitude');
- $all_good = $all_good & run_column_check('stage_tickets', 'latitude');
- $all_good = $all_good & run_column_check('stage_tickets', 'longitude');
- $all_good = $all_good & run_column_check('categories', 'manager');
- $all_good = $all_good & run_column_check('users', 'permission_template');
- $all_good = $all_good & run_table_check('permission_templates');
- $all_good = $all_good & run_column_check('permission_templates', 'id');
- $all_good = $all_good & run_column_check('permission_templates', 'name');
- $all_good = $all_good & run_column_check('permission_templates', 'heskprivileges');
- $all_good = $all_good & run_column_check('permission_templates', 'categories');
+ $all_good &= run_column_check('service_messages', 'icon');
+ $all_good &= run_column_check('statuses', 'Key');
+ $all_good &= run_column_check('tickets', 'latitude');
+ $all_good &= run_column_check('tickets', 'longitude');
+ $all_good &= run_column_check('stage_tickets', 'latitude');
+ $all_good &= run_column_check('stage_tickets', 'longitude');
+ $all_good &= run_column_check('categories', 'manager');
+ $all_good &= run_column_check('users', 'permission_template');
+ $all_good &= run_table_check('permission_templates');
+ $all_good &= run_column_check('permission_templates', 'id');
+ $all_good &= run_column_check('permission_templates', 'name');
+ $all_good &= run_column_check('permission_templates', 'heskprivileges');
+ $all_good &= run_column_check('permission_templates', 'categories');
output_header_row('2.4.0');
- $all_good = $all_good & run_table_check('quick_help_sections');
- $all_good = $all_good & run_column_check('quick_help_sections', 'id');
- $all_good = $all_good & run_column_check('quick_help_sections', 'location');
- $all_good = $all_good & run_column_check('quick_help_sections', 'show');
- $all_good = $all_good & run_table_check('text_to_status_xref');
- $all_good = $all_good & run_column_check('text_to_status_xref', 'id');
- $all_good = $all_good & run_column_check('text_to_status_xref', 'language');
- $all_good = $all_good & run_column_check('text_to_status_xref', 'text');
- $all_good = $all_good & run_column_check('text_to_status_xref', 'status_id');
- $all_good = $all_good & run_column_check('statuses', 'sort');
- $all_good = $all_good & run_column_check('attachments', 'download_count');
- $all_good = $all_good & run_column_check('kb_attachments', 'download_count');
- $all_good = $all_good & run_column_check('tickets', 'html');
- $all_good = $all_good & run_column_check('stage_tickets', 'html');
- $all_good = $all_good & run_column_check('replies', 'html');
+ $all_good &= run_table_check('quick_help_sections');
+ $all_good &= run_column_check('quick_help_sections', 'id');
+ $all_good &= run_column_check('quick_help_sections', 'location');
+ $all_good &= run_column_check('quick_help_sections', 'show');
+ $all_good &= run_table_check('text_to_status_xref');
+ $all_good &= run_column_check('text_to_status_xref', 'id');
+ $all_good &= run_column_check('text_to_status_xref', 'language');
+ $all_good &= run_column_check('text_to_status_xref', 'text');
+ $all_good &= run_column_check('text_to_status_xref', 'status_id');
+ $all_good &= run_column_check('statuses', 'sort');
+ $all_good &= run_column_check('attachments', 'download_count');
+ $all_good &= run_column_check('kb_attachments', 'download_count');
+ $all_good &= run_column_check('tickets', 'html');
+ $all_good &= run_column_check('stage_tickets', 'html');
+ $all_good &= run_column_check('replies', 'html');
output_header_row('2.5.0');
- $all_good = $all_good & run_column_check('tickets', 'user_agent');
- $all_good = $all_good & run_column_check('tickets', 'screen_resolution_width');
- $all_good = $all_good & run_column_check('tickets', 'screen_resolution_height');
- $all_good = $all_good & run_column_check('stage_tickets', 'user_agent');
- $all_good = $all_good & run_column_check('stage_tickets', 'screen_resolution_width');
- $all_good = $all_good & run_column_check('stage_tickets', 'screen_resolution_height');
+ $all_good &= run_column_check('tickets', 'user_agent');
+ $all_good &= run_column_check('tickets', 'screen_resolution_width');
+ $all_good &= run_column_check('tickets', 'screen_resolution_height');
+ $all_good &= run_column_check('stage_tickets', 'user_agent');
+ $all_good &= run_column_check('stage_tickets', 'screen_resolution_width');
+ $all_good &= run_column_check('stage_tickets', 'screen_resolution_height');
output_header_row('2.6.0');
- $all_good = $all_good & run_table_check('logging');
- $all_good = $all_good & run_column_check('logging', 'id');
- $all_good = $all_good & run_column_check('logging', 'username');
- $all_good = $all_good & run_column_check('logging', 'message');
- $all_good = $all_good & run_column_check('logging', 'severity');
- $all_good = $all_good & run_column_check('logging', 'location');
- $all_good = $all_good & run_column_check('logging', 'timestamp');
- $all_good = $all_good & run_table_check('user_api_tokens');
- $all_good = $all_good & run_column_check('user_api_tokens', 'id');
- $all_good = $all_good & run_column_check('user_api_tokens', 'user_id');
- $all_good = $all_good & run_column_check('user_api_tokens', 'token');
- $all_good = $all_good & run_table_check('temp_attachment');
- $all_good = $all_good & run_column_check('temp_attachment', 'id');
- $all_good = $all_good & run_column_check('temp_attachment', 'file_name');
- $all_good = $all_good & run_column_check('temp_attachment', 'saved_name');
- $all_good = $all_good & run_column_check('temp_attachment', 'size');
- $all_good = $all_good & run_column_check('temp_attachment', 'type');
- $all_good = $all_good & run_column_check('temp_attachment', 'date_uploaded');
- $all_good = $all_good & run_table_check('calendar_event');
- $all_good = $all_good & run_column_check('calendar_event', 'id');
- $all_good = $all_good & run_column_check('calendar_event', 'start');
- $all_good = $all_good & run_column_check('calendar_event', 'end');
- $all_good = $all_good & run_column_check('calendar_event', 'all_day');
- $all_good = $all_good & run_column_check('calendar_event', 'name');
- $all_good = $all_good & run_column_check('calendar_event', 'location');
- $all_good = $all_good & run_column_check('calendar_event', 'comments');
- $all_good = $all_good & run_column_check('calendar_event', 'category');
- $all_good = $all_good & run_table_check('calendar_event_reminder');
- $all_good = $all_good & run_column_check('calendar_event_reminder', 'id');
- $all_good = $all_good & run_column_check('calendar_event_reminder', 'user_id');
- $all_good = $all_good & run_column_check('calendar_event_reminder', 'event_id');
- $all_good = $all_good & run_column_check('calendar_event_reminder', 'amount');
- $all_good = $all_good & run_column_check('calendar_event_reminder', 'unit');
- $all_good = $all_good & run_column_check('calendar_event_reminder', 'email_sent');
- $all_good = $all_good & run_column_check('tickets', 'due_date');
- $all_good = $all_good & run_column_check('tickets', 'overdue_email_sent');
- $all_good = $all_good & run_column_check('categories', 'usage');
- $all_good = $all_good & run_column_check('users', 'notify_overdue_unassigned');
- $all_good = $all_good & run_column_check('users', 'default_calendar_view');
+ $all_good &= run_table_check('logging');
+ $all_good &= run_column_check('logging', 'id');
+ $all_good &= run_column_check('logging', 'username');
+ $all_good &= run_column_check('logging', 'message');
+ $all_good &= run_column_check('logging', 'severity');
+ $all_good &= run_column_check('logging', 'location');
+ $all_good &= run_column_check('logging', 'timestamp');
+ $all_good &= run_table_check('user_api_tokens');
+ $all_good &= run_column_check('user_api_tokens', 'id');
+ $all_good &= run_column_check('user_api_tokens', 'user_id');
+ $all_good &= run_column_check('user_api_tokens', 'token');
+ $all_good &= run_table_check('temp_attachment');
+ $all_good &= run_column_check('temp_attachment', 'id');
+ $all_good &= run_column_check('temp_attachment', 'file_name');
+ $all_good &= run_column_check('temp_attachment', 'saved_name');
+ $all_good &= run_column_check('temp_attachment', 'size');
+ $all_good &= run_column_check('temp_attachment', 'type');
+ $all_good &= run_column_check('temp_attachment', 'date_uploaded');
+ $all_good &= run_table_check('calendar_event');
+ $all_good &= run_column_check('calendar_event', 'id');
+ $all_good &= run_column_check('calendar_event', 'start');
+ $all_good &= run_column_check('calendar_event', 'end');
+ $all_good &= run_column_check('calendar_event', 'all_day');
+ $all_good &= run_column_check('calendar_event', 'name');
+ $all_good &= run_column_check('calendar_event', 'location');
+ $all_good &= run_column_check('calendar_event', 'comments');
+ $all_good &= run_column_check('calendar_event', 'category');
+ $all_good &= run_table_check('calendar_event_reminder');
+ $all_good &= run_column_check('calendar_event_reminder', 'id');
+ $all_good &= run_column_check('calendar_event_reminder', 'user_id');
+ $all_good &= run_column_check('calendar_event_reminder', 'event_id');
+ $all_good &= run_column_check('calendar_event_reminder', 'amount');
+ $all_good &= run_column_check('calendar_event_reminder', 'unit');
+ $all_good &= run_column_check('calendar_event_reminder', 'email_sent');
+ $all_good &= run_column_check('tickets', 'due_date');
+ $all_good &= run_column_check('tickets', 'overdue_email_sent');
+ $all_good &= run_column_check('categories', 'usage');
+ $all_good &= run_column_check('users', 'notify_overdue_unassigned');
+ $all_good &= run_column_check('users', 'default_calendar_view');
output_header_row('2.6.2');
- $all_good = $all_good & run_column_check('stage_tickets', 'due_date');
- $all_good = $all_good & run_column_check('stage_tickets', 'overdue_email_sent');
+ $all_good &= run_column_check('stage_tickets', 'due_date');
+ $all_good &= run_column_check('stage_tickets', 'overdue_email_sent');
output_header_row('3.1.0');
- $all_good = $all_good & run_column_check('categories', 'background_color');
- $all_good = $all_good & run_column_check('categories', 'foreground_color');
- $all_good = $all_good & run_column_check('categories', 'display_border_outline');
- $all_good = $all_good & run_column_check('logging', 'stack_trace');
- $all_good = $all_good & run_table_check('custom_nav_element');
- $all_good = $all_good & run_column_check('custom_nav_element', 'id');
- $all_good = $all_good & run_column_check('custom_nav_element', 'image_url');
- $all_good = $all_good & run_column_check('custom_nav_element', 'font_icon');
- $all_good = $all_good & run_column_check('custom_nav_element', 'place');
- $all_good = $all_good & run_column_check('custom_nav_element', 'url');
- $all_good = $all_good & run_column_check('custom_nav_element', 'sort');
- $all_good = $all_good & run_table_check('custom_nav_element_to_text');
- $all_good = $all_good & run_column_check('custom_nav_element_to_text', 'id');
- $all_good = $all_good & run_column_check('custom_nav_element_to_text', 'nav_element_id');
- $all_good = $all_good & run_column_check('custom_nav_element_to_text', 'language');
- $all_good = $all_good & run_column_check('custom_nav_element_to_text', 'text');
- $all_good = $all_good & run_column_check('custom_nav_element_to_text', 'subtext');
- $all_good = $all_good & run_setting_check('admin_navbar_background');
- $all_good = $all_good & run_setting_check('admin_navbar_background_hover');
- $all_good = $all_good & run_setting_check('admin_navbar_text');
- $all_good = $all_good & run_setting_check('admin_navbar_text_hover');
- $all_good = $all_good & run_setting_check('admin_navbar_brand_background');
- $all_good = $all_good & run_setting_check('admin_navbar_brand_background_hover');
- $all_good = $all_good & run_setting_check('admin_navbar_brand_text');
- $all_good = $all_good & run_setting_check('admin_navbar_brand_text_hover');
- $all_good = $all_good & run_setting_check('admin_sidebar_background');
- $all_good = $all_good & run_setting_check('admin_sidebar_background_hover');
- $all_good = $all_good & run_setting_check('admin_sidebar_text');
- $all_good = $all_good & run_setting_check('admin_sidebar_text_hover');
- $all_good = $all_good & run_setting_check('admin_sidebar_font_weight');
- $all_good = $all_good & run_setting_check('admin_sidebar_header_background');
- $all_good = $all_good & run_setting_check('admin_sidebar_header_text');
+ $all_good &= run_column_check('categories', 'background_color');
+ $all_good &= run_column_check('categories', 'foreground_color');
+ $all_good &= run_column_check('categories', 'display_border_outline');
+ $all_good &= run_column_check('logging', 'stack_trace');
+ $all_good &= run_table_check('custom_nav_element');
+ $all_good &= run_column_check('custom_nav_element', 'id');
+ $all_good &= run_column_check('custom_nav_element', 'image_url');
+ $all_good &= run_column_check('custom_nav_element', 'font_icon');
+ $all_good &= run_column_check('custom_nav_element', 'place');
+ $all_good &= run_column_check('custom_nav_element', 'url');
+ $all_good &= run_column_check('custom_nav_element', 'sort');
+ $all_good &= run_table_check('custom_nav_element_to_text');
+ $all_good &= run_column_check('custom_nav_element_to_text', 'id');
+ $all_good &= run_column_check('custom_nav_element_to_text', 'nav_element_id');
+ $all_good &= run_column_check('custom_nav_element_to_text', 'language');
+ $all_good &= run_column_check('custom_nav_element_to_text', 'text');
+ $all_good &= run_column_check('custom_nav_element_to_text', 'subtext');
+ $all_good &= run_setting_check('admin_navbar_background');
+ $all_good &= run_setting_check('admin_navbar_background_hover');
+ $all_good &= run_setting_check('admin_navbar_text');
+ $all_good &= run_setting_check('admin_navbar_text_hover');
+ $all_good &= run_setting_check('admin_navbar_brand_background');
+ $all_good &= run_setting_check('admin_navbar_brand_background_hover');
+ $all_good &= run_setting_check('admin_navbar_brand_text');
+ $all_good &= run_setting_check('admin_navbar_brand_text_hover');
+ $all_good &= run_setting_check('admin_sidebar_background');
+ $all_good &= run_setting_check('admin_sidebar_background_hover');
+ $all_good &= run_setting_check('admin_sidebar_text');
+ $all_good &= run_setting_check('admin_sidebar_text_hover');
+ $all_good &= run_setting_check('admin_sidebar_font_weight');
+ $all_good &= run_setting_check('admin_sidebar_header_background');
+ $all_good &= run_setting_check('admin_sidebar_header_text');
output_header_row('3.2.0');
$all_good &= run_table_check('audit_trail');
$all_good &= run_table_check('audit_trail_to_replacement_values');
$all_good &= run_column_check('categories', 'mfh_description');
$all_good &= run_column_check('custom_fields', 'mfh_description');
+ $all_good &= run_setting_check('migrationNumber');
if ($all_good) {
echo "";
diff --git a/install/js/uninstall-script.js b/install/js/uninstall-script.js
new file mode 100644
index 00000000..5e088c8d
--- /dev/null
+++ b/install/js/uninstall-script.js
@@ -0,0 +1,157 @@
+var steps = [
+ {
+ name: 'intro',
+ text: 'Uninstall',
+ callback: undefined
+ },
+ {
+ name: 'db-confirm',
+ text: 'Confirm the information below',
+ callback: undefined
+ },
+ {
+ name: 'uninstall',
+ text: 'Uninstalling...',
+ showBack: false,
+ showNext: false,
+ callback: uninstall
+ },
+ {
+ name: 'complete',
+ text: 'Uninstall Process Complete',
+ showBack: false,
+ callback: undefined
+ }
+];
+
+$(document).ready(function() {
+ var currentStep = 0;
+
+ $('#next-button').click(function() {
+ goToStep(++currentStep);
+ });
+
+ $('#back-button').click(function() {
+ goToStep(--currentStep);
+ });
+});
+
+function goToStep(step) {
+ $('[data-step]').hide();
+ $('[data-step="' + steps[step].name + '"]').show();
+
+ if (step === 0) {
+ $('#tools-button').show();
+ $('#back-button').hide();
+ } else {
+ $('#tools-button').hide();
+ $('#back-button').show();
+ }
+
+ if (step === steps.length - 1) {
+ $('#next-button').hide();
+ } else {
+ $('#next-button').show();
+ }
+
+ // Back/Next button overrides
+ if (steps[step].showBack !== undefined && !steps[step].showBack) {
+ $('#back-button').hide();
+ }
+ if (steps[step].showNext !== undefined && !steps[step].showNext) {
+ console.log('hiding this');
+ $('#next-button').hide();
+ }
+
+ $('#header-text').text(steps[step].text);
+
+ if (steps[step].callback !== undefined) {
+ steps[step].callback();
+ }
+}
+
+function uninstall() {
+ var startingMigrationNumber = parseInt($('input[name="starting-migration-number"]').val());
+
+ var heskPath = $('p#hesk-path').text();
+
+ $.ajax({
+ url: heskPath + 'install/ajax/get-migration-ajax.php',
+ method: 'GET',
+ success: function(data) {
+ data = JSON.parse(data);
+
+ $('[data-step="install-or-update"] > #spinner').hide();
+ $('[data-step="install-or-update"] > .progress').show();
+
+ // Recursive call that will increment by 1 each time
+ executeMigration(startingMigrationNumber, 1, 'down');
+ }
+ })
+}
+
+function executeMigration(migrationNumber, latestMigrationNumber, direction) {
+ var heskPath = $('p#hesk-path').text();
+
+ $.ajax({
+ url: heskPath + 'install/ajax/process-migration.php',
+ method: 'POST',
+ data: JSON.stringify({
+ migrationNumber: migrationNumber,
+ direction: direction
+ }),
+ success: function(data) {
+ console.log('migrationNumber: ' + migrationNumber);
+ console.log('latestMigrationNumber: ' + latestMigrationNumber);
+ console.info('---');
+ if (migrationNumber === latestMigrationNumber || (migrationNumber === 1 && direction === 'down')) {
+ updateProgressBar(migrationNumber, latestMigrationNumber, direction === 'down', true);
+ console.log('%c Success! ', 'color: white; background-color: green; font-size: 2em');
+ } else {
+ updateProgressBar(migrationNumber, latestMigrationNumber, false, false);
+ var newMigrationNumber = direction === 'up' ? migrationNumber + 1 : migrationNumber - 1;
+ executeMigration(newMigrationNumber, latestMigrationNumber, direction);
+ }
+ },
+ error: function(response) {
+ try {
+ message = JSON.parse(response);
+ } catch (e) {
+ message = response.responseText;
+ }
+ $errorBlock = $('#error-block');
+ $errorBlock.html($errorBlock.html() + "
An error occurred! (Error Code: " + migrationNumber + ")
" + message).show();
+
+ updateProgressBar(migrationNumber, latestMigrationNumber, true, false);
+
+ if (direction === 'up') {
+ // Revert!
+ executeMigration(migrationNumber - 1, latestMigrationNumber, 'down');
+ } else {
+ console.error("I even failed to roll back. Yikes! :'(");
+ }
+ console.error(message);
+ }
+ })
+}
+
+function updateProgressBar(migrationNumber, latestMigrationNumber, isError, isFinished) {
+ var $progressBar = $('#progress-bar');
+
+ if (isError === true) {
+ $progressBar.find('.progress-bar').removeClass('progress-bar-success')
+ .addClass('progress-bar-danger');
+
+ if (isFinished) {
+ var $errorBlock = $('#error-block');
+ $errorBlock.html($errorBlock.html() + '
Successfully reverted database to before uninstalling.');
+ }
+ } else {
+ var percentage = Math.round(migrationNumber / latestMigrationNumber * 100);
+ $progressBar.find('.progress-bar').css('width', percentage + '%');
+ }
+
+ if (isFinished && !isError) {
+ goToStep(steps.length - 1);
+ }
+}
\ No newline at end of file
diff --git a/install/mods-for-hesk/js/uninstall-scripts.js b/install/mods-for-hesk/js/uninstall-scripts.js
deleted file mode 100644
index bf896f34..00000000
--- a/install/mods-for-hesk/js/uninstall-scripts.js
+++ /dev/null
@@ -1,102 +0,0 @@
-function getTasks() {
- return ['status-change', 'drop-columns'];
-}
-
-function processUninstallation() {
- var tasks = getTasks();
- //-- Change status column to default HESK values
- tasks.forEach(function (task) {
- startUninstallation(task);
- executeUninstallation(task);
- });
-}
-function startUninstallation(task) {
- $('#spinner-' + task)
- .removeClass('fa-exclamation-triangle')
- .addClass('fa-spinner')
- .addClass('fa-pulse');
- changeRowTo('row', task, 'info');
- changeTextTo('span', task, 'In Progress');
-}
-
-function changeTextTo(prefix, task, text) {
- $('#' + prefix + '-' + task).text(text);
-}
-
-function changeRowTo(prefix, task, clazz) {
- //-- Remove all classes
- $('#' + prefix + '-' + task)
- .removeClass('info')
- .removeClass('warning')
- .removeClass('danger')
- .removeClass('success');
-
- //-- Re-add the requested class
- $('#' + prefix + '-' + task).addClass(clazz);
-}
-
-function executeUninstallation(task) {
- appendToInstallConsole('
INFO Starting task code: ' + task + ' ');
- $.ajax({
- type: 'POST',
- url: 'ajax/uninstall-database-ajax.php',
- data: {task: task},
- success: function (data) {
- markUninstallAsSuccess(task);
- checkForCompletion();
- },
- error: function (data) {
- if (data.status == 400) {
- appendToInstallConsole('
ERROR The task ' + task + '
was not recognized. Check the value submitted and try again. ');
- } else {
- appendToInstallConsole('
ERROR ' + data.responseText + ' ');
- }
- markUninstallAsFailure(task);
- }
- });
-}
-
-function checkForCompletion() {
- // If all rows have a .success row, installation is finished
- var numberOfTasks = getTasks().length;
- var numberOfCompletions = $('tr.success').length;
- if (numberOfTasks == numberOfCompletions) {
- uninstallationFinished();
- }
-}
-
-function uninstallationFinished() {
- appendToInstallConsole('
SUCCESS Uninstallation complete ');
- var output = '
' +
- '
' +
- '
' +
- '
Awesome! The automated portion of uninstalling Mods for HESK has completed. ' +
- 'Please follow these instructions ' +
- 'on the Mods for HESK website to finish uninstallation. ' +
- '
' +
- '
';
- $('#uninstall-information').html(output);
-}
-
-function markUninstallAsSuccess(task) {
- removeSpinner(task);
- $('#spinner-' + task).addClass('fa-check-circle');
- changeTextTo('span', task, 'Completed Successfully');
- changeRowTo('row', task, 'success');
- appendToInstallConsole('
SUCCESS Uninstall for task code: ' + task + '
complete ');
-}
-
-function markUninstallAsFailure(task) {
- removeSpinner(task);
- $('#spinner-' + task).addClass('fa-times-circle');
- changeRowTo('row', task, 'danger');
- changeTextTo('span', task, 'Uninstall failed! Check the console for more information');
-}
-
-function removeSpinner(task) {
- $('#spinner-' + task)
- .removeClass('fa-pulse')
- .removeClass('fa-spinner');
-}
-
-jQuery(document).ready(loadJquery);
\ No newline at end of file
diff --git a/install/mods-for-hesk/uninstallModsForHesk.php b/install/mods-for-hesk/uninstallModsForHesk.php
deleted file mode 100644
index 2f6bc4c9..00000000
--- a/install/mods-for-hesk/uninstallModsForHesk.php
+++ /dev/null
@@ -1,86 +0,0 @@
-';
- echo '
' . $text . ' ';
- echo '
Waiting... ';
- echo '';
-}
-
-?>
-
-
-
Uninstalling Mods for HESK
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Uninstallation Progress
-
-
-
-
-
-
-
-
Console
-
-
-
-
- Severity
- Message
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/install/uninstall.php b/install/uninstall.php
new file mode 100644
index 00000000..7fd08339
--- /dev/null
+++ b/install/uninstall.php
@@ -0,0 +1,177 @@
+ 0) {
+ // They have installed at LEAST to version 1.6.0. Just pull the version number OR migration number
+ $migrationNumberSql = hesk_dbQuery("SELECT `Value` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'migrationNumber'");
+ if ($migrationRow = hesk_dbFetchAssoc($migrationNumberSql)) {
+ $startingMigrationNumber = intval($migrationRow['Value']);
+ } else {
+ $versionSql = hesk_dbQuery("SELECT `Value` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` WHERE `Key` = 'modsForHeskVersion'");
+ $versionRow = hesk_dbFetchAssoc($versionSql);
+
+ $migration_map = array(
+ // Pre-1.4.0 to 1.5.0 did not have a settings table
+ '1.6.0' => 15, '1.6.1' => 16, '1.7.0' => 20, '2.0.0' => 26, '2.0.1' => 27, '2.1.0' => 28, '2.1.1' => 30,
+ '2.2.0' => 33, '2.2.1' => 34, '2.3.0' => 40, '2.3.1' => 41, '2.3.2' => 42, '2.4.0' => 47, '2.4.1' => 48,
+ '2.4.2' => 49, '2.5.0' => 53, '2.5.1' => 54, '2.5.2' => 55, '2.5.3' => 56, '2.5.4' => 57, '2.5.5' => 58,
+ '2.6.0' => 65, '2.6.1' => 66, '2.6.2' => 68, '2.6.3' => 69, '2.6.4' => 70, '3.0.0' => 74, '3.0.1' => 75,
+ '3.0.2' => 77, '3.0.3' => 78, '3.0.4' => 79, '3.0.5' => 80, '3.0.6' => 81, '3.0.7' => 82, '3.1.0' => 89,
+ '3.1.1' => 90
+ );
+ $startingMigrationNumber = $migration_map[$versionRow['Value']];
+ }
+} else {
+ // migration # => sql for checking
+ $versionChecks = array(
+ // 1.5.0 -> users.active
+ 8 => "SHOW COLUMNS FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` LIKE 'active'",
+ // 1.4.1 -> denied_emails
+ 5 => "SHOW TABLES LIKE '" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_emails'",
+ // 1.4.0 -> denied ips
+ 3 => "SHOW TABLES LIKE '" . hesk_dbEscape($hesk_settings['db_pfix']) . "denied_ips'",
+ // Pre-1.4.0 but still something -> statuses
+ 1 => "SHOW TABLES LIKE '" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses'"
+ );
+
+ foreach ($versionChecks as $migrationNumber => $sql) {
+ $rs = hesk_dbQuery($sql);
+ if (hesk_dbNumRows($rs) > 0) {
+ $startingMigrationNumber = $migrationNumber;
+ break;
+ }
+ }
+}
+?>
+
+
+
Mods for HESK Install / Upgrade
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
I hoped you wouldn't be here, but let's continue anyway. ðŸ˜
+
+
+
+ Submit anonymous usage statistics
+
+
+
+
+
+
+
+ Database Information / File Permissions
+
+
+
+
+ Database Host:
+
+ Database Name:
+
+
+
+ Database User:
+
+ Database Password:
+
+
+
+ Database Prefix:
+
+
+
+
+
+
+
+
+
+
+
Initializing...
+
+
+
+
+
+
+
+
+
+
Make sure to delete your /install
folder.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Are you sure you want to uninstall Mods for HESK?
+
+
+
+
+
+
+
+
\ No newline at end of file