Index: core/units/admin/admin_events_handler.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/units/admin/admin_events_handler.php (revision 15683) +++ core/units/admin/admin_events_handler.php (revision ) @@ -1047,19 +1047,18 @@ $deployment_helper = $this->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; } + if ( $deployment_helper->deployAll() ) { - $event->SetRedirectParam('action_completed', 1); - } + $event->SetRedirectParam('action_completed', 1); + } + else { + $event->status = kEvent::erFAIL; + } + } /** * Synchronizes database revisions from "project_upgrades.sql" file @@ -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; } } \ No newline at end of file Index: tools/run_event.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- tools/run_event.php (revision 15664) +++ tools/run_event.php (revision ) @@ -12,8 +12,12 @@ * See http://www.in-portal.org/license for copyright notices and details. */ -die('Restrictred use!'); +//exit_code(1, 'This script needs to be enabled manually !'); +if ( php_sapi_name() != 'cli' ) { + exit_code(2, 'This script is intended to be used from command-line only !'); +} + $start = microtime(true); define('CRON', 1); @@ -26,8 +30,8 @@ // in command line, then 2nd argument is password $password = isset($argv) && isset($argv[2]) ? $argv[2] : ''; -if ($password != 'b674006f3edb1d9cd4d838c150b0567d') { +if ( $password != 'b674006f3edb1d9cd4d838c150b0567d' ) { - die('Bad key' . PHP_EOL); + exit_code(3, 'Bad key'); } include_once(FULL_PATH . '/core/kernel/startup.php'); @@ -36,7 +40,21 @@ $application->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); +} \ No newline at end of file