Skip to content

Instantly share code, notes, and snippets.

@ekandreas
Last active May 18, 2017 10:21
Show Gist options
  • Save ekandreas/b412df9d35407e0deb5ae02f35c4d90e to your computer and use it in GitHub Desktop.
Save ekandreas/b412df9d35407e0deb5ae02f35c4d90e to your computer and use it in GitHub Desktop.
/**
* Deployer pull task for reversed deployment of WordPress Bedrock
* PHP Deployer v5
*/
task('pull', function () {
$host = Context::get()->getHost();
$user = $host->getUser();
$hostname = $host->getHostname();
$localHostname = str_replace('.se', '.app', $hostname);
$actions = [
"ssh {$user}@{$hostname} 'cd {{deploy_path}}/current && wp db export - --allow-root | gzip' > db.sql.gz",
"gzip -df db.sql.gz",
"wp db import db.sql",
"rm -f db.sql",
"wp search-replace 'www.{$hostname}' '{$localHostname}'",
"wp search-replace '{$hostname}' '{$localHostname}'",
"wp search-replace 'https://{$localHostname}' 'http://{$localHostname}'",
"rsync --exclude .cache -rve ssh " .
"{$user}@{$hostname}:{{deploy_path}}/shared/web/app/uploads web/app",
"wp plugin deactivate varnish-http-purge",
"wp plugin deactivate elasticpress",
"wp plugin activate query-monitor",
"wp rewrite flush",
"wp cache flush"
];
foreach ($actions as $action) {
writeln("{$action}");
writeln(runLocally($action));
}
});
@ekandreas
Copy link
Author

Updated for Deployer v5 and with agnostic hosts settings

@ekandreas
Copy link
Author

Typo cache flush fixed

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