本文整理汇总了PHP中Terminus::add_command方法的典型用法代码示例。如果您正苦于以下问题:PHP Terminus::add_command方法的具体用法?PHP Terminus::add_command怎么用?PHP Terminus::add_command使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Terminus
的用法示例。
在下文中一共展示了Terminus::add_command方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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()));
}
}
}
\Terminus::add_command('site', 'Site_Command');
示例2: array
Terminus::line('Backing up ' . $site->getName() . '.');
$backup = $site->environment('dev')->createBackup(array('element' => 'all'));
// Only continue if the backup was successful.
if ($backup) {
Terminus::success("Backup of " . $site->getName() . " created.");
Terminus::line('Updating ' . $site->getName() . '.');
// Apply the update, failure here would trigger a guzzle exception so no need to validate success.
$response = $site->applyUpstreamUpdates($env, $update, $xoption);
$data[$site->getName()]['status'] = 'Updated';
Terminus::success($site->getName() . ' is updated.');
} else {
$data[$site->getName()]['status'] = 'Backup failed';
Terminus::error('There was a problem backing up ' . $site->getName() . '. Update aborted.');
}
}
} else {
if (isset($assoc_args['report'])) {
$data[$site->getName()] = array('site' => $site->getName(), 'status' => "Up to date");
}
}
}
if (!empty($data)) {
sort($data);
$this->handleDisplay($data);
} else {
Terminus::line('No sites in need up updating.');
}
}
}
Terminus::add_command('sites', 'Sites_Command');
示例3: all
class Products_Command extends Terminus_Command
{
/**
* Search for Pantheon product info
*
* ### OPTIONS
*
* [--category=<category>]
* : general, publishing, commerce, etc
*
* [--type=<type>]
* : Pantheon internal product type definition
*
* [--framework=<drupal|wordpress>]
* : Filter based on framework
*
* @subcommand list
* @alias all
*
**/
public function all($args = array(), $assoc_args = array())
{
$defaults = array('type' => '', 'category' => '', 'framework' => '');
$assoc_args = array_merge($defaults, $assoc_args);
$products = Products::instance();
$this->handleDisplay($products->query($assoc_args), $assoc_args);
return $products;
}
}
Terminus::add_command('products', 'Products_Command');
示例4: cache_clear
public function cache_clear($args, $assoc_args)
{
if (isset($assoc_args['cache'])) {
$this->cache->remove($assoc_args['cache']);
} else {
$this->cache->flush();
}
}
/**
* Instantiate a console within Terminus
*
* ## OPTIONS
*
* [--site=<site>]
* : name of site to load
*
* @subcommand console
*/
public function console($args, $assoc_args)
{
$user = new User();
if (isset($assoc_args['site'])) {
$sitename = $assoc_args['site'];
$site_id = $this->sitesCache->findID($sitename);
$site = new Site($site_id);
}
eval(\Psy\sh());
}
}
Terminus::add_command('cli', 'CLI_Command');
示例5: all
<?php
use Terminus\Models\User;
/**
* Show information for your Pantheon instruments
*/
class Instruments_Command extends TerminusCommand
{
/**
* Show a list of your instruments on Pantheon
*
* @subcommand list
*/
public function all($args, $assoc_args)
{
$user = new User();
$instruments = $user->instruments->all();
$data = array();
foreach ($instruments as $id => $instrument) {
$data[] = array('label' => $instrument->get('label'), 'id' => $instrument->get('id'));
}
$this->output()->outputRecordList($data);
}
}
Terminus::add_command('instruments', 'Instruments_Command');
示例6: TerminusException
if (!$site) {
throw new TerminusException("Command could not be completed. Unknown site specified.");
}
# see https://github.com/pantheon-systems/titan-mt/blob/master/dashboardng/app/workshops/site/models/environment.coffee
$server = array('user' => "{$environment}.{$site->get('id')}", 'host' => "appserver.{$environment}.{$site->get('id')}.drush.in", 'port' => '2222');
if (strpos(TERMINUS_HOST, 'onebox') !== FALSE) {
$server['user'] = "appserver.{$environment}.{$site->get('id')}";
$server['host'] = TERMINUS_HOST;
}
# Sanitize assoc args so we don't try to pass our own flags.
# TODO: DRY this out?
unset($assoc_args['site']);
if (isset($assoc_args['env'])) {
unset($assoc_args['env']);
}
# Create user-friendly output
$command = implode($args, ' ');
$flags = '';
foreach ($assoc_args as $k => $v) {
if (isset($v) && (string) $v != '') {
$flags .= "--{$k}=" . escapeshellarg($v) . ' ';
} else {
$flags .= "--{$k} ";
}
}
$this->log()->info("Running wp {cmd} {flags} on {site}-{env}", array('cmd' => $command, 'flags' => $flags, 'site' => $site->get('name'), 'env' => $environment));
$this->send_command($server, 'wp', $args, $assoc_args);
}
}
Terminus::add_command('wp', 'WPCLI_Command');
示例7: all
* Show Pantheon upstream information
*/
class Upstreams_Command extends TerminusCommand
{
/**
* Search for Pantheon upstream info
*
* ### OPTIONS
*
* [--category=<category>]
* : general, publishing, commerce, etc
*
* [--type=<type>]
* : Pantheon internal upstream type definition
*
* [--framework=<drupal|wordpress>]
* : Filter based on framework
*
* @subcommand list
* @alias all
**/
public function all($args = array(), $assoc_args = array())
{
$upstreams = new Upstreams();
$upstreams_list = $upstreams->getFilteredMemberList($assoc_args, 'id', array('id', 'longname', 'category', 'type', 'framework'));
$this->handleDisplay($upstreams_list, array(), array('ID', 'Name', 'Category', 'Type', 'Framework'));
return $upstreams;
}
}
Terminus::add_command('upstreams', 'Upstreams_Command');
示例8: array
if (!$site) {
Terminus::error("Command could not be completed.");
exit;
}
$server = array('user' => "{$environment}.{$site->getId()}", 'host' => "appserver.{$environment}.{$site->getId()}.drush.in", 'port' => '2222');
if (strpos(TERMINUS_HOST, 'onebox') !== FALSE) {
$server['user'] = "appserver.{$environment}.{$site->getId()}";
$server['host'] = TERMINUS_HOST;
}
# Sanitize assoc args so we don't try to pass our own flags.
# TODO: DRY this out?
unset($assoc_args['site']);
if (isset($assoc_args['env'])) {
unset($assoc_args['env']);
}
# Create user-friendly output
$command = implode($args, ' ');
$flags = '';
foreach ($assoc_args as $k => $v) {
if (isset($v) && (string) $v != '') {
$flags .= "--{$k}={$v} ";
} else {
$flags .= "--{$k} ";
}
}
Terminus::line("Running drush %s %s on %s-%s", array($command, $flags, $site->getName(), $environment));
$this->send_command($server, 'drush', $args, $assoc_args);
}
}
Terminus::add_command('drush', 'Drush_Command');
示例9: render_subcommands
}
private static function render_subcommands($command)
{
$subcommands = array();
foreach ($command->get_subcommands() as $subcommand) {
$subcommands[$subcommand->get_name()] = $subcommand->get_shortdesc();
}
if ((bool) Terminus::get_config('json')) {
return $subcommands;
}
$max_len = self::get_max_len(array_keys($subcommands));
$lines = array();
foreach ($subcommands as $name => $desc) {
$lines[] = str_pad($name, $max_len) . "\t\t\t" . $desc;
}
return $lines;
}
private static function get_max_len($strings)
{
$max_len = 0;
foreach ($strings as $str) {
$len = strlen($str);
if ($len > $max_len) {
$max_len = $len;
}
}
return $max_len;
}
}
Terminus::add_command('help', 'Help_Command');
示例10: array
* Print the pantheon art
*
*/
class Art_Command extends TerminusCommand
{
private $works = array("fist" => "CiAgICAgICAgLisuCiAgICAgICAgLis/OgogICAgICAgICAuKz8/LgogICAgICAgICAgID8/PyAuCiAgICAgICAgICAgKz8/Py4KICAgICAgKz8/Pz8/Pz8/Pz0uCiAgICAgIC4/Pz8/Pz8/Pz8/Py4KICAgICAgLj8/Pz8/Pz8/Pz8/Py4KCiAgICAgIyMjIyMjIyMjIyMgIyMjIyMjIyMKICAgICAjIyMjIyMjIyMjIyMuIyMjIyMjIy4KICAgICAjIyMjIyMjICMjIyMgIC4uLi4uLi4KICAgICAjIyMjIyMjIyAjIyMjICMjIyMjIyMgICAgICAgICAgICAgICAgNTAgNDEgNEUgNTQgNDggNDUgNEYgNEUKICAgICAjIyMjIyMjIyMuIyMjIy4jIyMjIyMgICAgICAgIF9fX19fX19fX19fX18gIF9fICBfX19fX19fXyAgX19fXyAgX19fX19fCiAgICAgIyMjIyMjICAuLi4gICAgICAgICAgICAgICAgIC9fICBfXy8gX18vIF8gXC8gIHwvICAvICBfLyB8LyAvIC8gLyAvIF9fLwogICAgICMjIyMjIyMuPz8uIyMjIyMjIyMjIyAgICAgICAgLyAvIC8gXy8vICwgXy8gL3xfLyAvLyAvLyAgICAvIC9fLyAvXCBcCiAgICAgIyMjIyMjI34rPz8uIyMjIyMjIyMjICAgICAgIC9fLyAvX19fL18vfF8vXy8gIC9fL19fXy9fL3xfL1xfX19fL19fXy8KICAgICAjIyMjIyMjIy4/Py4uCiAgICAgIyMjIyMjIyMjLj8/LiMjIyMjIyMuCiAgICAgIyMjIyMjIyMjLis/PyAjIyMjIyMuCiAgICAgICAgICAgICAgIC4rPy4KICAgICAgICAgLj8/Pz8/Pz8/Pz8/Py4KICAgICAgICAgICArPz8/Pz8/Pz8/PywKICAgICAgICAgICAgLj8/Pz8rKysrKysuCiAgICAgICAgICAgICAgPz8/Py4KICAgICAgICAgICAgICAuPz8/LAogICAgICAgICAgICAgICAufj8/LgogICAgICAgICAgICAgICAgIC4/PwogICAgICAgICAgICAgICAgICAuPywu", "unicorn" => "ICAgICAgIFwKICAgICAgICBcCiAgICAgICAgIFxcCiAgICAgICAgICBcXAogICAgICAgICAgID5cLzcKICAgICAgIF8uLSg2JyAgXAogICAgICAoPV9fXy5fL2AgXAogICAgICAgICAgICkgIFwgfAogICAgICAgICAgLyAgIC8gfAogICAgICAgICAvICAgID4gLwogICAgICAgIGogICAgPCBfXAogICAgXy4tJyA6ICAgICAgYGAuCiAgICBcIHI9Ll9cICAgICAgICBgLgogICA8YFxcXyAgXCAgICAgICAgIC5gLS4KICAgIFwgci03ICBgLS4gLl8gICcgLiAgYFwKICAgICBcYCwgICAgICBgLS5gNyAgNykgICApCiAgICAgIFwvICAgICAgICAgXHwgIFwnICAvIGAtLl8KICAgICAgICAgICAgICAgICB8fCAgICAuJwogICAgICAgICAgICAgICAgICBcXCAgKAogICAgICAgICAgICAgICAgICAgPlwgID4KICAgICAgICAgICAgICAgLC4tJyA+LicKICAgICAgICAgICAgICA8LidfLicnCiAgICAgICAgICAgICAgICA8Jw==", "druplicon" => "ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGQnLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuWEs7LC4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdLTVg6OzssLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAueFdXWG87Ozs7OywnLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgICAgICAgICAgICAubDBXWEtPYzs7Ozs7Ozs7OywnLi4gICAgICAgICAgICAgICAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgICAgICAgIC47ZEtNTU1NWE9PbDs7Ozs7Ozs7Ozs7OzssLCcuICAgICAgICAgICAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgICAgICxkMFdNTU1NTU1OT09sOzs7Ozs7Ozs7Ozs7Ozs7Ozs7OywnLiAgICAgICAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgIDtrTk1NTU1NTU1NTjBPZDo7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OywnLiAgICAgICAgICAgICAgIA0KICAgICAgICAgICAgIC54Tk1NTU1NTU1NTU4wT3g6Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OywuICAgICAgICAgICAgIA0KICAgICAgICAgICA7ME1NTU1NTU1NTU5LT09kOjs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7LC4gICAgICAgICAgIA0KICAgICAgICAgLDBNTU1NTU1NTU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U1NTU1NTU1NTU1NTU1NTU1NTU1NTVh4YycnJycnJycnJycnYzBNTU1NTU1NTU1NTU4sICAgIA0KICAgICAuLDs7Ozs7Ozs7OztvV01NTU1NTU1NTU1NTU1NTU1NV09vOycnJyxsZGtra2tkOycnJyc6ME1NTU1NTU1NWCwgICAgIA0KICAgICAgIC4nLCwsLDs7OzssO2QwV01NTU1NTU1NTU1OT2Q6JycnJydsMFdYMGt4a09OTXgnJycnJzpPV01NTU5kLiAgICAgIA0KICAgICAgICAuJycnJycnJycnJycnJzpsb29vb29sOiwnJycnJycnJ09XTzonJycnJycnT046JycnJycnLGNsYy4gICAgICAgIA0KICAgICAgICAgIC4nJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnLCwnICAgICAgICAgIA0KICAgICAgICAgICAgLicnJycnJycnJycnJycnJycnJycnO2MnJycnJycnJycnJycnJycnJyc6bycnJywsLiAgICAgICAgICAgIA0KICAgICAgICAgICAgICAuLicnJycnJycnJycnJycnJyc7V01OT2RsOjs7LCwsLDs6Y294ME5OaywsJy4gICAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgICAuLicnJycnJycnJycnJycnLG9PWFdNTU1NTU1NTU1NTktrbzosJy4gICAgICAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgICAgICAgLi4uJycnJycnJycnJycnJycsOzs6Ojo7OywsJycuLiAgICAgICAgICAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgICAgICAgICAgICAuLi4uLicnJycnJycnJycnJy4uLi4gICAgICAgICAgICAgICAgICAgICAgICAgIA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIA0K", "wordpress" => "ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLi4uLi4uLi4uLi4uLi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4gICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgIC4uJy4uLiAgICAgICAgICAgICAgICAgICAgICAgIC4uLicuLiAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgLi4nLi4gICAgICAgICAgLi4uLi4uLi4uLi4uLi4gICAgICAgICAgLi4nLi4gICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgLi4nLi4gICAgICAgLi4uJycnJycnJycnJycnJycnJycnJycuLi4gICAgICAgIC4nLi4gICAgICAgICAgICAgICAKICAgICAgICAgICAgIC4uLi4gICAgICAuLicnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycuLiAgICAgLi4nLiAgICAgICAgICAgICAKICAgICAgICAgICAuJy4gICAgIC4uJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycuLiAgICAgLicuICAgICAgICAgICAKICAgICAgICAgLicuICAgICAuJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJy4gICAgICAuJy4gICAgICAgICAKICAgICAgICAuLiAgICAgLicnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJy4gICAgICAgICAgIC4uLiAgICAgICAKICAgICAgLicuICAgIC4nJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnJycnLiAgICAgICAgICAgICAuJy4gICAgICAKICAgICAuJy4gICAgLi4uLi4uLi4uLi4uJycnJycuLi4uLi4uLi4uLi4uLi4uLi4uLi4nJycnJycnICAgICAgICAgICAgICAgICcuICAgICAKICAgIC4nICAgICAgICAgICAgICAgICAgLicnJy4gICAgICAgICAgICAgICAgICAgIC4nJycnJycnICAgICAgICAgICAgICAgICAnLiAgICAKICAgLicgICAgICAgICAgICAgIC4uJycnJycnJycnJycuLiAgICAgICAgICAgLi4nJycnJycnJycnLiAgICAgICAgICAgIC4gICAgJy4gICAKICAuJy4gICAuICAgICAgICAgICAnJycnJycnJycnJycnJy4gICAgICAgICAgLicnJycnJycnJycnJy4gICAgICAgICAgIC4uICAgLicuICAKICAnLiAgICAnLiAgICAgICAgICAuJycnJycnJycnJycnJycuICAgICAgICAgIC4nJycnJycnJycnJycnLiAgICAgICAgIC4nLiAgIC4nICAKIC4nICAgIC4nJy4gICAgICAgICAgLicnJycnJycnJycnJycnICAgICAgICAgICAuJycnJycnJycnJycnJy4gICAgICAgICcnJyAgICAnLiAKICcuICAgLicnJycgICAgICAgICAgIC4nJycnJycnJycnJycnLiAgICAgICAgICAgJycnJycnJycnJycnJycgICAgICAgICcnJy4gICAuJyAKLicuICAgLicnJycuICAgICAgICAgICAnJycnJycnJycnJycnJy4gICAgICAgICAgLicnJycnJycnJycnJycuICAgICAgLicnJy4gICAgJy4KLicgICAgJycnJycnLiAgICAgICAgICAuJycnJycnJycnJycnJycuICAgICAgICAgIC4nJycnJycnJycnJycnICAgICAuJycnJycgICAgJy4KLicgICAgJycnJycnJy4gICAgICAgICAgLicnJycnJycnJycnJycuICAgICAgICAgICAnJycnJycnJycnJycnICAgICAnJycnJycgICAgJycKLicgICAgJycnJycnJycgICAgICAgICAgICcnJycnJycnJycnJycgICAgICAgICAgICAuJycnJycnJycnJycuICAgIC4nJycnJycgICAgJycKLicgICAgJycnJycnJycuICAgICAgICAgIC4nJycnJycnJycnJy4gICAgICAgICAgICAgLicnJycnJycnJycuICAgLicnJycnJycgICAgJy4KLicuICAgLicnJycnJycnLiAgICAgICAgICAuJycnJycnJycnLiAgICcuICAgICAgICAgICcnJycnJycnJy4gICAgJycnJycnJy4gICAgJy4KICcuICAgLicnJycnJycnJy4gICAgICAgICAgJycnJycnJycnICAgLicnICAgICAgICAgIC4nJycnJycnJyAgICAuJycnJycnJy4gICAuJyAKIC4nICAgIC4nJycnJycnJycgICAgICAgICAgLicnJycnJycuICAuJycnLiAgICAgICAgICAuJycnJycnLiAgIC4nJycnJycnJyAgICAnLiAKICAnLiAgICAnJycnJycnJycnICAgICAgICAgIC4nJycnJy4gICAnJycnJy4gICAgICAgICAgJycnJycuICAgLicnJycnJycnLiAgIC4nICAKICAuJy4gICAuJycnJycnJycnLiAgICAgICAgICAnJycnJyAgIC4nJycnJycuICAgICAgICAgLicnJycuICAgJycnJycnJycuICAgLicuICAKICAgLicuICAgLicnJycnJycnJy4gICAgICAgICAuJycnLiAgLicnJycnJycnICAgICAgICAgIC4nJy4gICAuJycnJycnJy4gICAgJy4gICAKICAgIC4nICAgIC4nJycnJycnJycgICAgICAgICAgLicuICAuJycnJycnJycnLiAgICAgICAgICAuJyAgIC4nJycnJycnLiAgICAnLiAgICAKICAgICAuJy4gICAgLicnJycnJycuICAgICAgICAgIC4gICAnJycnJycnJycnJy4gICAgICAgICAuLiAgICcnJycnJy4gICAgICcuICAgICAKICAgICAgLicuICAgIC4nJycnJycnLiAgICAgICAgICAgIC4nJycnJycnJycnJycuICAgICAgICAgICAgLicnJycnLiAgICAuJy4gICAgICAKICAgICAgICAuJy4gICAgLicnJycnJy4gICAgICAgICAgLicnJycnJycnJycnJycnICAgICAgICAgICAuJycnJy4gICAgIC4uICAgICAgICAKICAgICAgICAgLicuICAgICAuJycnJycgICAgICAgICAgJycnJycnJycnJycnJycnLiAgICAgICAgIC4nJycuICAgICAuJy4gICAgICAgICAKICAgICAgICAgICAuJy4gICAgIC4uJycuICAgICAgICAuJycnJycnJycnJycnJycnJy4gICAgICAgICcuLiAgICAgLicuICAgICAgICAgICAKICAgICAgICAgICAgIC4uLi4gICAgICAuLiAgICAgIC4nJycnJycnJycnJycnJycnJycuICAgICAgICAgICAgLi4uLiAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC4nLi4gICAgICAgICAgICcnJycnJycnJycnJycnJycnJycuICAgICAgICAgLi4nLi4gICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgIC4uLi4gICAgICAgICAgIC4uLi4uLi4uLi4uLiAgICAgICAgICAgLi4nLiAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgIC4uLi4uLiAgICAgICAgICAgICAgICAgICAgICAgIC4uLicuLiAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4gICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLi4uLi4uJycuLi4uLi4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAK");
/**
* View Pantheon artwork
*
* ## Options
*
* fist
*
* unicorn
*
* druplicon
*
* wordpress
*/
function __invoke($args, $assoc_args)
{
$artwork = array_shift($args) ?: array_rand($this->works);
if (!empty($artwork) && array_key_exists($artwork, $this->works)) {
echo Terminus::colorize("%g" . base64_decode($this->works[$artwork]) . "%n") . "\n";
} else {
throw new TerminusException("No formula for requested artwork");
}
}
}
Terminus::add_command('art', 'Art_Command');
示例11: array
{
$org_id = Input::orgid($assoc_args, 'org', null, array('allow_none' => false));
$org = new Organization($org_id);
if (isset($assoc_args['add'])) {
$add = SiteFactory::instance(Input::sitename($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::sitename($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;
}
$org->siteMemberships->fetch();
$memberships = $org->siteMemberships->all();
foreach ($memberships as $membership) {
if (isset($assoc_args['tag']) && !in_array($assoc_args['tag'], $membership->get('tags'))) {
continue;
}
$site = $membership->get('site');
$data[] = array('name' => $site->name, 'id' => $site->id, 'service_level' => $site->service_level, 'framework' => $site->framework, 'created' => date('Y-m-d H:i:s', $site->created), 'tags' => $membership->get('tags'));
}
$this->handleDisplay($data);
}
}
Terminus::add_command('organizations', 'Organizations_Command');
示例12: TerminusException
throw new TerminusException("Unsuccessful login");
}
// Prepare credentials for storage.
$data = array('user_uuid' => $response['data']->user_id, 'session' => $response['data']->session, 'session_expire_time' => $response['data']->expires_at, 'email' => $email);
// creates a session instance
Session::instance()->setData($data);
return $data;
}
/**
* Execute the login based on an existing session token
*
* @param $session_token string (required)
* @return array
*/
private function doLoginFromSessionToken($session_token)
{
$options = array('headers' => array('Content-type' => 'application/json'), 'cookies' => array('X-Pantheon-Session' => $session_token));
# Temporarily disable the cache for this GET call
$response = TerminusCommand::request('user', '', '', 'GET', $options);
if (!$response or '200' != @$response['info']['http_code']) {
throw new TerminusException("Session token not valid");
}
// Prepare credentials for storage.
$data = array('user_uuid' => $response['data']->id, 'session' => $session_token, 'session_expire_time' => 0, 'email' => $response['data']->email);
// creates a session instance
Session::instance()->setData($data);
return $data;
}
}
Terminus::add_command('auth', 'Auth_Command');
示例13: array
$data = array('refspec' => 'refs/heads/' . $branch_name);
//TODO: format output
return $this->terminus_request("site", $this->_siteInfo->site_uuid, 'code-branch', "POST", $data);
}
/**
* API Call to delete branch.
*/
function branchdelete(array $args, array $assoc_args)
{
$branch_name = array_shift($args);
$data = array('refspec' => 'refs/heads/' . $branch_name);
//TODO: format output
return $this->terminus_request("site", $this->_siteInfo->site_uuid, "code-branch", "DELETE", $data);
}
/**
* API Call to Update Core Status
* [--updatedb=<true|false>]
* : specify the site on which the command should be performed
* [--xoption=<theirs|mine>]
* : specifies the merge option
*/
function upstreamupdate(array $args, array $assoc_args)
{
$path = 'code-upstream-updates';
$data = array('updatedb' => array_key_exists("updatedb", $assoc_args) ? $assoc_args['updatedb'] : false, 'xoption' => array_key_exists("xoption") ? $assoc_args['updatedb'] : 'theirs');
//TODO: format output
return $this->terminus_request("site", $this->_siteInfo->site_uuid, $path, "POST", $data);
}
}
Terminus::add_command('code', 'Code_Command');