本文整理匯總了PHP中Terminus\Helpers\Input::site方法的典型用法代碼示例。如果您正苦於以下問題:PHP Input::site方法的具體用法?PHP Input::site怎麽用?PHP Input::site使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Terminus\Helpers\Input
的用法示例。
在下文中一共展示了Input::site方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sites
/**
* List an organizations sites
*
* ## OPTIONS
*
* [--org=<org>]
* : Organization name or Id
*
* [--add=<site>]
* : Site to add to organization
*
* [--remove=<site>]
* : Site to remove from organization
*
* @subcommand sites
*
*/
public function sites($args, $assoc_args)
{
$orgs = array();
$user = new User();
foreach ($user->organizations() as $id => $org) {
$orgs[$id] = $org->name;
}
if (!isset($assoc_args['org']) or empty($assoc_args['org'])) {
$selected_org = Terminus::menu($orgs, false, "Choose an organization");
} else {
$selected_org = $assoc_args['org'];
}
$org = new Organization($selected_org);
if (isset($assoc_args['add'])) {
$add = SiteFactory::instance(Input::site($assoc_args, 'add'));
Terminus::confirm("Are you sure you want to add %s to %s ?", $assoc_args, array($add->getName(), $org->name));
$org->addSite($add);
Terminus::success("Added site!");
return true;
}
if (isset($assoc_args['remove'])) {
$remove = SiteFactory::instance(Input::site($assoc_args, 'remove'));
Terminus::confirm("Are you sure you want to remove %s to %s ?", $assoc_args, array($remove->getName(), $org->name));
$org->removeSite($remove);
Terminus::success("Removed site!");
return true;
}
$sites = $org->getSites();
$data = array();
foreach ($sites as $site) {
$data[] = array('name' => $site->site->name, 'service level' => isset($site->site->service_level) ? $site->site->service_level : '', 'framework' => isset($site->site->framework) ? $site->site->framework : '', 'created' => date('Y-m-d H:i:s', $site->site->created));
}
$this->handleDisplay($data);
}
示例2: wipe
/**
* Complete wipe and reset a site
*
* ## OPTIONS
*
* [--site=<site>]
* : Site to use
*
* [--env=<env>]
* : Specify environment, default = dev
*/
public function wipe($args, $assoc_args)
{
try {
$env = @$assoc_args['env'] ?: 'dev';
$site = SiteFactory::instance(Input::site($assoc_args));
$site_id = $site->getId();
$env = Input::env($assoc_args, 'env');
Terminus::line("Wiping %s %s", array($site_id, $env));
$resp = $site->environment($env)->wipe();
if ($resp) {
$this->waitOnWorkflow('sites', $site_id, $resp['data']->id);
Terminus::success("Successfully wiped %s -- %s", array($site->getName(), $env));
}
} catch (Exception $e) {
Terminus::error("%s", array($e->getMessage()));
}
}