Update the database validator

merge-requests/61/head
Mike Koch 7 年前
父節點 028be8d187
當前提交 5960afd237

@ -65,21 +65,21 @@ 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 = $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');
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 = $all_good & run_column_check('users', 'active');
$all_good = $all_good & run_column_check('users', 'notify_note_unassigned');
output_header_row('1.6.0');
$all_good = $all_good & run_table_check('settings');
output_header_row('1.7.0');
@ -87,88 +87,103 @@ hesk_dbConnect();
$all_good = $all_good & run_table_check('pending_verification_emails');
$all_good = $all_good & run_table_check('stage_tickets');
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_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 = $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');
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_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 = $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');
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 = $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');
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_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_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_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_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`');
// Changed in 3.1.0
//$all_good = $all_good & run_column_check('categories', '`color`');
$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 = $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');
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 = $all_good & run_column_check('stage_tickets', 'due_date');
$all_good = $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');
if ($all_good) {
echo "<script>$('#all-good').show()</script>";
@ -196,7 +211,7 @@ function run_column_check($table_name, $column_name) {
output_result('<b>Table Exists</b>: ' . $table_name,
$all_good);
} else {
$all_good = run_check('SELECT ' . $column_name . ' FROM `' . $hesk_settings['db_pfix'] . $table_name . '` LIMIT 1');
$all_good = run_check('SELECT `' . $column_name . '` FROM `' . $hesk_settings['db_pfix'] . $table_name . '` LIMIT 1');
output_result('<b>Column Exists</b>: ' . $table_name . '.' . $column_name,
$all_good);
}

載入中…
取消
儲存