Skip to content

Conversation

shayanabbas
Copy link

No description provided.

}
$newLines[] = 'Config::define(\'WP_HOME\', \'' . get('url', 'https://') . '\');';
file_put_contents($file, implode('', $newLines));
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn’t this run on the remote host? it needs to run locally so you can commit it to git (or else a deploy would wipe the change).

current_path would hold the path https://github.com/deployphp/deployer/blob/fb6f2154ef36f03e4e4b0644206b06722ee09fd8/recipe/common.php#L99.

you can use __DIR__ to get root of the project, you can confirm it works by looking at how the rsync works https://github.com/deployphp/deployer/blob/master/contrib/rsync.php#L135

note that no production.php config exists on sites currently, you should check it exists and is writable: is_writable()

$newLines[] = $line;
}
}
$newLines[] = 'Config::define(\'WP_HOME\', \'' . get('url', 'https://') . '\');';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is quite difficult to read because of the escaping. compare to eg.

Suggested change
$newLines[] = 'Config::define(\'WP_HOME\', \'' . get('url', 'https://') . '\');';
$newLines[] = sprintf("Config::define('WP_HOME', '%s');", get('url', 'https://'));

$dbUser = ask('DB_USER', get('scaffold_machine_name', ''));
$dbPassword = askHiddenResponse('DB_PASSWORD');
$wpEnv = ask('WP_ENV', currentHost()->getAlias());
$wpHome = ask('WP_HOME', $url);
Copy link
Member

@oxyc oxyc Dec 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep these but default them to empty? And only add them if user has set them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants