mirror of
https://github.com/itflow-org/itflow
synced 2026-12-04 01:59:00 +00:00
30 lines
1.6 KiB
PHP
30 lines
1.6 KiB
PHP
<?php
|
|
|
|
/*
|
|
* ITFlow - Database update to version 4.4.3 (from 4.4.2)
|
|
* Included by admin/database_updates.php - do not access directly
|
|
*
|
|
* Knowledge Base articles written in Markdown (functions/kb.php, as documents are - database 4.2.3):
|
|
* kb_articles.kb_article_markdown - what a Markdown article says, as it was written; NULL for an
|
|
* article written in the rich text editor. kb_article_content stays the HTML every page shows -
|
|
* the article, the client portal, the public help center, search, ticket replies, its PDF -
|
|
* rendered from it each time it is saved
|
|
* kb_article_versions.kb_article_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_kb_markdown_columns = [
|
|
['kb_articles', 'kb_article_markdown', "longtext DEFAULT NULL AFTER `kb_article_content_raw`"],
|
|
['kb_article_versions', 'kb_article_version_markdown', "longtext DEFAULT NULL AFTER `kb_article_version_content`"],
|
|
];
|
|
foreach ($itflow_kb_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");
|
|
}
|
|
}
|