forked from howardjones/network-weathermap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup10.php
105 lines (84 loc) · 4.63 KB
/
setup10.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
/*******************************************************************************
*
* Author ......... Howard Jones
* Contact ........ [email protected]
* Home Site ...... http://wotsit.thingy.com/haj/
* Program ........ Network Weathermap for Cacti
* Version ........ See code below
* Purpose ........ Network Usage Overview
*******************************************************************************/
/**
* This file now contains only the functions for registering the plugin and doing plugin-admin stuff
*
* All the real work is in lib/cacti88-plugin-hooks.php and lib/cacti-plugin-poller.php
*/
// Load our autoloader
require_once dirname(__FILE__) . "/lib/all.php";
// These four are not classes which can be autoloaded. They're the global functions that Cacti is looking
// for to use as plugin hook functions
require_once dirname(__FILE__) . "/lib/Weathermap/Integrations/Cacti/database.php";
require_once dirname(__FILE__) . "/lib/Weathermap/Integrations/Cacti/cacti10-plugin-hooks.php";
require_once dirname(__FILE__) . "/lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php";
// and the old (to be replaced) Giant Function Of Everything for drawing maps
require_once dirname(__FILE__) . "/lib/Weathermap/Poller/poller-common.php";
function plugin_weathermap_version()
{
global $config;
$info = parse_ini_file($config['base_path'] . '/plugins/weathermap/INFO', true);
return $info['info'];
}
function plugin_weathermap_install()
{
\api_plugin_register_hook('weathermap', 'config_arrays', 'weathermap_config_arrays', 'setup10.php');
\api_plugin_register_hook('weathermap', 'config_settings', 'weathermap_config_settings', 'setup10.php');
\api_plugin_register_hook('weathermap', 'top_header_tabs', 'weathermap_show_tab', 'setup10.php');
\api_plugin_register_hook('weathermap', 'top_graph_header_tabs', 'weathermap_show_tab', 'setup10.php');
\api_plugin_register_hook('weathermap', 'draw_navigation_text', 'weathermap_draw_navigation_text', 'setup10.php');
\api_plugin_register_hook('weathermap', 'top_graph_refresh', 'weathermap_top_graph_refresh', 'setup10.php');
\api_plugin_register_hook('weathermap', 'page_title', 'weathermap_page_title', 'setup10.php');
\api_plugin_register_hook('weathermap', 'page_head', 'weathermap_page_head', 'setup10.php');
\api_plugin_register_hook('weathermap', 'poller_top', 'weathermap_poller_top', 'setup10.php');
\api_plugin_register_hook('weathermap', 'poller_output', 'weathermap_poller_output', 'setup10.php');
\api_plugin_register_hook('weathermap', 'poller_bottom', 'weathermap_poller_bottom', 'setup10.php');
\api_plugin_register_realm('weathermap', 'weathermap-cacti10-plugin.php', __('Weathermap: View', 'weathermap'), 1);
\api_plugin_register_realm('weathermap', 'weathermap-cacti10-plugin-mgmt.php', __('Weathermap: Configure/Manage', 'weathermap'), 1);
\api_plugin_register_realm('weathermap', 'weathermap-cacti10-plugin-editor.php', __('Weathermap: Edit Maps', 'weathermap'), 1);
weathermap_setup_table();
}
function plugin_init_weathermap()
{
global $plugin_hooks;
$plugin_hooks['top_header_tabs']['weathermap'] = 'weathermap_show_tab';
$plugin_hooks['top_graph_header_tabs']['weathermap'] = 'weathermap_show_tab';
$plugin_hooks['config_arrays']['weathermap'] = 'weathermap_config_arrays';
$plugin_hooks['draw_navigation_text']['weathermap'] = 'weathermap_draw_navigation_text';
$plugin_hooks['config_settings']['weathermap'] = 'weathermap_config_settings';
$plugin_hooks['poller_bottom']['weathermap'] = 'weathermap_poller_bottom';
$plugin_hooks['poller_top']['weathermap'] = 'weathermap_poller_top';
$plugin_hooks['poller_output']['weathermap'] = 'weathermap_poller_output';
$plugin_hooks['top_graph_refresh']['weathermap'] = 'weathermap_top_graph_refresh';
$plugin_hooks['page_title']['weathermap'] = 'weathermap_page_title';
$plugin_hooks['page_head']['weathermap'] = 'weathermap_page_head';
}
function plugin_weathermap_uninstall()
{
// This function doesn't seem to ever be called, in Cacti 0.8.8b
// on the assumption that it will one day work, clear the stored version number from the settings
// so that an uninstall/reinstall on the plugin would force the db schema to be checked
$pdo = weathermap_get_pdo();
$pdo->query("REPLACE INTO settings VALUES('weathermap_version','')");
}
/* somehow this function is still required in PA 3.x, even though it checks for plugin_weathermap_version() */
function weathermap_version()
{
return plugin_weathermap_version();
}
function plugin_weathermap_check_config()
{
return true;
}
function plugin_weathermap_upgrade()
{
return false;
}