-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsetup.php
More file actions
146 lines (126 loc) · 5.79 KB
/
Copy pathsetup.php
File metadata and controls
146 lines (126 loc) · 5.79 KB
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?php
/* vim: ts=4
+-------------------------------------------------------------------------+
| Copyright (C) 2004-2026 The Cacti Group, Inc. |
| Copyright (C) 2004-2024 Petr Macek |
| |
| 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. |
+-------------------------------------------------------------------------+
| https://github.com/xmacan/ |
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
*/
/**
* Registers this plugin's Cacti hooks (device edit links, tab display,
* device removal cleanup, settings, poller_bottom, host edit page) and
* the evidence.php/evidence_tab.php realm, then creates the plugin's
* database tables. Invoked by the Cacti plugin framework when the
* plugin is installed/enabled.
*
* @return void
*/
function plugin_evidence_install () {
api_plugin_register_hook('evidence', 'device_edit_top_links', 'plugin_evidence_device_edit_top_links', 'include/functions.php');
api_plugin_register_hook('evidence', 'top_header_tabs', 'evidence_show_tab', 'include/functions.php');
api_plugin_register_hook('evidence', 'top_graph_header_tabs', 'evidence_show_tab', 'include/functions.php');
api_plugin_register_hook('evidence', 'device_remove', 'plugin_evidence_device_remove', 'include/functions.php');
api_plugin_register_hook('evidence', 'config_settings', 'plugin_evidence_config_settings', 'include/settings.php');
api_plugin_register_hook('evidence', 'poller_bottom', 'plugin_evidence_poller_bottom', 'include/functions.php');
api_plugin_register_hook('evidence', 'host_edit_bottom', 'plugin_evidence_host_edit_bottom', 'include/functions.php');
api_plugin_register_realm('evidence', 'evidence.php,evidence_tab.php,', 'Plugin evidence - view', 1);
plugin_evidence_setup_database();
}
/**
* No-op uninstall hook; this plugin does not remove its database tables
* on uninstall (see plugin_evidence_remove_data() for that). Invoked by
* the Cacti plugin framework when the plugin is uninstalled.
*
* @return bool Always true.
*/
function plugin_evidence_uninstall () {
return true;
}
/**
* Reads this plugin's version/author metadata from its INFO file.
* Invoked by the Cacti plugin framework to display plugin information,
* and called directly by poller_evidence.php's display_version().
*
* @return array The plugin's INFO file 'info' section (name, version,
* author, etc.).
*/
function plugin_evidence_version() {
global $config;
$info = parse_ini_file($config['base_path'] . '/plugins/evidence/INFO', true);
return $info['info'];
}
/**
* Runs any pending database schema upgrades for this plugin. Invoked by
* the Cacti plugin framework on every page load to keep the plugin's
* schema current.
*
* @return bool Always true.
*
* @global array $config Cacti global configuration array; used to
* locate include/database.php.
*/
function plugin_evidence_check_config () {
global $config;
include_once($config['base_path'] . '/plugins/evidence/include/database.php');
plugin_evidence_upgrade_database();
return true;
}
/**
* Creates this plugin's database tables via include/database.php's
* plugin_evidence_initialize_database(). Called from
* plugin_evidence_install() during plugin installation.
*
* @return void
*
* @global array $config Cacti global configuration array; used to
* locate include/database.php.
*/
function plugin_evidence_setup_database() {
global $config;
include_once($config['base_path'] . '/plugins/evidence/include/database.php');
plugin_evidence_initialize_database();
}
/**
* Indicates that this plugin stores data that a user may want to remove
* on uninstall. Invoked by the Cacti plugin framework to decide whether
* to offer a data-removal option during uninstall.
*
* @return bool Always true.
*/
function plugin_evidence_has_data() {
return true;
}
/**
* Drops all of this plugin's database tables. Invoked by the Cacti
* plugin framework when the user opts to remove plugin data during
* uninstall.
*
* @return bool Always true.
*/
function plugin_evidence_remove_data() {
db_execute_prepared("DROP TABLE IF EXISTS `plugin_evidence_specific_query`");
db_execute_prepared("DROP TABLE IF EXISTS `plugin_evidence_organization`");
db_execute_prepared("DROP TABLE IF EXISTS `plugin_evidence_entity`");
db_execute_prepared("DROP TABLE IF EXISTS `plugin_evidence_mac`");
db_execute_prepared("DROP TABLE IF EXISTS `plugin_evidence_ip`");
db_execute_prepared("DROP TABLE IF EXISTS `plugin_evidence_vendor_specific`");
db_execute_prepared("DROP TABLE IF EXISTS `plugin_evidence_snmp_info`");
return true;
}