Skip to content

Instantly share code, notes, and snippets.

@lordspace
Created December 15, 2014 09:44
Show Gist options
  • Save lordspace/8ed26797223232fe7c0e to your computer and use it in GitHub Desktop.
Save lordspace/8ed26797223232fe7c0e to your computer and use it in GitHub Desktop.
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