diff --git a/deploy.php b/deploy.php index ef863a4..866fc80 100644 --- a/deploy.php +++ b/deploy.php @@ -178,6 +178,10 @@ public function __construct() { try { self::$configEnv = Yaml::parse(file_get_contents('wp-cli.yml')); + if (file_exists('wp-cli.local.yml')) { + $localConfigEnv = Yaml::parse(file_get_contents('wp-cli.local.yml')); + self::$configEnv = array_merge(self::$configEnv, $localConfigEnv); + } } catch (ParseException $e) { WP_Cli::error( "Unable to parse the YAML string: " . $e->getMessage() ); } @@ -230,6 +234,7 @@ public function __construct() { 'url' ), 'optional' => array( + 'working_dir', 'port', 'post_hook', 'excludes' @@ -603,6 +608,14 @@ private function pull_db() { $server_file = "{$c->env}_{$c->timestamp}.sql"; + $url_with_https = $c->url; + $site_url_with_https = $c->siteurl; + + if($c->https == '1') { + $url_with_https = 'https://' . $c->url; + $site_url_with_https = 'http://' . $c->siteurl; + } + $runner = self::$runner; $runner->add( @@ -643,8 +656,8 @@ private function pull_db() { $runner->add( ( $c->siteurl != $c->url ), - "wp search-replace --all-tables $c->url $c->siteurl", - "Replaced '$c->url' with '$c->siteurl' on the imported database." + "wp search-replace --all-tables $url_with_https $site_url_with_https", + "Replaced '$url_with_https' with '$site_url_with_https' on the imported database." ); $runner->add( @@ -995,6 +1008,11 @@ private static function expand( $config, $constants, $command, $what, $themename 'object' => (object) Util::array_map_recursive( 'untrailingslashit', $constants ), ); + // Change working_dir + if ( isset( $constants['working_dir'] ) ) { + $config['wd'] = str_replace('%%abspath%%', '%%working_dir%%', $config['wd']); + } + foreach ( $config as &$item ) { $item = Util::unplaceholdit( $item, array_merge( /** This ensures we can have dependecies. */