Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/controllers/CControllerModuleEdit.php')
-rw-r--r--ui/app/controllers/CControllerModuleEdit.php26
1 files changed, 11 insertions, 15 deletions
diff --git a/ui/app/controllers/CControllerModuleEdit.php b/ui/app/controllers/CControllerModuleEdit.php
index 0f0405e107a..faec576705d 100644
--- a/ui/app/controllers/CControllerModuleEdit.php
+++ b/ui/app/controllers/CControllerModuleEdit.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types = 0);
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
@@ -26,16 +26,14 @@ class CControllerModuleEdit extends CController {
/**
* Current module data.
- *
- * @var array
*/
- private $module = [];
+ private array $module = [];
- protected function init() {
+ protected function init(): void {
$this->disableSIDValidation();
}
- protected function checkInput() {
+ protected function checkInput(): bool {
$fields = [
'moduleid' => 'required|db module.moduleid',
@@ -53,7 +51,7 @@ class CControllerModuleEdit extends CController {
return $ret;
}
- protected function checkPermissions() {
+ protected function checkPermissions(): bool {
if (!$this->checkAccess(CRoleHelper::UI_ADMINISTRATION_GENERAL)) {
return false;
}
@@ -72,12 +70,12 @@ class CControllerModuleEdit extends CController {
return true;
}
- protected function doAction() {
- $module_manager = new CModuleManager(APP::ModuleManager()->getModulesDir());
+ protected function doAction(): void {
+ $module_manager = new CModuleManager(APP::getRootDir());
$manifest = $module_manager->addModule($this->module['relative_path']);
- if ($manifest) {
+ if ($manifest !== null) {
$data = [
'moduleid' => $this->getInput('moduleid'),
'name' => $manifest['name'],
@@ -88,15 +86,12 @@ class CControllerModuleEdit extends CController {
'namespace' => $manifest['namespace'],
'url' => array_key_exists('url', $manifest) ? $manifest['url'] : null,
'status' => $this->hasInput('form_refresh')
- ? $this->hasInput('status')
- ? MODULE_STATUS_ENABLED
- : MODULE_STATUS_DISABLED
+ ? ($this->hasInput('status') ? MODULE_STATUS_ENABLED : MODULE_STATUS_DISABLED)
: $this->module['status']
];
$response = new CControllerResponseData($data);
$response->setTitle(_('Modules'));
- $this->setResponse($response);
}
else {
$response = new CControllerResponseRedirect((new CUrl('zabbix.php'))
@@ -104,7 +99,8 @@ class CControllerModuleEdit extends CController {
->setArgument('page', CPagerHelper::loadPage('module.list', null))
);
CMessageHelper::setErrorTitle(_s('Cannot load module at: %1$s.', $this->module['relative_path']));
- $this->setResponse($response);
}
+
+ $this->setResponse($response);
}
}