Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to Sync Your Plugins with a Staging Server Using WP-CLI
<?php
/**
* This script allows you to sync plugins from development machine with staging/live servers.
* Author: Svetoslav Marinov (SLAVI) | http://orbisius.com
* (c) All Rights Reserved.
* (c) Dec 2014
* License: LGPL
* zzz_sync.php
*/
$pwd = 'qsandbox';
if (empty($_REQUEST['sync_pwd']) || $_REQUEST['sync_pwd'] != $pwd) {
die('Hi');
}
echo "<pre>";
$plugin_urls = array(
'your-plugin-slug' => 'http://www.dropbox.com/s/..........?dl=1',
);
foreach ($plugin_urls as $plugin_name => $dl_url) {
echo "Installing [<strong>$plugin_name</strong>] from: [$dl_url]\n";
flush();
$dl_url_esc = escapeshellarg($dl_url);
// This will delete the previous plugin!!!
$cmd = "wp plugin install --force $dl_url_esc --activate";
echo `$cmd 2>&1`;
echo "\n";
flush();
}
echo "</pre>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.