Source
if ($interface_type !== null && array_key_exists($interface_type, $interfaces['default_interfaces'][$host])) {
<?php
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** 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.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
require_once 'vendor/autoload.php';
require_once dirname(__FILE__).'/../../../include/defines.inc.php';
require_once dirname(__FILE__).'/../../../include/hosts.inc.php';
require_once dirname(__FILE__).'/../../../include/db.inc.php';
class CDataHelper extends CAPIHelper {
protected static $data = null;
protected static $request = [];
protected static $response = [];
/**
* Prepare request for API call and make API call (@see callRaw).
*
* @param string $method API method to be called.
* @param mixed $params API call params.
*
* @return array
*
* @throws Exception on API error
*/
public static function call($method, $params) {
global $URL;
if (!$URL) {
$URL = PHPUNIT_URL.'api_jsonrpc.php';
}
static::$request = [];
static::$response = [];
if (CAPIHelper::getSessionId() === null) {
CAPIHelper::createSessionId();
}
$response = CAPIHelper::call($method, $params);
if (array_key_exists('error', $response)) {
throw new Exception('API call failed: '.json_encode($response['error'], JSON_PRETTY_PRINT));
}
if (!array_key_exists('result', $response)) {