Handle columns in the table that may not exist

The old v_device_keys column device_profile_uuid is deprecated. It will exist on systems that were upgraded from an older version before the change was made.

The app default code here moves data from the old format to the newer one. This is useful for upgrades. Newer installs will not have this deprecated field in the device_keys and device_settings table.
This commit is contained in:
FusionPBX 2025-01-28 15:59:04 -07:00 committed by GitHub
parent 42a1625daa
commit fe0680f9b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 75 additions and 70 deletions

View File

@ -77,6 +77,7 @@ if ($domains_processed == 1) {
unset($sql, $device_keys);
//set the device profile keys
if ($database->column_exists('v_device_keys', 'device_profile_uuid')) {
$sql = "select count(*) from v_device_profile_keys ";
$num_rows = $database->select($sql, null, 'column');
if ($num_rows == 0) {
@ -119,8 +120,10 @@ if ($domains_processed == 1) {
}
}
unset($sql, $device_profile_keys);
}
//set the device profile settings
if ($database->column_exists('v_device_settings', 'device_profile_uuid')) {
$sql = "select count(*) from v_device_profile_settings ";
$num_rows = $database->select($sql, null, 'column');
if ($num_rows == 0) {
@ -157,6 +160,7 @@ if ($domains_processed == 1) {
}
}
unset($sql, $device_profile_keys);
}
//add device vendor functions to the database
$sql = "select count(*) from v_device_vendors; ";
@ -247,6 +251,7 @@ if ($domains_processed == 1) {
$sql = "update v_device_lines set label = display_name where label is null;\n";
$database->execute($sql);
unset($sql);
}
?>