当前位置: 首页>>代码示例>>PHP>>正文


PHP Terminus::error方法代码示例

本文整理汇总了PHP中Terminus::error方法的典型用法代码示例。如果您正苦于以下问题:PHP Terminus::error方法的具体用法?PHP Terminus::error怎么用?PHP Terminus::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Terminus的用法示例。


在下文中一共展示了Terminus::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __invoke

 /**
  * Invoke `drush` commands on a Pantheon development site
  *
  * <commands>...
  * : The Drush commands you intend to run.
  *
  * [--<flag>=<value>]
  * : Additional Drush flag(s) to pass in to the command.
  *
  * [--site=<site>]
  * : The name (DNS shortname) of your site on Pantheon.
  *
  * [--env=<environment>]
  * : Your Pantheon environment. Default: dev
  *
  */
 function __invoke($args, $assoc_args)
 {
     $environment = Input::env($assoc_args);
     $sites = new Sites();
     $site = $sites->get(Input::sitename($assoc_args));
     if (!$site) {
         Terminus::error("Command could not be completed. Unknown site specified.");
         exit;
     }
     $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}={$v} ";
         } else {
             $flags .= "--{$k} ";
         }
     }
     $this->logger->info("Running drush %s %s on %s-%s", array($command, $flags, $site->get('name'), $environment));
     $this->send_command($server, 'drush', $args, $assoc_args);
 }
开发者ID:newtoid,项目名称:cli,代码行数:49,代码来源:drush.php

示例2: __invoke

 /**
  * Invoke `wp` commands on a Pantheon development site
  *
  * <commands>...
  * : The WP-CLI commands you intend to run.
  *
  * [--<flag>=<value>]
  * : Additional WP-CLI flag(s) to pass in to the command.
  *
  * [--site=<site>]
  * : The name (DNS shortname) of your site on Pantheon.
  *
  * [--env=<environment>]
  * : Your Pantheon environment. Default: dev
  *
  */
 function __invoke($args, $assoc_args)
 {
     $environment = Input::env($assoc_args);
     $sites = new Sites();
     $site = $sites->get(Input::sitename($assoc_args));
     if (!$site) {
         Terminus::error("Command could not be completed. Unknown site specified.");
         exit;
     }
     # 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->logger->info("Running wp %s %s on %s-%s", array($command, $flags, $site->get('name'), $environment));
     $this->send_command($server, 'wp', $args, $assoc_args);
 }
开发者ID:newtoid,项目名称:cli,代码行数:50,代码来源:wp.php

示例3: __construct

 public function __construct($filename, $delimiter = ',')
 {
     $this->filePointer = fopen($filename, 'r');
     if (!$this->filePointer) {
         \Terminus::error(sprintf('Could not open file: %s', $filename));
     }
     $this->delimiter = $delimiter;
 }
开发者ID:mikevanwinkle,项目名称:cli,代码行数:8,代码来源:CSV.php

示例4: get_check

 /**
  * Like get(), but calls Terminus::error() instead of returning false.
  *
  * @param string $arg The raw CLI argument
  */
 public function get_check($arg)
 {
     $item = $this->get($arg);
     if (!$item) {
         \Terminus::error(sprintf($this->msg, $arg));
     }
     return $item;
 }
开发者ID:mikevanwinkle,项目名称:cli,代码行数:13,代码来源:Base.php

示例5: __invoke

 /**
  * 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 {
         Terminus::error("No formula for requested artwork");
     }
 }
开发者ID:reynoldsalec,项目名称:cli,代码行数:22,代码来源:art.php

示例6: __invoke

 /**
  * Commands specific to an environment
  *
  * <commands>...
  * [--site=<value>]
  * : specify the site on which the command should be performed
  * [--env=<value>]
  * : Specificy the environment of a site previously set with --site=
  *
  * [--<flag>=<value>]
  * : Additional argument flag(s) to pass in to the command.
  */
 function __invoke(array $args, array $assoc_args)
 {
     if (empty($args)) {
         Terminus::error("You need to specify a task to perform, site and environment on which to perform.");
     } else {
         $this->_handleFuncArg($args, $assoc_args);
         $this->_handleSiteArg($args, $assoc_args);
     }
     $this->_execute($args, $assoc_args);
 }
