initial commit; version 22.5.12042
This commit is contained in:
36
update/415.php
Normal file
36
update/415.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Observium
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage update
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT * FROM `devices_locations` WHERE 1";
|
||||
$sql .= generate_query_values(['Unknown', ''], 'location_country', '!=');
|
||||
$devices_locations = dbFetchRows($sql);
|
||||
|
||||
if (count($devices_locations))
|
||||
{
|
||||
echo 'Unificate GEO Country names: ';
|
||||
|
||||
foreach ($devices_locations as $entry)
|
||||
{
|
||||
|
||||
$country = country_from_code($entry['location_country']);
|
||||
if ($country != $entry['location_country'])
|
||||
{
|
||||
$update_array = ['location_country' => $country,
|
||||
'location_updated' => $entry['location_updated']]; // Keep updated timestamp
|
||||
dbUpdate($update_array, 'devices_locations', '`location_id` = ?', [$entry['location_id']]);
|
||||
echo('.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
Reference in New Issue
Block a user