From 6e0d683611b462b1d4e814cdaafd56331b1652f9 Mon Sep 17 00:00:00 2001 From: Ngoc Luong Date: Thu, 26 Apr 2018 13:44:32 +0700 Subject: [PATCH 1/3] Support wp-cli.local.yml --- deploy.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deploy.php b/deploy.php index ef863a4..41d3826 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() ); } From b29e790fd7625dea474569c1617563d8375e0f53 Mon Sep 17 00:00:00 2001 From: Ngoc Luong Date: Fri, 25 May 2018 14:56:48 +0700 Subject: [PATCH 2/3] Allow use custom working_dir path --- deploy.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/deploy.php b/deploy.php index 41d3826..838f97b 100644 --- a/deploy.php +++ b/deploy.php @@ -234,6 +234,7 @@ public function __construct() { 'url' ), 'optional' => array( + 'working_dir', 'port', 'post_hook', 'excludes' @@ -999,6 +1000,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. */ From a6ed1392dda8d061ab41f4a62571ef5f935ced1c Mon Sep 17 00:00:00 2001 From: Ngoc Luong Date: Fri, 25 May 2018 15:32:17 +0700 Subject: [PATCH 3/3] Support https when pull db from remote --- deploy.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/deploy.php b/deploy.php index 838f97b..866fc80 100644 --- a/deploy.php +++ b/deploy.php @@ -608,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( @@ -648,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(