diff options
author | Vladimirs Maksimovs <vladimirs.maksimovs@zabbix.com> | 2021-01-22 10:07:50 +0300 |
---|---|---|
committer | Dmitrijs Goloscapovs <dmitrijs.goloscapovs@zabbix.com> | 2021-01-22 14:19:45 +0300 |
commit | ef345e9604e11ae47f606f45a320185e35d7cf4f (patch) | |
tree | 15f478db117012d29d3c17899bf118273ddee9c9 /ui/app/controllers | |
parent | 5162675157ce6a8a3b9337b8876542b89add9083 (diff) |
..F....... [ZBXNEXT-6360] fixed undefined variable error raised on script execution; added title for no permissions error message on script execution
(cherry picked from commit 1aeffd9a61cada473f3f45c0bea913cd678a9e99)
Diffstat (limited to 'ui/app/controllers')
-rw-r--r-- | ui/app/controllers/CControllerPopupScriptExec.php | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/ui/app/controllers/CControllerPopupScriptExec.php b/ui/app/controllers/CControllerPopupScriptExec.php index 701837d7288..d3895a90243 100644 --- a/ui/app/controllers/CControllerPopupScriptExec.php +++ b/ui/app/controllers/CControllerPopupScriptExec.php @@ -70,6 +70,7 @@ class CControllerPopupScriptExec extends CController { $scriptid = $this->getInput('scriptid'); $hostid = $this->getInput('hostid', ''); $eventid = $this->getInput('eventid', ''); + $msg_title = _('Cannot execute script.'); $data = [ 'title' => _('Scripts'), @@ -103,12 +104,8 @@ class CControllerPopupScriptExec extends CController { } $result = API::Script()->execute($execution_params); - $msg_title = null; - if (!$result) { - $msg_title = _('Cannot execute script.'); - } - else { + if ($result) { if ($data['type'] == ZBX_SCRIPT_TYPE_WEBHOOK) { $value = json_decode($result['value']); $result['value'] = json_last_error() ? $result['value'] : json_encode($value, JSON_PRETTY_PRINT); @@ -117,6 +114,7 @@ class CControllerPopupScriptExec extends CController { $data['output'] = $result['value']; $data['debug'] = $result['debug']; $data['success'] = true; + $msg_title = null; info(_('Script execution successful.')); } } |