本文整理汇总了PHP中Terminus::launchSelf方法的典型用法代码示例。如果您正苦于以下问题:PHP Terminus::launchSelf方法的具体用法?PHP Terminus::launchSelf怎么用?PHP Terminus::launchSelf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Terminus
的用法示例。
在下文中一共展示了Terminus::launchSelf方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
/**
* Log in as a user
*
* ## OPTIONS
* [<email>]
* : Email address to log in as.
*
* [--password=<value>]
* : Log in non-interactively with this password. Useful for automation.
*
* [--machine-token=<value>]
* : Authenticate using an Auth0 token
*
* [--debug]
* : dump call information when logging in.
*/
public function login($args, $assoc_args)
{
// Try to login using a machine token, if provided.
if (isset($assoc_args['machine-token']) || empty($args) && isset($_SERVER['TERMINUS_MACHINE_TOKEN'])) {
$token = $_SERVER['TERMINUS_MACHINE_TOKEN'];
if (isset($assoc_args['machine-token'])) {
$token = $assoc_args['machine-token'];
}
$this->auth->logInViaMachineToken($token);
} else {
// Otherwise, do a normal email/password-based login.
if (empty($args)) {
if (isset($_SERVER['TERMINUS_USER'])) {
$email = $_SERVER['TERMINUS_USER'];
} else {
$email = Terminus::prompt('Your email address?', null);
}
} else {
$email = $args[0];
}
if (isset($assoc_args['password'])) {
$password = $assoc_args['password'];
} else {
$password = Terminus::promptSecret('Your dashboard password (input will not be shown)');
}
$this->auth->logInViaUsernameAndPassword($email, $password);
}
$this->log()->debug(get_defined_vars());
Terminus::launchSelf('art', array('fist'));
}
示例2: testLaunchSelf
public function testLaunchSelf()
{
$file_name = '/tmp/output';
setOutputDestination($file_name);
$return = Terminus::launchSelf("art unicorn > {$file_name}");
$output = retrieveOutput($file_name);
$this->assertTrue(strpos($output, "<.'_.''") !== false);
$this->assertEquals($return, 0);
resetOutputDestination($file_name);
}
示例3: testLaunchSelf
public function testLaunchSelf()
{
$file_name = '/tmp/output';
//Testing the library route
setOutputDestination($file_name);
$return = Terminus::launchSelf("art unicorn > {$file_name}");
$output = retrieveOutput($file_name);
$this->assertTrue(strpos($output, "<.'_.''") !== false);
$this->assertEquals($return, 0);
resetOutputDestination($file_name);
//Testing the command-line route
setOutputDestination($file_name);
$GLOBALS['argv'] = [__DIR__ . '/../../php/boot-fs.php'];
$return = Terminus::launchSelf("art unicorn > {$file_name}");
$output = retrieveOutput($file_name);
$this->assertTrue(strpos($output, "<.'_.''") !== false);
$this->assertEquals($return, 0);
resetOutputDestination($file_name);
}
示例4: 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;
}
示例5: _checkSession
private function _checkSession()
{
if (!property_exists($this, "session") || !property_exists($this->session, "user_uuid")) {
return false;
}
$results = $this->terminus_request("user", $this->session->user_uuid, "profile", "GET");
if ($results['info']['http_code'] >= 400) {
$this->failure('Your session is expired. Please reauthenticate.');
$this->cache->remove('session');
Terminus::launchSelf("auth", array("login"));
$this->whoami();
return true;
} else {
return $results['info']['http_code'] <= 199 || $results['info']['http_code'] >= 300 ? false : true;
}
}