mirror of
https://github.com/Cacti/cacti.git
synced 2026-11-09 14:02:54 +09:00
- Graphs included in aggregate that are removed are not managed properly - The associate and disassociate functions were not following proper API rules, they were leveraging request variables and redirecting using header(). - Aggregate was not properly handling nth percentile. It's now handling that correctly, though still has an issue with the actual value. This will be fixed separately. - Adding new convert to stacked line options for graph readability - Totalling when using Print showing legend items was also showing graph items, which is not correct. - When totalling, Aggregate was attempting to show a blank line, but due to an SQL format error, no blank line was displayed. - Typo in one aggregate function was not properly handling the GPRINT MIN graph item type
71 lines
2.9 KiB
PHP
71 lines
2.9 KiB
PHP
<?php
|
|
/*
|
|
+-------------------------------------------------------------------------+
|
|
| Copyright (C) 2004-2019 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_2() {
|
|
db_install_execute("ALTER TABLE poller_time MODIFY COLUMN id bigint(20) unsigned auto_increment");
|
|
|
|
// Find aggregates with orphaned items
|
|
$aggregates = array_rekey(
|
|
db_fetch_assoc('SELECT local_graph_id FROM aggregate_graphs'),
|
|
'local_graph_id', 'local_graph_id'
|
|
);
|
|
|
|
if (cacti_sizeof($aggregates)) {
|
|
foreach($aggregates as $a) {
|
|
$orphans = array_rekey(
|
|
db_fetch_assoc_prepared('SELECT local_data_id, COUNT(DISTINCT local_graph_id) AS graphs
|
|
FROM graph_templates_item AS gti
|
|
INNER JOIN data_template_rrd AS dtr
|
|
ON gti.task_item_id=dtr.id
|
|
WHERE dtr.local_data_id IN (
|
|
SELECT DISTINCT local_data_id
|
|
FROM graph_templates_item AS gti
|
|
INNER JOIN data_template_rrd AS dtr
|
|
ON gti.task_item_id=dtr.id
|
|
WHERE local_data_id > 0
|
|
AND gti.local_graph_id = ?
|
|
)
|
|
GROUP BY dtr.local_data_id
|
|
HAVING graphs = 1',
|
|
array($a)),
|
|
'local_data_id', 'local_data_id'
|
|
);
|
|
|
|
if (cacti_sizeof($orphans)) {
|
|
cacti_log('Found ' . cacti_sizeof($orphans) . ' orphaned Data Source(s) in Aggregate Graph ' . $a . ' with Local Data IDs of ' . implode(', ', $orphans), false, 'UPGRADE');
|
|
|
|
db_execute_prepared('DELETE
|
|
FROM graph_templates_item
|
|
WHERE local_graph_id = ?
|
|
AND task_item_id IN(
|
|
SELECT dtr.id
|
|
FROM data_template_rrd AS dtr
|
|
WHERE local_data_id IN (' . implode(', ', $orphans) . ')
|
|
)',
|
|
array($a));
|
|
}
|
|
}
|
|
}
|
|
}
|