mirror of
https://github.com/Cacti/plugin_thold.git
synced 2026-10-23 03:27:05 +09:00
* Add PHPDoc blocks: small files batch (cli_import, poller_thold, includes/tab, includes/database, cli_thresholds, thold_notify, notify_queue) * Add PHPDoc blocks: includes/polling.php, includes/settings.php (WIP checkpoint) * Add PHPDoc blocks: thold_process.php, thold_daemon.php (WIP checkpoint) * Add PHPDoc blocks: thold_webapi.php (WIP checkpoint) * Add PHPDoc blocks: thold.php (WIP checkpoint) * Add PHPDoc blocks: thold_graph.php (WIP checkpoint) * Add PHPDoc blocks: notify_lists.php (WIP checkpoint) * Add PHPDoc blocks: thold_templates.php (WIP checkpoint) * Add PHPDoc blocks: setup.php batch 1-2 (WIP checkpoint) * Add PHPDoc blocks: setup.php batch 3-4 (WIP checkpoint) * Add PHPDoc blocks: setup.php batch 5 (WIP checkpoint) * Add PHPDoc blocks: setup.php batch 6-7 (WIP checkpoint) * Add PHPDoc blocks: setup.php complete * Address review feedback and refresh translation template - Fix thold_update_host_status() return type (int|null, since it falls through with no explicit return in the normal case) - Fix @global $device_change_fields description in thold_config_arrays() (appends this plugin's fields, not unused) - Fix @global $config description in thold_graph_button() (used to build the Create Threshold link's URL) - Fix thold_data_source_action_prepare()/thold_graphs_action_prepare() return types (array|void; only the non-plugin_thold_create branch returns $save) - Fix @global $timearray description in list_tholds() (used to render each baseline threshold's reference time range) - Fix @global $thold_types description in thold_show_log() (used to render each log row's type column) - Regenerate locales/po/cacti.pot (source line references only) - Fix .gitignore pattern for compiled .mo files (locales/LC_MESSAGES/, not locales/po/) * test(coverage): allowlist untestable entry points touched by PHPDoc pass This PR only adds PHPDoc blocks (no functional changes), but touching every file in the plugin newly triggers the 'Enforce coverage of changed lines' CI gate for files that were never require()'d by any test before now: - cli_import.php, cli_thresholds.php: CLI entry points (include cli_check.php / chdir + execute at the top level). - poller_thold.php: poller entry point, same category. - thold.php, thold_graph.php, thold_templates.php, notify_lists.php: authenticated web entry points (chdir + include(auth.php) at the top level), like notify_queue.php/thold_notify.php already allowlisted above. - thold_daemon.php: daemon entry point, same category as thold_process.php already allowlisted above. - includes/settings.php, includes/tab.php: Settings-page/header-tab-bar hook callbacks, only meaningful inside a live Cacti page render. - thold_webapi.php: web-page action handlers that read \ and the database directly. None of these can be require()'d into the isolated unit test process, matching the existing allowlist entries' precedent exactly. Verified locally: running patch-coverage.php against the PR's actual base ref confirms all 11 files are no longer reported as unexpected-unmeasured. * docs: add PHPDoc blocks to remaining thold_functions.php functions * chore: refresh translation template after PHPDoc line-number shifts
49 lines
2.4 KiB
PHP
49 lines
2.4 KiB
PHP
<?php
|
|
/*
|
|
+-------------------------------------------------------------------------+
|
|
| Copyright (C) 2004-2026 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/ |
|
|
+-------------------------------------------------------------------------+
|
|
*/
|
|
|
|
/**
|
|
* Renders this plugin's tab icon/link in the graph/console header tab
|
|
* bar, highlighted when the current page is one of this plugin's
|
|
* views. Shown only to users with view permission. Registered as a
|
|
* Cacti header-tabs hook.
|
|
*
|
|
* @return void
|
|
*
|
|
* @global array $config Cacti global configuration array; used to
|
|
* build asset and page URLs.
|
|
*/
|
|
function thold_show_tab() {
|
|
global $config;
|
|
|
|
if (api_user_realm_auth('thold_graph.php')) {
|
|
$cp = false;
|
|
|
|
if (get_current_page() == 'thold_graph.php' || get_current_page() == 'thold_view_failures.php' || get_current_page() == 'thold_view_normal.php') {
|
|
$cp = true;
|
|
}
|
|
|
|
print '<a href="' . $config['url_path'] . 'plugins/thold/thold_graph.php"><img src="' . $config['url_path'] . 'plugins/thold/images/tab_thold' . ($cp ? '_down' : '') . '.gif" alt="' . __esc('Thold', 'thold') . '"></a>';
|
|
}
|
|
}
|