本文整理汇总了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()));
}
}