• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ShellDispatcher类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: process_message

 function process_message($msg)
 {
     $msg_body = json_decode($msg->body, true);
     if (isset($msg_body['params']) && is_array($msg_body['params'])) {
         $msg_body['params'] = json_encode($msg_body['params']);
     }
     $msg_body = array_values($msg_body);
     $dispatcher = new ShellDispatcher($msg_body, false);
     try {
         $dispatcher->dispatch();
     } catch (Exception $e) {
         RabbitMQ::publish(json_decode($msg->body, true), ['exchange' => 'requeueable', 'queue' => 'requeueable_messages']);
         $newMessage[] = $msg->body;
         $newMessage[] = '==>';
         $newMessage[] = $e->getMessage();
         $newMessage[] = $e->getFile();
         $newMessage[] = $e->getLine();
         $newMessage[] = $e->getTraceAsString();
         $newMessage[] = $e->getCode();
         $newMessage[] = $e->getPrevious();
         RabbitMQ::publish($newMessage, ['exchange' => 'unprocessed', 'queue' => 'unprocessed_messages']);
         EmailSender::sendEmail('[email protected]', $msg->body, $newMessage);
     }
     $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
     // Send a message with the string "quit" to cancel the consumer.
     if ($msg->body === 'quit') {
         $msg->delivery_info['channel']->basic_cancel($msg->delivery_info['consumer_tag']);
     }
 }
开发者ID:backstageel,项目名称:cakephp-rabbitmq,代码行数:29,代码来源:RabbitMQShell.php


示例2: index

 /**
  * Displays detailed help about a HeavyMetal shell command.
  * 
  * @usage ./metal help your/command/uri
  * @param $uri The URI of the shell command to display help about.
  */
 public function index($uri)
 {
     try {
         try {
             $s = new ShellDispatcher($uri);
             $f = $s->find();
         } catch (Exception $ex) {
             $s = new SysShellDispatcher($uri);
             $f = $s->find();
         }
     } catch (Exception $ex) {
         vomit($ex->getTrace());
         echo "Could not find a suitable controller for {$uri} - are you sure you got it right?";
     }
     $method = new ReflectionMethod($f['classname'], $f['found_action']);
     $help = $method->getDocComment();
     $help = explode("\n", $help);
     $description = '';
     $switches = array();
     $params = array();
     $usage = '';
     foreach ($help as $line) {
         if (strpos(trim($line, "\t \n"), '/**') === FALSE && strpos(trim($line, "\t \n"), '*/') === FALSE) {
             $line = trim($line, "\t* ");
             if (strpos($line, '@') === FALSE) {
                 $description .= $line;
             } else {
                 if (strpos($line, '@usage') === 0) {
                     $usage = substr($line, 6);
                 } else {
                     $matches = array();
                     preg_match_all('#([@a-z0-9]*) ([$a-z0-9]*) (.*)#', $line, $matches);
                     switch ($matches[1][0]) {
                         case '@switch':
                             $switches[$matches[2][0]] = $matches[3][0];
                             break;
                         case '@param':
                             $params[trim($matches[2][0], '$')] = $matches[3][0];
                             break;
                     }
                 }
             }
         }
     }
     return array('description' => $description, 'usage' => $usage, 'switches' => $switches, 'params' => $params);
 }
开发者ID:jawngee,项目名称:HeavyMetal,代码行数:52,代码来源:help.php


示例3: dirname

#!/usr/bin/php -q
<?php 
/**
 * Command-line code generation utility to automate programmer chores.
 *
 * PHP 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2012, Cake Software Foundation, Inc.
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Console
 * @since         CakePHP(tm) v 2.0
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
$ds = DIRECTORY_SEPARATOR;
$dispatcher = 'Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php';
if (function_exists('ini_set')) {
    $root = dirname(dirname(dirname(__FILE__)));
    ini_set('include_path', $root . PATH_SEPARATOR . 'C:' . $ds . 'webroot' . $ds . 'cakephp' . $ds . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
}
if (!(include $dispatcher)) {
    trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
}
unset($paths, $path, $dispatcher, $root, $ds);
return ShellDispatcher::run($argv);
开发者ID:renanmpimentel,项目名称:CakePHP-2.2-com-CakePtbr,代码行数:30,代码来源:cake.php


示例4: run

/**
 * Run the dispatcher
 *
 * @param array $argv The argv from PHP
 * @return void
 */
	public static function run($argv) {
		$dispatcher = new ShellDispatcher($argv);
		$dispatcher->_stop($dispatcher->dispatch() === false ? 1 : 0);
	}
开发者ID:sherix88,项目名称:sigedu,代码行数:10,代码来源:ShellDispatcher.php


