Skip to content

Commit 333c9e6

Browse files
committed
Releasing 2.1 to be compatible with Cacti 1.1.17 and above
Also, properly upgrade the flowview plguin.
1 parent 6a702a4 commit 333c9e6

4 files changed

Lines changed: 41 additions & 25 deletions

File tree

INFO

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[info]
22
name = flowview
3-
version = 2.0
3+
version = 2.1
44
longname = FlowView
55
author = The Cacti Group
66
email =
77
homepage = http://www.cacti.net
8-
compat = 1.1.1
8+
compat = 1.1.17
99
capabilities = online_view:0, online_mgmt:0, offline_view:0, offline_mgmt:0, remote_collect:0

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ Got any ideas or complaints, please see the Cacti forums or GitHub for a resolut
4242

4343
# Changelog
4444

45+
--- 2.1 ---
46+
* issue: Prepare for sunrise theme in 1.1.17
47+
4548
--- 2.0 ---
4649
* feature: Support for Cacti 1.0
4750
* feature: Support for Ugroup Plugin

functions.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -125,28 +125,20 @@ function flowview_display_report() {
125125
<td>
126126
<?php print __('Show/Hide', 'flowview');?>
127127
</td>
128-
<td>
128+
<td class='nowrap'>
129129
<input type='checkbox' name='table' id='table' <?php print (get_request_var('table') == 'true' || get_request_var('table') == 'on' ? 'checked':'');?>>
130-
</td>
131-
<td>
132130
<label for='table'><?php print __('Table', 'flowview');?></label>
133131
</td>
134-
<td>
132+
<td class='nowrap'>
135133
<input type='checkbox' name='bytes' id='bytes' <?php print (get_request_var('bytes') == 'true' || get_request_var('bytes') == 'on' ? 'checked':'');?>>
136-
</td>
137-
<td>
138134
<label for='bytes'><?php print __('Bytes Bar', 'flowview');?></label>
139135
</td>
140-
<td>
136+
<td class='nowrap'>
141137
<input type='checkbox' name='packets' id='packets' <?php print (get_request_var('packets') == 'true' || get_request_var('packets') == 'on' ? 'checked':'');?>>
142-
</td>
143-
<td>
144138
<label for='packets'><?php print __('Packets Bar', 'flowview');?></label>
145139
</td>
146-
<td>
140+
<td class='nowrap'>
147141
<input type='checkbox' name='flows' id='flows' <?php print (get_request_var('flows') == 'true' || get_request_var('flows') == 'on' ? 'checked':'');?>>
148-
</td>
149-
<td>
150142
<label for='flows'><?php print __('Flows Bar', 'flowview');?></label>
151143
</td>
152144
<td>

setup.php

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,41 @@ function plugin_flowview_upgrade() {
5555
}
5656

5757
function plugin_flowview_check_upgrade() {
58-
$current = plugin_flowview_version();
59-
$current = $current['version'];
60-
$old = read_config_option('plugin_flowview_version');
61-
if ($current != $old) {
62-
flowview_setup_table();
63-
}else{
58+
$files = array('plugins.php', 'flowview.php', 'index.php');
59+
if (isset($_SERVER['PHP_SELF']) && !in_array(basename($_SERVER['PHP_SELF']), $files)) {
6460
return;
6561
}
6662

67-
/* update titles for those that don't have them */
68-
db_execute("UPDATE plugin_flowview_schedules SET title='Ugraded Schedule' WHERE title=''");
63+
$info = plugin_flowview_version();
64+
$current = $info['version'];
65+
$old = read_config_option('plugin_flowview_version');
66+
67+
if ($current != $old) {
68+
$bad_titles = db_fetch_cell('SELECT COUNT(*)
69+
FROM plugin_flowview_schedules
70+
WHERE title=""');
71+
72+
if ($bad_titles) {
73+
/* update titles for those that don't have them */
74+
db_execute("UPDATE plugin_flowview_schedules SET title='Ugraded Schedule' WHERE title=''");
75+
76+
/* Set the new version */
77+
db_execute_prepared("REPLACE INTO settings (name, value) VALUES ('plugin_flowview_version', ?)", array($current));
6978

70-
/* Set the new version */
71-
db_execute_prepared("REPLACE INTO settings (name, value) VALUES ('plugin_flowview_version', ?)", array($current));
79+
db_execute('ALTER TABLE plugin_flowview_devices ENGINE=InnoDB');
80+
}
81+
82+
db_execute("UPDATE plugin_config
83+
SET version='$current'
84+
WHERE directory='flowview'");
7285

73-
db_execute('ALTER TABLE plugin_flowview_devices ENGINE=InnoDB');
86+
db_execute("UPDATE plugin_config SET
87+
version='" . $info['version'] . "',
88+
name='" . $info['longname'] . "',
89+
author='" . $info['author'] . "',
90+
webpage='" . $info['homepage'] . "'
91+
WHERE directory='" . $info['name'] . "' ");
92+
}
7493
}
7594

7695
function plugin_flowview_version() {
@@ -84,6 +103,8 @@ function flowview_config_arrays() {
84103

85104
$messages['flow_deleted'] = array('message' => __('The Filter has been Deleted', 'flowview'), 'type' => 'info');
86105
$messages['flow_updated'] = array('message' => __('The Filter has been Updated', 'flowview'), 'type' => 'info');
106+
107+
plugin_flowview_check_upgrade();
87108
}
88109

89110
function flowview_draw_navigation_text($nav) {

0 commit comments

Comments
 (0)