Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions lib/command.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 8 additions & 3 deletions lib/puller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -103,4 +108,4 @@ protected function _commands_for_database_dump(&$commands) {
$commands[]= array( "wp search-replace $search $replace", true );
}
}
}
}