mirror of
https://github.com/Cacti/cacti.git
synced 2026-11-23 13:13:57 +09:00
Resolving Issue #819
Allow saving customized timespan for Graph page. This functionality was removed accidentally from Cacti 1.x. For people who have upgraded already, there is a function that finds what is the best timespan. If this is not acceptable, and the Data Source Profiles are Read only, you may have to hand alter the tables to enter the 'preferred' Timespan.
This commit is contained in:
1 parent
953389916d
commit
cc45ede3ef
8 files changed
+128
-15
No files matched your search
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2004-2017 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_1_17() {
|
||||
if (!db_column_exists('data_source_profiles_rra', 'timespan')) {
|
||||
db_install_execute('ALTER TABLE data_source_profiles_rra
|
||||
ADD COLUMN timespan int(10) unsigned NOT NULL DEFAULT "0"');
|
||||
|
||||
$rras = db_fetch_assoc("SELECT * FROM data_source_profiles_rra");
|
||||
|
||||
if (sizeof($rras)) {
|
||||
foreach($rras as $rra) {
|
||||
$interval = db_fetch_cell_prepared('SELECT step
|
||||
FROM data_source_profiles
|
||||
WHERE id = ?',
|
||||
array($rra['data_source_profile_id']));
|
||||
|
||||
$timespan = $rra['steps'] * $interval * $rra['rows'];
|
||||
|
||||
$timespan = get_nearest_timespan($timespan);
|
||||
|
||||
db_execute_prepared('UPDATE data_source_profiles_rra
|
||||
SET timespan = ?
|
||||
WHERE id = ?',
|
||||
array($timespan, $rra['id']));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user