diff --git a/Classes/Sitegeist/MagicWand/Command/AbstractCommandController.php b/Classes/Sitegeist/MagicWand/Command/AbstractCommandController.php index e1ecd8a..075d3c7 100644 --- a/Classes/Sitegeist/MagicWand/Command/AbstractCommandController.php +++ b/Classes/Sitegeist/MagicWand/Command/AbstractCommandController.php @@ -62,12 +62,23 @@ protected function executeLocalShellCommand($command, $arguments = [], $options * @param array $arguments * @param array $options */ - protected function executeLocalFlowCommand($command, $arguments = [], $options = []) + protected function executeLocalShellCommandWithFlowContext($command, $arguments = [], $options = []) { - $flowCommand = 'FLOW_CONTEXT=' . $this->bootstrap->getContext() . ' ./flow ' . $command; + $flowCommand = 'FLOW_CONTEXT=' . $this->bootstrap->getContext() . ' ' . $command; return $this->executeLocalShellCommand($flowCommand, $arguments, $options); } + /** + * @param string $commands + * @param array $arguments + * @param array $options + */ + protected function executeLocalFlowCommand($command, $arguments = [], $options = []) + { + $flowCommand = './flow ' . $command; + return $this->executeLocalShellCommandWithFlowContext($flowCommand, $arguments, $options); + } + /** * @param $line */ diff --git a/Classes/Sitegeist/MagicWand/Command/CloneCommandController.php b/Classes/Sitegeist/MagicWand/Command/CloneCommandController.php index d4bf846..c9dbf9b 100644 --- a/Classes/Sitegeist/MagicWand/Command/CloneCommandController.php +++ b/Classes/Sitegeist/MagicWand/Command/CloneCommandController.php @@ -67,6 +67,7 @@ public function presetCommand($presetName, $yes = false, $keepDb = false) $this->clonePresets[$presetName]['port'], $this->clonePresets[$presetName]['path'], $this->clonePresets[$presetName]['context'], + ($this->clonePresets[$presetName]['postClone'] ? $this->clonePresets[$presetName]['postClone'] : NULL), $yes, $keepDb ); @@ -84,6 +85,7 @@ public function presetCommand($presetName, $yes = false, $keepDb = false) * @param string $port ssh port * @param string $path path on the remote server * @param string $context flow_context on the remote server + * @param mixded $postClone command or array of commands to be executed after cloning * @param boolean $yes confirm execution without further input * @param boolean $keepDb skip dropping of database during sync */ @@ -93,6 +95,7 @@ public function remoteHostCommand( $port, $path, $context = 'Production', + $postClone = NULL, $yes = false, $keepDb = false ) { @@ -240,6 +243,21 @@ public function remoteHostCommand( $this->outputHeadLine('Publish Resources'); $this->executeLocalFlowCommand('resource:publish'); + ############## + # Post Clone # + ############## + + if ($postClone) { + $this->outputHeadLine('Execute post_clone commands'); + if (is_array($postClone)) { + foreach($postClone as $postCloneCommand) { + $this->executeLocalShellCommandWithFlowContext($postCloneCommand); + } + } else { + $this->executeLocalShellCommandWithFlowContext($postClone); + } + } + ################# # Final Message # #################