File: //usr/local/sbin/hp-generate-apache-vhost
#!/usr/bin/env php
<?php
require_once("/usr/local/share/hostingplatform/esrpc.php");
$client = new ESRPCConnection();
$client->connect("hp-esrpc");
$target = $client->get();
if (count($argv) <= 1) usage();
function usage() {
global $argv;
print $argv[0];
print ": <packagename>\n";
print $argv[0];
print ": --all\n";
exit(1);
}
if($argv[1] == "--all") {
$packages = $target->listHostingPackages();
foreach($packages as $package => $details) {
print "Generating config for " . $package . "\n";
try {
$target->__generateApacheVHOST($package);
} catch (Exception $e) {
echo $e->getTraceAsString();
}
}
}
else {
$target->__generateApacheVHOST($argv[1]);
}