Index: branches/5.2.x/tools/run_event.php =================================================================== diff -u -r15130 -r15715 --- branches/5.2.x/tools/run_event.php (.../run_event.php) (revision 15130) +++ branches/5.2.x/tools/run_event.php (.../run_event.php) (revision 15715) @@ -1,6 +1,6 @@ Init(); $application->StoreVar('user_id', USER_ROOT, true); -$application->HandleEvent(new kEvent($argv[1])); // event name in form "prefix[.special]:event_name" +$run_event = new kEvent($argv[1]); // event name in form "prefix[.special]:event_name" +$application->HandleEvent($run_event); + $application->Done(); +$end = microtime(true); + +exit_code($run_event->status == kEvent::erSUCCESS ? 0 : 4); + +function exit_code($code, $msg = '') +{ + if ( $msg ) { + echo $msg . PHP_EOL; + } + + exit($code); +} $end = microtime(true); \ No newline at end of file Index: branches/5.2.x/core/units/admin/admin_events_handler.php =================================================================== diff -u -r15683 -r15715 --- branches/5.2.x/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 15683) +++ branches/5.2.x/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 15715) @@ -1,6 +1,6 @@ Application->recallObject('DeploymentHelper'); /* @var $deployment_helper DeploymentHelper */ - $deployment_helper->deployAll(); - - if ( $deployment_helper->isCommandLine ) { - // command line invocation -> don't render template - $event->status = kEvent::erSTOP; - } - else { + if ( !$deployment_helper->isCommandLine ) { // browser invocation -> don't perform redirect $event->redirect = false; } - $event->SetRedirectParam('action_completed', 1); + if ( $deployment_helper->deployAll() ) { + $event->SetRedirectParam('action_completed', 1); + } + else { + $event->status = kEvent::erFAIL; + } } /** @@ -1073,17 +1072,16 @@ $deployment_helper = $this->Application->recallObject('DeploymentHelper'); /* @var $deployment_helper DeploymentHelper */ + if ( !$deployment_helper->isCommandLine ) { + // browser invocation -> don't perform redirect + $event->redirect = false; + } + if ( $deployment_helper->deployAll(true) ) { $this->Application->SetVar('action_completed', 1); } - - if ( $deployment_helper->isCommandLine ) { - // command line invocation -> don't render template - $event->status = kEvent::erSTOP; - } else { - // browser invocation -> don't perform redirect - $event->redirect = false; + $event->status = kEvent::erFAIL; } }