Index: branches/5.2.x/core/units/helpers/deployment_helper.php =================================================================== diff -u -N -r15699 -r15728 --- branches/5.2.x/core/units/helpers/deployment_helper.php (.../deployment_helper.php) (revision 15699) +++ branches/5.2.x/core/units/helpers/deployment_helper.php (.../deployment_helper.php) (revision 15728) @@ -1,6 +1,6 @@ _event = new kEvent('adm:OnDummy'); $this->isCommandLine = isset($GLOBALS['argv']) && count($GLOBALS['argv']); if ( !$this->isCommandLine ) { @@ -99,6 +108,18 @@ } /** + * Sets event, associated with deployment + * + * @param kEvent $event + * @return void + * @access public + */ + public function setEvent(kEvent $event) + { + $this->_event = $event; + } + + /** * Adds message to script execution log * * @param string $message @@ -292,14 +313,19 @@ private function resetCaches() { // 2. reset unit config cache (so new classes get auto-registered) - $this->out('Resetting Unit Config Cache ... '); - $this->Application->HandleEvent(new kEvent('adm:OnResetConfigsCache')); + $this->out('Resetting Configs Files Cache and Parsed System Data ... '); + $this->_event->CallSubEvent('OnResetConfigsCache'); $this->displayStatus('OK'); // 3. reset sections cache - $this->out('Resetting Sections Cache ... '); - $this->Application->HandleEvent(new kEvent('adm:OnResetSections')); + $this->out('Resetting Admin Console Sections ... '); + $this->_event->CallSubEvent('OnResetSections'); $this->displayStatus('OK'); + + // 4. reset mod-rewrite cache + $this->out('Resetting ModRewrite Cache ... '); + $this->_event->CallSubEvent('OnResetModRwCache'); + $this->displayStatus('OK'); } /** @@ -310,8 +336,8 @@ */ private function refreshThemes() { - $this->out('Rebuilding Theme Files ... '); - $this->Application->HandleEvent(new kEvent('adm:OnRebuildThemes')); + $this->out('Refreshing Theme Files ... '); + $this->_event->CallSubEvent('OnRebuildThemes'); $this->displayStatus('OK'); } Index: branches/5.2.x/core/units/admin/admin_events_handler.php =================================================================== diff -u -N -r15715 -r15728 --- branches/5.2.x/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 15715) +++ branches/5.2.x/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 15728) @@ -1,6 +1,6 @@ Application->recallObject('DeploymentHelper'); - /* @var $deployment_helper DeploymentHelper */ - - if ( !$deployment_helper->isCommandLine ) { - // browser invocation -> don't perform redirect - $event->redirect = false; - } - - if ( $deployment_helper->deployAll() ) { - $event->SetRedirectParam('action_completed', 1); - } - else { - $event->status = kEvent::erFAIL; - } + $this->_deploymentAction($event); } /** @@ -1069,16 +1056,36 @@ */ protected function OnSynchronizeDBRevisions(kEvent $event) { + $this->_deploymentAction($event, true); + } + + /** + * Common code to invoke deployment helper + * + * @param kEvent $event + * @param bool $dry_run + * @return void + * @access protected + */ + protected function _deploymentAction(kEvent $event, $dry_run = false) + { $deployment_helper = $this->Application->recallObject('DeploymentHelper'); /* @var $deployment_helper DeploymentHelper */ - if ( !$deployment_helper->isCommandLine ) { - // browser invocation -> don't perform redirect - $event->redirect = false; - } + $deployment_helper->setEvent($event); - if ( $deployment_helper->deployAll(true) ) { - $this->Application->SetVar('action_completed', 1); + if ( $deployment_helper->deployAll($dry_run) ) { + $event->SetRedirectParam('action_completed', 1); + + if ( !$deployment_helper->isCommandLine ) { + // browser invocation -> don't perform redirect + $event->redirect = false; + + // no redirect, but deployment succeeded - set redirect params directly + foreach ($event->getRedirectParams() as $param_name => $param_value) { + $this->Application->SetVar($param_name, $param_value); + } + } } else { $event->status = kEvent::erFAIL;