Пример #1
0
<?php

/**
 * Override the native shell and use DS-CLI's (https://github.com/Steveorevo/ds-cli) bash on Mac or Windows to lftp
 * the lastest copy of WordPress to an example hosting provider.
 *
 * Prerequisites - DesktopServer 3.8.1 or better with the DS-CLI plugin installed.
 *
 */
require '../vendor/autoload.php';
include '../src/Steveorevo/VirtualCLI/VirtualCLI.php';
use Steveorevo\VirtualCLI\VCLIManager;
use Steveorevo\VirtualCLI\VirtualCLI;
// Determine the shell runtime via DS-CLI's boot script for the given platform
VCLIManager::init();
if (VCLIManager::$platform === 'win32') {
    $shell = '"c:\\xampplite\\ds-plugins\\ds-cli\\platform\\win32\\boot.bat" bash.exe --posix -i';
    $wait = 0;
} else {
    $shell = "/Applications/XAMPP/ds-plugins/ds-cli/platform/mac/boot.sh bash";
    $wait = "bash";
}
// Create a new virtual command line interface running bash with a 5 minute timeout
$myVCLI = new VirtualCLI("ds-cli-example", 5 * 60, $shell, $wait, ";");
// Change directories to the home folder
$myVCLI->add_command("ls -la");
// Change directories to the home folder
$myVCLI->add_command("cd ~");
// Remove any prior wordpress folder and latest.zip file
$myVCLI->add_command("rm latest.zip;rm -rf wordpress");
// Download the latest copy of WordPress