本文整理汇总了PHP中Terminus\Helpers\Input::upstream方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::upstream方法的具体用法?PHP Input::upstream怎么用?PHP Input::upstream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Terminus\Helpers\Input
的用法示例。
在下文中一共展示了Input::upstream方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Create a new site
*
* ## OPTIONS
*
* [--site=<site>]
* : Name of the site to create (machine-readable)
*
* [--name=<name>]
* : (deprecated) use --site instead
*
* [--label=<label>]
* : Label for the site
*
* [--upstream=<upstreamid>]
* : Specify the upstream upstream to use
*
* [--import=<url>]
* : A url to import a valid archive
*
* [--org=<id>]
* : UUID of organization into which to add this site
*
*/
public function create($args, $assoc_args)
{
$options = array();
$options['label'] = Input::string($assoc_args, 'label', "Human-readable label for the site");
$suggested_name = Utils\sanitize_name($options['label']);
if (array_key_exists('name', $assoc_args)) {
// Deprecated but kept for backwards compatibility
$options['name'] = $assoc_args['name'];
} elseif (array_key_exists('site', $assoc_args)) {
$options['name'] = $assoc_args['site'];
} elseif (isset($_SERVER['TERMINUS_SITE'])) {
$options['name'] = $_SERVER['TERMINUS_SITE'];
} else {
$options['name'] = Input::string($assoc_args, 'site', "Machine name of the site; used as part of the default URL (if left blank will be {$suggested_name})", $suggested_name);
}
if (isset($assoc_args['org'])) {
$options['organization_id'] = Input::orgid($assoc_args, 'org', false);
}
if (!isset($assoc_args['import'])) {
$upstream = Input::upstream($assoc_args, 'upstream');
$options['upstream_id'] = $upstream->get('id');
Terminus::line(sprintf("Creating new %s installation ... ", $upstream->get('longname')));
}
$workflow = Site::create($options);
$workflow->wait();
Terminus::success("Pow! You created a new site!");
// Add Site to SitesCache
$final_task = $workflow->get('final_task');
$site = new Site($final_task->site_id);
$site->fetch();
$cache_membership = array('id' => $final_task->site_id, 'name' => $options['name'], 'created' => $site->attributes->created, 'service_level' => $site->attributes->service_level, 'framework' => $site->attributes->framework);
if ($org_id) {
$org = new Organization($org_id);
$cache_membership['membership'] = array('id' => $org_id, 'name' => $org->profile->name, 'type' => 'organization');
} else {
$user_id = Session::getValue('user_uuid');
$cache_membership['membership'] = array('id' => $user_id, 'name' => 'Team', 'type' => 'team');
}
$sites_cache = new Terminus\SitesCache();
$sites_cache->add($cache_membership);
if (isset($assoc_args['import'])) {
sleep(10);
//To stop erroenous site-DNE errors
Terminus::launch_self('site', array('import'), array('url' => $assoc_args['import'], 'site' => $options['name'], 'element' => 'all'));
} else {
Terminus::launch_self('site', array('info'), array('site' => $options['name']));
}
return true;
}
示例2: create
/**
* Create a new site
*
* ## OPTIONS
*
* [--site=<site>]
* : Name of the site to create (machine-readable)
*
* [--name=<name>]
* : (deprecated) use --site instead
*
* [--label=<label>]
* : Label for the site
*
* [--upstream=<upstreamid>]
* : Specify the upstream upstream to use
*
* [--org=<id>]
* : UUID of organization into which to add this site
*
*/
public function create($args, $assoc_args)
{
$options = Sites_Command::getSiteCreateOptions($assoc_args);
$upstream = Input::upstream($assoc_args, 'upstream');
$options['upstream_id'] = $upstream->get('id');
$this->log()->info("Creating new {upstream} installation ... ", array('upstream' => $upstream->get('longname')));
$workflow = $this->sites->addSite($options);
$workflow->wait();
$this->workflowOutput($workflow);
// Add Site to SitesCache
$final_task = $workflow->get('final_task');
$this->sites->addSiteToCache($final_task->site_id);
Terminus::launchSelf('site', array('info'), array('site' => $options['name']));
return true;
}
示例3: create
/**
* Create a new site
*
* ## OPTIONS
*
* [--site=<site>]
* : Name of the site to create (machine-readable)
*
* [--name=<name>]
* : (deprecated) use --site instead
*
* [--label=<label>]
* : Label for the site
*
* [--upstream=<upstreamid>]
* : Specify the upstream upstream to use
*
* [--import=<url>]
* : A url to import a valid archive
*
* [--org=<id>]
* : UUID of organization into which to add this site
*
*/
public function create($args, $assoc_args)
{
$options = array();
$options['label'] = Input::string($assoc_args, 'label', "Human-readable label for the site");
$suggested_name = Utils\sanitize_name($options['label']);
if (array_key_exists('name', $assoc_args)) {
// Deprecated but kept for backwards compatibility
$options['name'] = $assoc_args['name'];
} elseif (array_key_exists('site', $assoc_args)) {
$options['name'] = $assoc_args['site'];
} elseif (isset($_SERVER['TERMINUS_SITE'])) {
$options['name'] = $_SERVER['TERMINUS_SITE'];
} else {
$options['name'] = Input::string($assoc_args, 'site', "Machine name of the site; used as part of the default URL (if left blank will be {$suggested_name})", $suggested_name);
}
if (isset($assoc_args['org'])) {
$options['organization_id'] = Input::orgid($assoc_args, 'org', false);
}
if (!isset($assoc_args['import'])) {
$upstream = Input::upstream($assoc_args, 'upstream');
$options['upstream_id'] = $upstream->get('id');
Terminus::line(sprintf("Creating new %s installation ... ", $upstream->get('longname')));
}
$workflow = $this->sites->addSite($options);
$workflow->wait();
$this->workflowOutput($workflow);
// Add Site to SitesCache
$final_task = $workflow->get('final_task');
$this->sites->addSiteToCache($final_task->site_id);
if (isset($assoc_args['import'])) {
sleep(10);
//To stop erroenous site-DNE errors
Terminus::launch_self('site', array('import'), array('url' => $assoc_args['import'], 'site' => $options['name'], 'element' => 'all'));
} else {
Terminus::launch_self('site', array('info'), array('site' => $options['name']));
}
return true;
}