mirror of
https://github.com/itflow-org/itflow
synced 2026-12-02 00:59:03 +00:00
27 lines
1.3 KiB
PHP
27 lines
1.3 KiB
PHP
<?php
|
|
|
|
/*
|
|
* ITFlow - Database update to version 4.3.1 (from 4.3.0)
|
|
* Included by admin/database_updates.php - do not access directly
|
|
*
|
|
* The mail passwords, OAuth secret and tokens are encrypted (functions/mail_secret.php): the password and secret
|
|
* columns made wide enough for an encrypted value, then those saved as typed encrypted - when config.php has a
|
|
* backup key, or one can be added to it. Without one they stay as they are, and the nightly job tries again.
|
|
*
|
|
* Re-runnable: a column is widened only while it is narrower, and a value is encrypted only once.
|
|
*/
|
|
|
|
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
|
|
|
|
foreach (['config_smtp_password', 'config_imap_password', 'config_mail_oauth_client_secret'] as $itflow_column) {
|
|
$itflow_width = mysqli_fetch_row(mysqli_query($mysqli, "SELECT CHARACTER_MAXIMUM_LENGTH FROM information_schema.COLUMNS
|
|
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'settings' AND COLUMN_NAME = '$itflow_column' LIMIT 1"));
|
|
if ($itflow_width && intval($itflow_width[0]) < 500) {
|
|
mysqli_query($mysqli, "ALTER TABLE `settings` MODIFY `$itflow_column` varchar(500) DEFAULT NULL");
|
|
}
|
|
}
|
|
|
|
if (function_exists('mailSecretsSealAll')) {
|
|
mailSecretsSealAll(true);
|
|
}
|