本文整理汇总了PHP中Terminus\Helpers\Input::siteName方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::siteName方法的具体用法?PHP Input::siteName怎么用?PHP Input::siteName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Terminus\Helpers\Input
的用法示例。
在下文中一共展示了Input::siteName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showBackupSchedule
/**
* Displays an environment's regular backup schedule
*
* @params array $assoc_args Parameters and flags from the command line
* @return void
*/
private function showBackupSchedule($assoc_args)
{
$site = $this->sites->get(Input::siteName(array('args' => $assoc_args)));
$env = $site->environments->get(Input::env(array('args' => $assoc_args, 'choices' => array('dev', 'live'))));
$schedule = $env->backups->getBackupSchedule();
if (is_null($schedule['daily_backup_hour'])) {
$this->log()->info('Backups are not currently scheduled to be run.');
} else {
$this->output()->outputRecord($schedule);
}
}
示例2: watch
/**
* Streams new and finished workflows to the console
*
* ## OPTIONS
* [--site=<site>]
* : Site from which to list workflows
*
* @subcommand watch
*/
public function watch($args, $assoc_args)
{
$site = $this->sites->get(Input::siteName(array('args' => $assoc_args)));
// Keep track of workflows that have been printed.
// This is necessary because the local clock may drift from
// the server's clock, causing events to be printed twice.
$started = array();
$finished = array();
$this->logger->info('Watching workflows...');
$site->workflows->fetchWithOperations();
while (true) {
$last_created_at = $site->workflows->lastCreatedAt();
$last_finished_at = $site->workflows->lastFinishedAt();
sleep(WORKFLOWS_WATCH_INTERVAL);
$site->workflows->fetchWithOperations();
$workflows = $site->workflows->all();
foreach ($workflows as $workflow) {
if ($workflow->get('created_at') > $last_created_at && !in_array($workflow->id, $started)) {
array_push($started, $workflow->id);
$started_message = sprintf("Started %s %s (%s)", $workflow->id, $workflow->get('description'), $workflow->get('environment'));
$this->logger->info($started_message);
}
if ($workflow->get('finished_at') > $last_finished_at && !in_array($workflow->id, $finished)) {
array_push($finished, $workflow->id);
$finished_message = sprintf("Finished Workflow %s %s (%s)", $workflow->id, $workflow->get('description'), $workflow->get('environment'));
$this->logger->info($finished_message);
if ($workflow->get('has_operation_log_output')) {
$workflow->fetchWithLogs();
$operations = $workflow->operations();
foreach ($operations as $operation) {
if ($operation->has('log_output')) {
$log_msg = sprintf("\n------ %s (%s) ------\n%s", $operation->description(), $operation->get('environment'), $operation->get('log_output'));
$this->log()->info($log_msg);
}
}
}
}
}
}
}
示例3: getElements
/**
* Parent function to SSH-based command invocations
*
* @param string[] $args Command(s) given in the command line
* @param string[] $assoc_args Arguments and flags passed into the former
* @return array Elements as follow:
* Site site Site being invoked
* string env_id Name of the environment being invoked
* string command Command to run remotely
* string server Server connection info
*/
protected function getElements($args, $assoc_args)
{
$this->ensureQuotation($args, $assoc_args);
$command = array_pop($args);
$this->checkCommand($command);
$sites = new Sites();
$site = $sites->get(Input::siteName(array('args' => $assoc_args)));
if (!$site) {
$this->failure('Command could not be completed. Unknown site specified.');
}
$env_id = Input::env(array('args' => $assoc_args, 'site' => $site));
if (!in_array($env_id, ['test', 'live'])) {
$this->checkConnectionMode($site->environments->get($env_id));
}
$elements = array('site' => $site, 'env_id' => $env_id, 'command' => $command, 'server' => $this->getAppserverInfo(array('site' => $site->get('id'), 'environment' => $env_id)));
return $elements;
}