1<?php declare(strict_types = 1);
2/*
3** Zabbix
4** Copyright (C) 2001-2021 Zabbix SIA
5**
6** This program is free software; you can redistribute it and/or modify
7** it under the terms of the GNU General Public License as published by
8** the Free Software Foundation; either version 2 of the License, or
9** (at your option) any later version.
10**
11** This program is distributed in the hope that it will be useful,
12** but WITHOUT ANY WARRANTY; without even the implied warranty of
13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14** GNU General Public License for more details.
15**
16** You should have received a copy of the GNU General Public License
17** along with this program; if not, write to the Free Software
18** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19**/
20
21
22/**
23 * A class for accessing once loaded parameters of Housekeeping API object.
24 */
25class CHousekeepingHelper extends CConfigGeneralHelper {
26
27	public const COMPRESS_OLDER = 'compress_older';
28	public const COMPRESSION_STATUS = 'compression_status';
29	public const DB_EXTENSION = 'db_extension';
30	public const HK_AUDIT = 'hk_audit';
31	public const HK_AUDIT_MODE = 'hk_audit_mode';
32	public const HK_EVENTS_AUTOREG = 'hk_events_autoreg';
33	public const HK_EVENTS_DISCOVERY = 'hk_events_discovery';
34	public const HK_EVENTS_INTERNAL = 'hk_events_internal';
35	public const HK_EVENTS_MODE = 'hk_events_mode';
36	public const HK_EVENTS_TRIGGER = 'hk_events_trigger';
37	public const HK_HISTORY = 'hk_history';
38	public const HK_HISTORY_GLOBAL = 'hk_history_global';
39	public const HK_HISTORY_MODE = 'hk_history_mode';
40	public const HK_SERVICES = 'hk_services';
41	public const HK_SERVICES_MODE = 'hk_services_mode';
42	public const HK_SESSIONS = 'hk_sessions';
43	public const HK_SESSIONS_MODE = 'hk_sessions_mode';
44	public const HK_TRENDS = 'hk_trends';
45	public const HK_TRENDS_GLOBAL = 'hk_trends_global';
46	public const HK_TRENDS_MODE = 'hk_trends_mode';
47
48	/**
49	 * Housekeeping API object parameters array.
50	 *
51	 * @static
52	 *
53	 * @var array
54	 */
55	protected static $params = [];
56
57	/**
58	 * @inheritdoc
59	 */
60	protected static function loadParams(?string $param = null, bool $is_global = false): void {
61		if (!self::$params) {
62			self::$params = API::Housekeeping()->get(['output' => 'extend']);
63
64			if (self::$params === false) {
65				throw new Exception(_('Unable to load housekeeping API parameters.'));
66			}
67		}
68	}
69}
70