开发者ID:mikevanwinkle,项目名称:cli,代码行数:22,代码来源:code.php

示例7: _update

 protected function _update($args, $assoc_args, $callback)
 {
     $status = 0;
     if (empty($assoc_args)) {
         \Terminus::error("Need some fields to update.");
     }
     foreach ($args as $obj_id) {
         $params = array_merge($assoc_args, array($this->obj_id_key => $obj_id));
         $status = $this->success_or_failure($this->wp_error_to_resp($callback($params), "Updated {$this->obj_type} {$obj_id}."));
     }
     exit($status);
 }
开发者ID:mikevanwinkle,项目名称:cli,代码行数:12,代码来源:CommandWithDBObject.php

示例8: __invoke

 /**
  * Get help on a certain command.
  *
  * <command>
  *
  * ## EXAMPLES
  *
  *     # get help for `sites` command
  *     terminus help sites
  *
  *     # get help for `sites list` subcommand
  *     terminus help sites list
  *
  * @synopsis [<command>...]
  */
 function __invoke($args, $assoc_args)
 {
     $command = self::find_subcommand($args);
     if ($command) {
         self::show_help($command);
         exit;
     }
     // WordPress is already loaded, so there's no chance we'll find the command
     if (function_exists('add_filter')) {
         \Terminus::error(sprintf("'%s' is not a registered command.", $args[0]));
     }
 }
开发者ID:newtoid,项目名称:cli,代码行数:27,代码来源:help.php

示例9: product

 /**
  * @param $args array of args to parse value from.
  * @param $exit (boolean) if true throw error when no value is found.
  *
  * @return product array
  */
 public static function product($args, $key, $exit = true)
 {
     if (isset($assoc_args[$key])) {
         $product = Products::getByIdOrName($assoc_args[$key]);
         if (!$product) {
             \Terminus::error("Couldn't find product: %s", array($assoc_args['product']));
         }
     } else {
         $product = \Terminus::menu(Products::selectList());
         $product = Products::getByIndex($product);
     }
     if (!$product and $exit) {
         \Terminus::error("Product is required.");
     }
     return $product;
 }
开发者ID:mikevanwinkle,项目名称:cli,代码行数:22,代码来源:Input.php

示例10: wait

 /**
  * Waits on this workflow to finish
  *
  * @return [Workflow] $this
  */
 public function wait()
 {
     while (!$this->isFinished()) {
         $this->fetch();
         sleep(3);
         print ".";
     }
     if ($this->isSuccessful()) {
         return $this;
     } else {
         $final_task = $this->get('final_task');
         if ($final_task != null && !empty($final_task->messages)) {
             foreach ($final_task->messages as $data => $message) {
                 \Terminus::error(sprintf('[%s] %s', $message->level, $message->message));
                 exit;
             }
         }
     }
 }
开发者ID:newtoid,项目名称:cli,代码行数:24,代码来源:Workflow.php

示例11: send_command

 protected function send_command($server, $remote_exec, $args, $assoc_args)
 {
     # unset CLI args
     unset($assoc_args['site']);
     $remote_cmd = $remote_exec . ' ';
     $remote_cmd .= implode(' ', $args);
     foreach ($assoc_args as $key => $value) {
         if ($value != 1) {
             $remote_cmd .= ' --' . $key . '=' . $value;
         } else {
             $remote_cmd .= ' --' . $key;
         }
     }
     $cmd = 'ssh -T ' . $server['user'] . '@' . $server['host'] . ' -p ' . $server['port'] . ' -o "AddressFamily inet"' . " '" . $remote_cmd . "'";
     passthru($cmd, $exit_code);
     if ($exit_code == 255) {
         \Terminus::error("Failed to connect. Check your credentials, and that you are specifying a valid environment.");
     }
     return $exit_code;
 }
