Index: branches/5.1.x/core/units/admin/admin_events_handler.php =================================================================== diff -u -N -r14326 -r14402 --- branches/5.1.x/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 14326) +++ branches/5.1.x/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 14402) @@ -1,6 +1,6 @@ array('self' => true), 'OnClosePopup' => array('self' => true), @@ -44,8 +45,8 @@ $system_events = Array ( 'OnResetModRwCache', 'OnResetSections', 'OnResetConfigsCache', 'OnResetParsedData', 'OnResetMemcache', - 'OnDeleteCompiledTemplates', 'OnCompileTemplates', 'OnGenerateTableStructure', - 'OnRebuildThemes', 'OnCheckPrefixConfig', 'OnMemoryCacheGet', 'OnMemoryCacheSet' + 'OnDeleteCompiledTemplates', 'OnCompileTemplates', 'OnGenerateTableStructure', 'OnSynchronizeDBRevisions', + 'OnDeploy', 'OnRebuildThemes', 'OnCheckPrefixConfig', 'OnMemoryCacheGet', 'OnMemoryCacheSet' ); if (in_array($event->Name, $system_events)) { @@ -1320,6 +1321,41 @@ echo $json_helper->encode($ret); } + + /** + * Deploy changes + * + * Usage: "php tools/run_event.php adm:OnDeploy b674006f3edb1d9cd4d838c150b0567d" + * + * @param kEvent $event + */ + function OnDeploy(&$event) + { + if ( isset($GLOBALS['argv']) ) { + // command line invocation -> don't perform redirect + $event->status = erSTOP; + } + + $deployment_helper =& $this->Application->recallObject('DeploymentHelper'); + /* @var $deployment_helper DeploymentHelper */ + + $deployment_helper->deployAll(); + } + + /** + * Synchronizes database revisions from "project_upgrades.sql" file + * + * @param kEvent $event + */ + function OnSynchronizeDBRevisions(&$event) + { + $deployment_helper =& $this->Application->recallObject('DeploymentHelper'); + /* @var $deployment_helper DeploymentHelper */ + + if ( !$deployment_helper->deployAll(true) ) { + $event->status = erFAIL; + } + } }