Index: branches/5.1.x/core/units/agents/agent_eh.php =================================================================== diff -u -N -r12127 -r12657 --- branches/5.1.x/core/units/agents/agent_eh.php (.../agent_eh.php) (revision 12127) +++ branches/5.1.x/core/units/agents/agent_eh.php (.../agent_eh.php) (revision 12657) @@ -1,6 +1,6 @@ $agent_params['EventName'], 'AgentName' => $agent_name, 'AgentType' => AGENT_TYPE_SYSTEM, + 'Status' => array_key_exists('Status', $agent_params) ? $agent_params['Status'] : STATUS_ACTIVE, 'RunInterval' => $agent_params['RunInterval'], 'RunMode' => $run_mode, ); @@ -87,6 +90,11 @@ function customProcessing(&$event, $type) { if ($event->Name == 'OnMassDelete' && $type == 'before') { + if ($this->Application->isDebugMode()) { + // allow to delete system agents in debug mode + return ; + } + $ids = $event->getEventParam('ids'); if ($ids) { $id_field = $this->Application->getUnitOption($event->Prefix, 'IDField');