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


PHP Terminus::set_config方法代码示例

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


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

示例1: wait

 /**
  * Wait on workflow to complete
  */
 public function wait()
 {
     \Terminus::set_config('nocache', true);
     $tries = 0;
     while ($this->status('result') !== 'succeeded' and $tries < 100) {
         if ('failed' == $this->status('result') or 'aborted' == $this->status('result')) {
             if (isset($this->status->final_task) and !empty($this->status->final_task->messages)) {
                 foreach ($this->status->final_task->messages as $data => $message) {
                     \Terminus::error(sprintf('[%s] %s', $message->level, $message->message));
                     exit;
                 }
             } else {
                 \Terminus::error(PHP_EOL . "Couldn't complete jobs: '{$this->type}'" . PHP_EOL);
             }
         }
         sleep(3);
         $this->refresh();
         print ".";
         $tries++;
     }
     print PHP_EOL;
     if ("succeeded" === $this->status('result')) {
         return $this;
     }
     return false;
     unset($workflow);
 }
开发者ID:spleshka,项目名称:cli,代码行数:30,代码来源:SiteWorkflow.php

示例2: define

<?php

/**
 * Bootstrap file for unit tests
 */
define('CLI_ROOT', dirname(__DIR__) . '/..');
define('TEST_DIR', dirname(__DIR__));
define('TERMINUS_CMD', 'php ' . CLI_ROOT . '/php/boot-fs.php');
putenv('CLI_TEST_MODE=1');
require_once CLI_ROOT . '/vendor/autoload.php';
require_once CLI_ROOT . '/php/boot-fs.php';
Terminus::set_config('nocache', true);
Terminus::set_config('debug', false);
use Terminus\Session;
// Set some dummy credentials
Session::setData(json_decode('{
  "user_uuid": "0ffec038-4410-43d0-a404-46997f672d7a",
  "session": "0ffec038-4410-43d0-a404-46997f672d7a%3A68486878-dd87-11e4-b243-bc764e1113b5%3AbQR2fyNMh5PQXN6F2Ewge",
  "session_expire_time": 1739299351,
  "email": "bensheldon+pantheontest@gmail.com"
}'));
\VCR\VCR::configure()->enableRequestMatchers(array('method', 'url', 'body'));
# Prevent API requests from being made in CI Environment
$ci_environment = getenv('CI');
if ($ci_environment) {
    \VCR\VCR::configure()->setMode('none');
}
开发者ID:reynoldsalec,项目名称:cli,代码行数:27,代码来源:bootstrap.php

示例3: waitOnWorkflow

 /**
  * Waits and returns response from workflow.
  * @package Terminus
  * @version 2.0
  * @param $object_name string -- i.e. sites / users / organization
  * @param $object_id string -- coresponding id
  * @param $workflow_id string -- workflow to wait on
  *
  * @deprecated Use new WorkFlow() object instead
  * Example: $this->waitOnWorkflow( "sites", "68b99b50-8942-4c66-b7e3-22b67445f55d", "e4f7e832-5644-11e4-81d4-bc764e111d20");
  */
 protected function waitOnWorkflow($object_name, $object_id, $workflow_id)
 {
     print "Working .";
     Terminus::set_config('nocache', true);
     $workflow = self::request($object_name, $object_id, "workflows/{$workflow_id}", 'GET');
     $result = $workflow['data']->result;
     $desc = $workflow['data']->active_description;
     $type = $workflow['data']->type;
     $tries = 0;
     while (!isset($result) and $tries < 100) {
         if ('failed' == $result or 'aborted' == $result) {
             if (isset($workflow['data']->final_task) and !empty($workflow['data']->final_task->messages)) {
                 foreach ($workflow['data']->final_task->messages as $data => $message) {
                     sprintf('[%s] %s', $message->level, $message->message);
                 }
             } else {
                 Terminus::error(PHP_EOL . "Couldn't complete jobs: '{$type}'" . PHP_EOL);
             }
         }
         $workflow = self::request($object_name, $object_id, "workflows/{$workflow_id}", 'GET');
         $result = $workflow['data']->result;
         if (Terminus::get_config('debug')) {
             print_r($workflow);
         }
         sleep(3);
         print ".";
         $tries++;
     }
     print PHP_EOL;
     if ("succeeded" === $workflow['data']->result or "aborted" === $workflow['data']->result) {
         return $workflow['data'];
     }
     return false;
     unset($workflow);
 }
开发者ID:xwp,项目名称:pantheon-cli,代码行数:46,代码来源:class-terminus-command.php

示例4: doLoginFromSessionToken

 /**
  * 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
     Terminus::set_config('nocache', TRUE);
     $response = Terminus_Command::request('user', '', '', 'GET', $options);
     Terminus::set_config('nocache', FALSE);
     if (!$response or '200' != @$response['info']['http_code']) {
         \Terminus::error("[auth_error]: 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;
 }
开发者ID:xwp,项目名称:pantheon-cli,代码行数:22,代码来源:auth.php


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