Skip to content

Commit 344c1f5

Browse files
[ADD] Support for Zabbix 6.0
1 parent e666d53 commit 344c1f5

File tree

7 files changed

+21
-42
lines changed

7 files changed

+21
-42
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ This software is licensed under the GNU Lesser General Public License v3.0.
1010

1111
## Changelog
1212

13+
### Version 6.0.1
14+
15+
* Support for Zabbix 6.0
16+
1317
### Version 5.4.2
1418

1519
* Added support for Zabbix 5.0 and 5.2

modules/csv-host-importer/Module.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Zabbix CSV Import Frontend Module
44
*
5-
* @version 5.0.0
5+
* @version 6.0.1
66
* @author Wolfgang Alper <[email protected]>
77
* @copyright IntelliTrend GmbH, https://www.intellitrend.de
88
* @license GNU Lesser General Public License v3.0

modules/csv-host-importer/actions/CsvHostImport.php

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Zabbix CSV Import Frontend Module
44
*
5-
* @version 5.0.0
5+
* @version 6.0.1
66
* @author Wolfgang Alper <[email protected]>
77
* @copyright IntelliTrend GmbH, https://www.intellitrend.de
88
* @license GNU Lesser General Public License v3.0
@@ -23,8 +23,7 @@
2323
use CRoleHelper;
2424
use CUploadFile;
2525
use API;
26-
use CSession; // 5.0.0
27-
use CSessionHelper; // 5.2.0+
26+
use CSessionHelper;
2827

2928
/**
3029
* Host CSV importer module action.
@@ -105,11 +104,7 @@ protected function checkInput(): bool {
105104
* @return bool
106105
*/
107106
protected function checkPermissions(): bool {
108-
if (version_compare(ZABBIX_VERSION, '5.4.0', '>=')) {
109-
return $this->checkAccess(CRoleHelper::UI_ADMINISTRATION_GENERAL);
110-
} else {
111-
return ($this->getUserType() == USER_TYPE_SUPER_ADMIN);
112-
}
107+
return $this->checkAccess(CRoleHelper::UI_ADMINISTRATION_GENERAL);
113108
}
114109

115110
private function csvParse(): bool {
@@ -270,35 +265,19 @@ private function importHosts(): bool {
270265
}
271266

272267
private function loadSession() {
273-
if (version_compare(ZABBIX_VERSION, '5.2.0', '>=')) {
274-
if (!CSessionHelper::has(self::HOSTLIST_KEY)) {
275-
return false;
276-
}
277-
$this->hostlist = CSessionHelper::get(self::HOSTLIST_KEY);
278-
return true;
279-
} else {
280-
if (!CSession::keyExists(self::HOSTLIST_KEY)) {
281-
return false;
282-
}
283-
$this->hostlist = CSession::getValue(self::HOSTLIST_KEY);
284-
return true;
268+
if (!CSessionHelper::has(self::HOSTLIST_KEY)) {
269+
return false;
285270
}
271+
$this->hostlist = CSessionHelper::get(self::HOSTLIST_KEY);
272+
return true;
286273
}
287274

288275
private function saveSession() {
289-
if (version_compare(ZABBIX_VERSION, '5.2.0', '>=')) {
290-
CSessionHelper::set(self::HOSTLIST_KEY, $this->hostlist);
291-
} else {
292-
CSession::setValue(self::HOSTLIST_KEY, $this->hostlist);
293-
}
276+
CSessionHelper::set(self::HOSTLIST_KEY, $this->hostlist);
294277
}
295278

296279
private function clearSession() {
297-
if (version_compare(ZABBIX_VERSION, '5.2.0', '>=')) {
298-
CSessionHelper::unset([self::HOSTLIST_KEY]);
299-
} else {
300-
CSession::unsetValue([self::HOSTLIST_KEY]);
301-
}
280+
CSessionHelper::unset([self::HOSTLIST_KEY]);
302281
}
303282

304283

modules/csv-host-importer/actions/CsvHostImportExample.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Zabbix CSV Import Frontend Module
44
*
5-
* @version 5.0.0
5+
* @version 6.0.1
66
* @author Wolfgang Alper <[email protected]>
77
* @copyright IntelliTrend GmbH, https://www.intellitrend.de
88
* @license GNU Lesser General Public License v3.0
@@ -56,11 +56,7 @@ protected function checkInput(): bool {
5656
* @return bool
5757
*/
5858
protected function checkPermissions(): bool {
59-
if (version_compare(ZABBIX_VERSION, '5.4.0', '>=')) {
60-
return $this->checkAccess(CRoleHelper::UI_ADMINISTRATION_GENERAL);
61-
} else {
62-
return ($this->getUserType() == USER_TYPE_SUPER_ADMIN);
63-
}
59+
return $this->checkAccess(CRoleHelper::UI_ADMINISTRATION_GENERAL);
6460
}
6561

6662
/**

modules/csv-host-importer/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 1.0,
33
"id": "intellitrend_csv_host_importer",
44
"name": "CSV Host Importer",
5-
"version": "5.4.2",
5+
"version": "6.0.1",
66
"namespace": "ichi",
77
"author": "IntelliTrend GmbH",
88
"url": "https://www.intellitrend.de/",

modules/csv-host-importer/views/layout.ichi.example.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Zabbix CSV Import Frontend Module
44
*
5-
* @version 5.0.0
5+
* @version 6.0.1
66
* @author Wolfgang Alper <[email protected]>
77
* @copyright IntelliTrend GmbH, https://www.intellitrend.de
88
* @license GNU Lesser General Public License v3.0

modules/csv-host-importer/views/module.ichi.import.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Zabbix CSV Import Frontend Module
44
*
5-
* @version 5.0.0
5+
* @version 6.0.1
66
* @author Wolfgang Alper <[email protected]>
77
* @copyright IntelliTrend GmbH, https://www.intellitrend.de
88
* @license GNU Lesser General Public License v3.0
@@ -126,8 +126,8 @@
126126

127127
if ($hostid != -1) {
128128
$cols[] = new CCol(
129-
new CLink('Created', (new CUrl('hosts.php'))
130-
->setArgument('form', 'update')
129+
new CLink('Created', (new CUrl('zabbix.php'))
130+
->setArgument('action', 'host.edit')
131131
->setArgument('hostid', $hostid)
132132
)
133133
);

0 commit comments

Comments
 (0)