开发者ID:mikevanwinkle,项目名称:cli,代码行数:20,代码来源:CommandWithSSH.php

示例12: __invoke

 /**
  * Invoke `wp` commands on a Pantheon development site
  *
  * <commands>...
  * : The WP-CLI commands you intend to run.
  *
  * [--<flag>=<value>]
  * : Additional WP-CLI flag(s) to pass in to the command.
  *
  * --site=<site>
  * : The name (DNS shortname) of your site on Pantheon.
  *
  * [--env=<environment>]
  * : Your Pantheon environment. Default: dev
  *
  */
 function __invoke($args, $assoc_args)
 {
     $site_name = $assoc_args['site'];
     if (isset($assoc_args['env'])) {
         $environment = $assoc_args['env'];
     } else {
         $environment = 'dev';
     }
     $site = SiteFactory::instance($site_name);
     if (!$site) {
         Terminus::error("Command could not be completed.");
         exit;
     }
     # see https://github.com/pantheon-systems/titan-mt/blob/master/dashboardng/app/workshops/site/models/environment.coffee
     $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 wp %s %s on %s-%s", array($command, $flags, $site->getName(), $environment));
     $this->send_command($server, 'wp', $args, $assoc_args);
 }
开发者ID:mikevanwinkle,项目名称:cli,代码行数:54,代码来源:wp.php

示例13: import

 /**
  * Import a new site
  * @package 2.0
  *
  * ## OPTIONS
  *
  * [--url=<url>]
  * : Url of archive to import
  *
  * [--name=<name>]
  * : Name of the site to create (machine-readable)
  *
  * [--label=<label>]
  * : Label for the site
  *
  * [--org=<org>]
  * : UUID of organization to add this site to
  *
  * @subcommand create-from-import
  */
 public function import($args, $assoc_args)
 {
     $url = Input::string($assoc_args, 'url', "Url of archive to import");
     $label = Input::string($assoc_args, 'label', "Human readable label for the site");
     $slug = Utils\sanitize_name($label);
     $name = Input::string($assoc_args, 'name', "Machine name of the site; used as part of the default URL [ if left blank will be {$slug}]");
     $name = $name ? $name : $slug;
     $organization = Terminus::menu(Input::orglist(), false, "Choose organization");
     if (!$url) {
         Terminus::error("Please enter a url.");
     }
     Terminus::launch_self('sites', array('create'), array('label' => $label, 'name' => $name, 'org' => $organization));
     Terminus::launch_self('site', array('import'), array('url' => $url, 'site' => $name, 'nocache' => True));
 }
开发者ID:mikevanwinkle,项目名称:cli,代码行数:34,代码来源:sites.php

示例14: upstream

 /**
  * Helper function to select valid upstream
  *
  * @param [array]   $args Args to parse value from
  * @param [string]  $key  Index to search for in args
  * @param [boolean] $exit If true, throw error when no value is found
  *
  * @return [Upstream] $upstream
  */
 public static function upstream($args, $key, $exit = true)
 {
     $upstreams = new Upstreams();
     if (isset($args[$key])) {
         $upstream = $upstreams->getByIdOrName($args[$key]);
         if ($upstream == null) {
             \Terminus::error("Couldn't find upstream: %s", array($args['upstream']));
         }
     } else {
         $upstream = $upstreams->get(\Terminus::menu($upstreams->getMemberList('id', 'longname')));
     }
     if (!$upstream && $exit) {
         \Terminus::error('Upstream is required.');
     }
     return $upstream;
 }
开发者ID:newtoid,项目名称:cli,代码行数:25,代码来源:Input.php

示例15: 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()));
     }
 }
开发者ID:mikevanwinkle,项目名称:cli,代码行数:28,代码来源:site.php


注:本文中的Terminus::error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。