示例5: dispatchShell

 /**
  * Dispatch a command to another Shell. Similar to Object::requestAction()
  * but intended for running shells from other shells.
  *
  * ### Usage:
  *
  * With a string command:
  *
  *	`return $this->dispatchShell('schema create DbAcl');`
  *
  * Avoid using this form if you have string arguments, with spaces in them.
  * The dispatched will be invoked incorrectly. Only use this form for simple
  * command dispatching.
  *
  * With an array command:
  *
  * `return $this->dispatchShell('schema', 'create', 'i18n', '--dry');`
  *
  * @return mixed The return of the other shell.
  * @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::dispatchShell
  */
 public function dispatchShell()
 {
     $args = func_get_args();
     if (is_string($args[0]) && count($args) === 1) {
         $args = explode(' ', $args[0]);
     }
     $Dispatcher = new ShellDispatcher($args, false);
     return $Dispatcher->dispatch();
 }
开发者ID:4Queen,项目名称:php-buildpack,代码行数:30,代码来源:Shell.php


示例6: run

 /**
  * Run the dispatcher
  *
  * @param array $argv The argv from PHP
  *
  * @return void
  */
 public static function run($argv)
 {
     $dispatcher = new ShellDispatcher($argv);
     return $dispatcher->_stop($dispatcher->dispatch() === FALSE ? 1 : 0);
 }
开发者ID:mrbadao,项目名称:api-official,代码行数:12,代码来源:ShellDispatcher.php


示例7: dirname

#!/usr/bin/php -q
<?php 
$ds = DIRECTORY_SEPARATOR;
require_once dirname(dirname(dirname(__FILE__))) . $ds . 'vendor' . $ds . 'autoload.php';
// start profiling
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
register_shutdown_function('saveXhprof');
$result = ShellDispatcher::run($argv);
function saveXhprof()
{
    global $argv;
    $_SERVER['REQUEST_URI'] = implode(' ', $argv);
    // stop profiler
    $xhprof_data = xhprof_disable();
    $xhprofConfig = Configure::read('Environment.xhprof');
    include_once $xhprofConfig['utils'] . "xhprof_lib.php";
    include_once $xhprofConfig['utils'] . "xhprof_runs.php";
    // save raw data for this profiler run using default
    // implementation of iXHProfRuns.
    $xhprof_runs = new XHProfRuns_Default($xhprofConfig['storage']);
    // save the run under a namespace "xhprof_foo"
    $runId = $xhprof_runs->save_run($xhprof_data, $xhprofConfig['tag']);
    echo "\n{$xhprofConfig['host']}?run={$runId}&source={$xhprofConfig['tag']}\n";
}
开发者ID:imsamurai,项目名称:cakephp-environment,代码行数:24,代码来源:cakexhprof.php


示例8: _getShell

 /**
  * _getShell
  *
  * @param string $plugin
  *
  * @return mixed
  */
 protected function _getShell($shell)
 {
     if (isset($this->TestShell)) {
         return $this->TestShell;
     }
     return parent::_getShell($shell);
 }
开发者ID:Marcin11,项目名称:_mojePanstwo-Portal,代码行数:14,代码来源:ShellDispatcherTest.php


示例9: help

 /**
  * Outputs usage text on the standard output. Implement it in subclasses.
  *
  * @access public
  */
 function help()
 {
     if ($this->command != null) {
         $this->err("Unknown {$this->name} command '{$this->command}'.\nFor usage, try 'cake {$this->shell} help'.\n\n");
     } else {
         $this->Dispatch->help();
     }
 }
开发者ID:BGCX067,项目名称:fake-as3-svn-to-git,代码行数:13,代码来源:shell.php


示例10: help

	/**
	 * Outputs usage text on the standard output. Implement it in subclasses.
	 *
	 * @access public
	 */
	function help() {
		if ($this->command != null) {
			$this->err("Unknown {$this->name} command `{$this->command}`.");
			$this->err("For usage, try `cake {$this->shell} help`.", 2);
		} else {
			$this->Dispatch->help();
		}
	}
开发者ID:ralmeida,项目名称:FoundFree.org,代码行数:13,代码来源:shell.php


示例11: __construct

 /**
  * Constructor 
  * 
  * @param $path
  * @param $controller_root
  * @param $view_root
  * @param $use_routes
  * @param $force_routes
  */
 public function __construct($path = null, $controller_root = null, $view_root = null, $use_routes = true, $force_routes = false)
 {
     $args = parse_args();
     $switches = parse_switches();
     $path = $path ? $path : $args[0];
     array_shift($args);
     $controller_root = $controller_root ? $controller_root : PATH_SYS . 'shell/controller/';
     $view_root = $view_root ? $view_root : PATH_SYS . 'shell/view/';
     $this->segments = $args;
     parent::__construct($path, $controller_root, $view_root, $use_routes, $force_routes);
 }
开发者ID:jawngee,项目名称:HeavyMetal,代码行数:20,代码来源:sys_shell_dispatcher.php


示例12:

	/**
	 * _getShell
	 *
	 * @param mixed $plugin
	 * @return mixed
	 * @access protected
	 */
	function _getShell($plugin = null) {
		if (isset($this->TestShell)) {
			return $this->TestShell;
		}
		return parent::_getShell($plugin);
	}
开发者ID:ralmeida,项目名称:FoundFree.org,代码行数:13,代码来源:cake.test.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Shindig_Config类代码示例发布时间:2022-05-23
下一篇:
PHP Shell类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap