mirror of
https://github.com/itflow-org/itflow
synced 2026-12-05 18:49:01 +00:00
34 lines
1.7 KiB
PHP
34 lines
1.7 KiB
PHP
<?php
|
|
|
|
/*
|
|
* ITFlow - Database update to version 4.4.4 (from 4.4.3)
|
|
* Included by admin/database_updates.php - do not access directly
|
|
*
|
|
* Warranty lookup (functions/warranty.php) - an asset's warranty end and purchase date filled from
|
|
* its serial number, by its manufacturer (Admin > Warranty Lookup):
|
|
* settings.config_warranty_dell_client_id / _secret - a Dell TechDirect Warranty API key; the
|
|
* secret sealed (secretSeal(), 'warranty')
|
|
* settings.config_warranty_hp_client_id / _secret - an HP Warranty API key, the same
|
|
* settings.config_warranty_lenovo - Lenovo serials looked up on Lenovo's support site, which needs
|
|
* no key; on by default
|
|
*
|
|
* Re-runnable: each column is added only where it isn't there.
|
|
*/
|
|
|
|
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
|
|
|
|
$itflow_warranty_columns = [
|
|
['config_warranty_dell_client_id', "varchar(200) DEFAULT NULL"],
|
|
['config_warranty_dell_client_secret', "text DEFAULT NULL"],
|
|
['config_warranty_hp_client_id', "varchar(200) DEFAULT NULL"],
|
|
['config_warranty_hp_client_secret', "text DEFAULT NULL"],
|
|
['config_warranty_lenovo', "tinyint(1) NOT NULL DEFAULT 1"],
|
|
];
|
|
foreach ($itflow_warranty_columns as [$itflow_column, $itflow_definition]) {
|
|
$itflow_column_exists = mysqli_query($mysqli, "SELECT 1 FROM information_schema.COLUMNS
|
|
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'settings' AND COLUMN_NAME = '$itflow_column' LIMIT 1");
|
|
if (!$itflow_column_exists || mysqli_num_rows($itflow_column_exists) === 0) {
|
|
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `$itflow_column` $itflow_definition");
|
|
}
|
|
}
|