Files
itflow/admin/database_updates/4.2.7.php

29 lines
1.5 KiB
PHP

<?php
/*
* ITFlow - Database update to version 4.2.7 (from 4.2.6)
* Included by admin/database_updates.php - do not access directly
*
* A client's reply by email from someone who isn't one of the client's contacts - a watcher, or
* the person whose email raised a ticket with no client - is a client reply now, not an internal
* note with a warning. Who it came from is kept with it, as there is no contact to name:
* ticket_replies.ticket_reply_from_name - the name in its From line, or NULL
* ticket_replies.ticket_reply_from_email - its address, or NULL for every other reply
*
* Re-runnable: each column is added only where it isn't there.
*/
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
$itflow_from_columns = [
['ticket_replies', 'ticket_reply_from_name', "varchar(200) DEFAULT NULL AFTER `ticket_reply_by`"],
['ticket_replies', 'ticket_reply_from_email', "varchar(255) DEFAULT NULL AFTER `ticket_reply_from_name`"],
];
foreach ($itflow_from_columns as [$itflow_table, $itflow_column, $itflow_definition]) {
$itflow_column_exists = mysqli_query($mysqli, "SELECT 1 FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = '$itflow_table' AND COLUMN_NAME = '$itflow_column' LIMIT 1");
if (!$itflow_column_exists || mysqli_num_rows($itflow_column_exists) === 0) {
mysqli_query($mysqli, "ALTER TABLE `$itflow_table` ADD `$itflow_column` $itflow_definition");
}
}