Skip to content

Commit

Permalink
Fixing #5660 - Unknown System Hash Warning
Browse files Browse the repository at this point in the history
Warning about unknown system hash during the update
  • Loading branch information
TheWitness committed Feb 3, 2024
1 parent 60043cb commit 2c961b1
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Cacti CHANGELOG
-issue#5648: Fractional time offsets can cause huge webserver error-logs
-issue#5649: Inapprorpiate use of PHP_OS in lib/ping.php on Windows Platform
-issue#5655: Function get_allowed_devices can returns incorrect device list if session user_id variable is not set
-issue#5660: Warning about unknown system hash during the update
-issue#5661: On Linux and *NIX variants Cacti is unable to find ping6 as it's not in the path

1.2.26
Expand Down
33 changes: 33 additions & 0 deletions install/upgrades/1_2_27.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2004-2024 The Cacti Group |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
| Cacti: The Complete RRDTool-based Graphing Solution |
+-------------------------------------------------------------------------+
| This code is designed, written, and maintained by the Cacti Group. See |
| about.php and/or the AUTHORS file for specific developer information. |
+-------------------------------------------------------------------------+
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
*/

function upgrade_to_1_2_27() {
$data_input_field_id = db_fetch_cell_prepared('SELECT id FROM data_input_fields WHERE hash = ?', array('35637c344d84d8aa3a4dc50e4a120b3f'));

if ($data_input_field_id > 0) {
db_execute_prepared('DELETE FROM data_input_fields WHERE id = ?', array($data_input_field_id));
db_execute_prepared('DELETE FROM data_input_data WHERE data_input_field_id = ?', array($data_input_field_id));
}
}

15 changes: 15 additions & 0 deletions lib/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6836,6 +6836,21 @@ function repair_system_data_input_methods($step = 'import') {
}

db_execute_prepared('DELETE FROM data_input_fields WHERE hash = ?', array($bhash['hash']));
} elseif ($bhash['hash'] == '35637c344d84d8aa3a4dc50e4a120b3f') {
$data_input_field_id = db_fetch_cell_prepared('SELECT *
FROM data_input_fields
WHERE hash = ?',
array('35637c344d84d8aa3a4dc50e4a120b3f'));

if ($data_input_field_id > 0) {
db_execute_prepared('DELETE FROM data_input_fields
WHERE id = ?',
array($data_input_field_id));

db_execute_prepared('DELETE FROM data_input_data
WHERE data_input_field_id = ?',
array($data_input_field_id));
}
} else {
cacti_log('WARNING: Could not find Cacti default matching hash for unknown system hash "' . $bhash['hash'] . '" for ' . $data_input_id . '. No repair performed.');
}
Expand Down

0 comments on commit 2c961b1

Please sign in to comment.