diff --git a/lib/command.php b/lib/command.php index 0cd5b0f..27ef75b 100644 --- a/lib/command.php +++ b/lib/command.php @@ -63,23 +63,23 @@ protected function _push_command($command_name, $args, $flags) $this->_execute_commands($commands, $args); } - protected function _pull_command($command_name, $args, $flags) - { - $this->params = self::_prepare_and_extract( $args ); - $this->flags = $flags; - extract($this->params); + protected function _pull_command( $command_name, $args, $flags ) { + $this->params = self::_prepare_and_extract( $args ); + $this->flags = $flags; + extract( $this->params ); + /* @var $env $this->params['env'] */ - $const = strtoupper( ENVIRONMENT ) . '_LOCKED'; + $const = strtoupper( $env ) . '_LOCKED'; if ( constant( $const ) === true ) { - return WP_CLI::error( ENVIRONMENT . ' env is locked, you can not pull to your local copy' ); + return WP_CLI::error( $env . ' env is locked, you can not pull to your local copy' ); } - require 'puller.php'; + require 'puller.php'; - $reflectionMethod = new ReflectionMethod('WP_Deploy_Flow_Puller', $command_name); - $commands = $reflectionMethod->invoke(new WP_Deploy_Flow_Puller($this->params)); + $reflectionMethod = new ReflectionMethod( 'WP_Deploy_Flow_Puller', $command_name ); + $commands = $reflectionMethod->invoke( new WP_Deploy_Flow_Puller( $this->params ) ); - $this->_execute_commands($commands, $args); + $this->_execute_commands( $commands, $args ); } protected function _execute_commands($commands) diff --git a/lib/puller.php b/lib/puller.php index ea4b237..8ff1fe0 100644 --- a/lib/puller.php +++ b/lib/puller.php @@ -69,12 +69,17 @@ protected function _commands_for_files(&$commands) { protected function _commands_for_database_import_thru_ssh(&$commands) { - extract( $this->params ); + extract( $this->params ); + /* @var $db_host $this->params['db_host'] */ + /* @var $db_port $this->params['db_port'] */ + /* @var $ssh_user $this->params['ssh_user'] */ + /* @var $ssh_host $this->params['ssh_host'] */ + /* @var $ssh_port $this->params['ssh_port'] */ $host = $db_host . ':' . $db_port; $dist_path = constant( WP_Deploy_Flow_Command::config_constant( 'path' ) ) . '/'; $commands[]= array("ssh $ssh_user@$ssh_host -p $ssh_port \"cd $dist_path;wp db export dump.sql;\"", true); - $commands[]= array("scp $ssh_user@$ssh_host:$dist_path/dump.sql .", true); + $commands[]= array("scp $ssh_user@$ssh_host:${dist_path}dump.sql .", true); $commands[]= array("ssh $ssh_user@$ssh_host -p $ssh_port \"cd $dist_path; rm dump.sql;\"", true); } @@ -103,4 +108,4 @@ protected function _commands_for_database_dump(&$commands) { $commands[]= array( "wp search-replace $search $replace", true ); } } -} \ No newline at end of file +}