Files
itflow/admin/database_updates/4.3.4.php

33 lines
1.8 KiB
PHP

<?php
/*
* ITFlow - Database update to version 4.3.4 (from 4.3.3)
* Included by admin/database_updates.php - do not access directly
*
* settings.config_guest_link_days - how many days after a ticket is closed, an invoice paid or a quote answered or
* run out its link in emails keeps working (functions/guest_link.php): 0 (always), 30, 60, 90, 180 or 365 - 90
* email_templates - your own wording for the emails about a ticket to clients (functions/email_template.php): for
* each, by its key, its subject, heading, opening and closing text - NULL keeps ITFlow's own
*
* Re-runnable: the column is added and the table made only where they aren't there.
*/
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
$itflow_column_exists = mysqli_query($mysqli, "SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'settings' AND COLUMN_NAME = 'config_guest_link_days' LIMIT 1");
if (!$itflow_column_exists || mysqli_num_rows($itflow_column_exists) === 0) {
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_guest_link_days` smallint(5) NOT NULL DEFAULT 90 AFTER `config_share_require_protection`");
}
mysqli_query($mysqli, "CREATE TABLE IF NOT EXISTS `email_templates` (
`email_template_key` varchar(50) NOT NULL,
`email_template_subject` varchar(255) DEFAULT NULL,
`email_template_title` varchar(255) DEFAULT NULL,
`email_template_intro` text DEFAULT NULL,
`email_template_after` text DEFAULT NULL,
`email_template_updated_by` int(11) NOT NULL DEFAULT 0,
`email_template_updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`email_template_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci");