Skip to content
This repository was archived by the owner on Mar 10, 2025. It is now read-only.
Open
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: 20 additions & 2 deletions deploy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
}
Expand Down Expand Up @@ -230,6 +234,7 @@ public function __construct() {
'url'
),
'optional' => array(
'working_dir',
'port',
'post_hook',
'excludes'
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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. */
Expand Down