"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ui/app/controllers/CControllerPopupMassupdateHost.php" between
zabbix-5.4.0.tar.gz and zabbix-5.4.1.tar.gz

About: ZABBIX is an enterprise-class distributed monitoring solution for servers and applications.

CControllerPopupMassupdateHost.php  (zabbix-5.4.0):CControllerPopupMassupdateHost.php  (zabbix-5.4.1)
skipping to change at line 120 skipping to change at line 120
} }
); );
$result = true; $result = true;
try { try {
DBstart(); DBstart();
// filter only normal and discovery created hosts // filter only normal and discovery created hosts
$options = [ $options = [
'output' => ['hostid', 'inventory_mode'], 'output' => ['hostid', 'inventory_mode', 'flags'],
'hostids' => $hostids, 'hostids' => $hostids,
'filter' => ['flags' => [ZBX_FLAG_DISCOVE RY_NORMAL, ZBX_FLAG_DISCOVERY_CREATED]] 'filter' => ['flags' => [ZBX_FLAG_DISCOVE RY_NORMAL, ZBX_FLAG_DISCOVERY_CREATED]]
]; ];
if (array_key_exists('groups', $visible)) { if (array_key_exists('groups', $visible)) {
$options['selectGroups'] = ['groupid']; $options['selectGroups'] = ['groupid'];
} }
if (array_key_exists('templates', $visible) if (array_key_exists('templates', $visible)
&& !($this->getInput('mass_action _tpls') == ZBX_ACTION_REPLACE && !($this->getInput('mass_action _tpls') == ZBX_ACTION_REPLACE
skipping to change at line 291 skipping to change at line 291
$host['templates' ] = array_unique( $host['templates' ] = array_unique(
array_dif f($host_templateids, $this->getInput('templates', [])) array_dif f($host_templateids, $this->getInput('templates', []))
); );
if ($this->hasInp ut('mass_clear_tpls')) { if ($this->hasInp ut('mass_clear_tpls')) {
$host['te mplates_clear'] = array_unique($this->getInput('templates', [])); $host['te mplates_clear'] = array_unique($this->getInput('templates', []));
} }
break; break;
} }
} }
if (array_key_exists('inventory_mode', $n /*
ew_values)) { * Inventory mode cannot be changed for d
iscovered hosts. If discovered host has disabled inventory
* mode, inventory values also cannot be
changed.
*/
if (array_key_exists('inventory_mode', $n
ew_values)
&& $host['flags'] != ZBX_
FLAG_DISCOVERY_CREATED) {
$host['inventory'] = $host_invent ory; $host['inventory'] = $host_invent ory;
} }
elseif ($host['inventory_mode'] != HOST_I NVENTORY_DISABLED) { elseif ($host['inventory_mode'] != HOST_I NVENTORY_DISABLED) {
$host['inventory'] = $host_invent ory; $host['inventory'] = $host_invent ory;
} }
else { else {
$host['inventory'] = []; $host['inventory'] = [];
} }
if (array_key_exists('tags', $visible)) { if (array_key_exists('tags', $visible)) {
skipping to change at line 409 skipping to change at line 414
} }
if ($mass_update_macros != ZBX_AC TION_REMOVE_ALL) { if ($mass_update_macros != ZBX_AC TION_REMOVE_ALL) {
unset($host['macros']); unset($host['macros']);
} }
} }
unset($host['parentTemplates']); unset($host['parentTemplates']);
$host = $new_values + $host; $host = $new_values + $host;
/*
* API prevents changing host inventory_m
ode for discovered hosts. However, inventory values can
* still be updated if inventory mode all
ows it.
*/
if ($host['flags'] == ZBX_FLAG_DISCOVERY_
CREATED) {
unset($host['inventory_mode']);
}
unset($host['flags']);
} }
unset($host); unset($host);
if (!API::Host()->update($hosts)) { $result = $hosts ? (bool) API::Host()->update($ho
sts) : true;
if ($result === false) {
throw new Exception(); throw new Exception();
} }
/** /**
* Macros must be updated separately, since calli ng API::UserMacro->replaceMacros() inside * Macros must be updated separately, since calli ng API::UserMacro->replaceMacros() inside
* API::Host->update() results in loss of secret macro values. * API::Host->update() results in loss of secret macro values.
*/ */
if ($host_macros_remove) { if ($host_macros_remove) {
if (!API::UserMacro()->delete($host_macro s_remove)) { if (!API::UserMacro()->delete($host_macro s_remove)) {
throw new Exception(); throw new Exception();
 End of changes. 4 change blocks. 
4 lines changed or deleted 27 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)