mirror of
https://github.com/itflow-org/itflow
synced 2026-12-02 09:09:01 +00:00
32 lines
1.8 KiB
PHP
32 lines
1.8 KiB
PHP
<?php
|
|
|
|
/*
|
|
* ITFlow - Database update to version 4.2.4 (from 4.2.3)
|
|
* Included by admin/database_updates.php - do not access directly
|
|
*
|
|
* Pictures in a ticket's text kept as the ticket's files (functions/ticket_pictures.php):
|
|
* ticket_attachments.ticket_attachment_inline - 1 for a picture shown in the ticket's details or
|
|
* a reply, which the ticket's list of files leaves out
|
|
* settings.config_ticket_pictures_ticket_id and config_ticket_pictures_reply_id - how far the
|
|
* Ticket Pictures cron job has got through the tickets and replies, moving pictures kept as
|
|
* data into files
|
|
*
|
|
* Nothing is moved here - the cron job does that a batch a minute, so a big install's update
|
|
* stays quick. Re-runnable: each column is added only where it isn't there.
|
|
*/
|
|
|
|
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
|
|
|
|
$itflow_picture_columns = [
|
|
['ticket_attachments', 'ticket_attachment_inline', "tinyint(1) NOT NULL DEFAULT 0 AFTER `ticket_attachment_reply_id`"],
|
|
['settings', 'config_ticket_pictures_ticket_id', "int(11) NOT NULL DEFAULT 0 AFTER `config_log_forward_tls_verify`"],
|
|
['settings', 'config_ticket_pictures_reply_id', "int(11) NOT NULL DEFAULT 0 AFTER `config_ticket_pictures_ticket_id`"],
|
|
];
|
|
foreach ($itflow_picture_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");
|
|
}
|
|
}
|