Files
itflow/admin/database_updates/4.2.3.php

29 lines
1.4 KiB
PHP

<?php
/*
* ITFlow - Database update to version 4.2.3 (from 4.2.2)
* Included by admin/database_updates.php - do not access directly
*
* Documents written in Markdown (functions/markdown.php):
* documents.document_markdown - what a Markdown document says, as it was written; NULL for a
* document written in the rich text editor. document_content stays the HTML every page
* shows, rendered from it each time it is saved
* document_versions.document_version_markdown - the same, for each earlier version
*
* Re-runnable: each column is added only where it isn't there.
*/
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
$itflow_markdown_columns = [
['documents', 'document_markdown', "longtext DEFAULT NULL AFTER `document_content_raw`"],
['document_versions', 'document_version_markdown', "longtext DEFAULT NULL AFTER `document_version_content`"],
];
foreach ($itflow_markdown_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");
}
}