本文整理汇总了PHP中Cake\Console\Shell类的典型用法代码示例。如果您正苦于以下问题:PHP Shell类的具体用法?PHP Shell怎么用?PHP Shell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Shell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOptionParser
/**
* Gets the option parser instance and configures it.
*
* @return \Cake\Console\ConsoleOptionParser
*/
public function getOptionParser()
{
$parser = parent::getOptionParser();
$infoParser = $parser->toArray();
$infoParser['arguments']['url'] = ['help' => 'Absolute URL', 'required' => false];
$parser->description('Cache Shell to cleanup caching of view files.')->addSubcommand('info', ['help' => 'Infos about the files', 'parser' => $infoParser])->addSubcommand('clear', ['help' => 'Clear all or part of the files', 'parser' => $parser]);
return $parser;
}
示例2: getOptionParser
/**
* Get the option parser instance and configures it.
*
* @return ConsoleOptionParser
* @see Shell::getOptionParser()
*/
public function getOptionParser()
{
$startParserArguments = ['options' => ['user' => ['short' => 'u', 'help' => __d('cake_resque', 'User running the workers')], 'queue' => ['short' => 'q', 'help' => __d('cake_resque', 'Name of the queue. If multiple queues, separe with comma.')], 'interval' => ['short' => 'i', 'help' => __d('cake_resque', 'Pause time in seconds between each works')], 'workers' => ['short' => 'n', 'help' => __d('cake_resque', 'Number of workers to fork')], 'log' => ['short' => 'l', 'help' => __d('cake_resque', 'Log path')], 'log-handler' => ['help' => __d('cake_resque', 'Log Handler to use for logging.')], 'log-handler-target' => ['help' => __d('cake_resque', 'Log Handler arguments')], 'verbose' => ['short' => 'v', 'help' => __d('cake_resque', 'Log more verbose informations'), 'boolean' => true], 'debug' => ['short' => 'd', 'help' => __d('cake_resque', 'Print debug informations'), 'boolean' => true]]];
$startSchedulerParserArguments = ['options' => ['user' => ['short' => 'u', 'help' => __d('cake_resque', 'User running the workers')], 'interval' => ['short' => 'i', 'help' => __d('cake_resque', 'Pause time in seconds between each works')], 'log' => ['short' => 'l', 'help' => __d('cake_resque', 'Log path')], 'log-handler' => ['help' => __d('cake_resque', 'Log Handler to use for logging.')], 'log-handler-target' => ['help' => __d('cake_resque', 'Log Handler arguments')], 'verbose' => ['short' => 'v', 'help' => __d('cake_resque', 'Log more verbose informations'), 'boolean' => true]]];
$stopParserArguments = ['options' => ['force' => ['short' => 'f', 'help' => __d('cake_resque', 'Force workers shutdown, forcing all the current jobs to finish (and fail)'), 'boolean' => true], 'all' => ['short' => 'a', 'help' => __d('cake_resque', 'Shutdown all workers'), 'boolean' => true]], 'description' => [__d('cake_resque', 'Stop one or all workers'), __d('cake_resque', 'Unless you force the stop with the --force option,'), __d('cake_resque', 'the worker will wait for all jobs to complete'), __d('cake_resque', 'before shutting down')]];
$pauseParserArguments = ['options' => ['all' => ['short' => 'a', 'help' => __d('cake_resque', 'Pause all workers'), 'boolean' => true], 'debug' => ['short' => 'd', 'help' => __d('cake_resque', 'Print debug informations'), 'boolean' => true]], 'description' => [__d('cake_resque', 'Pause one or all workers'), __d('cake_resque', 'Pausing is only supported on Unix system,'), __d('cake_resque', 'with PHP pcntl extension installed')]];
$resumeParserArguments = ['options' => ['all' => ['short' => 'a', 'help' => __d('cake_resque', 'Resume all paused workers'), 'boolean' => true], 'debug' => ['short' => 'd', 'help' => __d('cake_resque', 'Print debug informations'), 'boolean' => true]], 'description' => [__d('cake_resque', 'Resume one or all paused workers'), __d('cake_resque', 'Resuming is only supported on Unix system,'), __d('cake_resque', 'with PHP pcntl extension installed')]];
$cleanupParserArguments = ['options' => ['all' => ['short' => 'a', 'help' => __d('cake_resque', 'Clean up all workers'), 'boolean' => true], 'debug' => ['short' => 'd', 'help' => __d('cake_resque', 'Print debug informations'), 'boolean' => true]], 'description' => [__d('cake_resque', 'Cleaning Up one or all paused workers'), __d('cake_resque', 'Cleaning Up will immedately terminate the job'), __d('cake_resque', 'the worker is currently working on.'), __d('cake_resque', 'Resuming is only supported on Unix system,'), __d('cake_resque', 'with PHP pcntl extension installed')]];
$clearParserArguments = ['options' => ['all' => ['short' => 'a', 'help' => __d('cake_resque', 'Clear all queues'), 'boolean' => true], 'debug' => ['short' => 'd', 'help' => __d('cake_resque', 'Print debug informations'), 'boolean' => true]], 'description' => [__d('cake_resque', 'Clear one or all queues'), __d('cake_resque', 'Clearing a queue will remove all its jobs')]];
return parent::getOptionParser()->description(__d('cake_resque', "A Shell to manage PHP Resque") . "\n" . __d('cake_resque', "Version " . CakeResqueShell::VERSION) . "\n" . "Wan Chen (" . date('Y') . ")")->addSubcommand('start', ['help' => __d('cake_resque', 'Start a new worker.'), 'parser' => $startParserArguments])->addSubcommand('startscheduler', ['help' => __d('cake_resque', 'Start a new scheduler worker.'), 'parser' => $startSchedulerParserArguments])->addSubcommand('stop', ['help' => __d('cake_resque', 'Stop a worker.'), 'parser' => $stopParserArguments])->addSubcommand('pause', ['help' => __d('cake_resque', 'Pause a worker.'), 'parser' => $pauseParserArguments])->addSubcommand('resume', ['help' => __d('cake_resque', 'Resume a paused worker.'), 'parser' => $resumeParserArguments])->addSubcommand('cleanup', ['help' => __d('cake_resque', 'Immediately terminate a worker job execution.'), 'parser' => $cleanupParserArguments])->addSubcommand('restart', ['help' => __d('cake_resque', 'Stop all Resque workers, and start a new one.'), 'parser' => array_merge_recursive($startParserArguments, $stopParserArguments)])->addSubcommand('clear', ['help' => __d('cake_resque', 'Clear all jobs inside a queue'), 'parser' => $clearParserArguments])->addSubcommand('reset', ['help' => __d('cake_resque', 'Reset CakeResque internal worker\'s saved status'), 'parser' => $clearParserArguments])->addSubcommand('stats', ['help' => __d('cake_resque', 'View stats about processed/failed jobs.')])->addSubcommand('tail', ['help' => __d('cake_resque', 'Tail the workers logs.')])->addSubcommand('track', ['help' => __d('cake_resque', 'Track a job status.')])->addSubcommand('load', ['help' => __d('cake_resque', 'Load a set of predefined workers.')])->addSubcommand('enqueue', ['help' => __d('cake_resque', 'Enqueue a job.')]);
}
示例3: initialize
/**
* Initialize method
*/
public function initialize()
{
$paths = App::path('Shell/Task', 'CodeBlastrQueue');
foreach ($paths as $path) {
$Folder = new Folder($path);
$res = array_merge($this->tasks, $Folder->find('Queue.+\\.php'));
foreach ($res as &$r) {
$r = 'CodeBlastrQueue.' . basename($r, 'Task.php');
}
$this->tasks = $res;
}
parent::initialize();
}
示例4: _create
/**
* Create the task instance.
*
* Part of the template method for Cake\Core\ObjectRegistry::load()
*
* @param string $class The classname to create.
* @param string $alias The alias of the task.
* @param array $settings An array of settings to use for the task.
* @return \Cake\Console\Shell The constructed task class.
*/
protected function _create($class, $alias, $settings)
{
return new $class($this->_Shell->io());
}
示例5: getOptionParser
/**
* main() method.
*
* @return bool|int Success or error code.
*/
public function getOptionParser()
{
$parser = parent::getOptionParser();
$parser->addSubcommand('initialize', ['help' => 'Execute The Initialize-method. This will add some important data to your database.', 'parser' => $this->Initialize->getOptionParser()]);
$parser->addSubcommand('user', ['help' => 'Execute The User-task. You will be able to create an user.', 'parser' => $this->User->getOptionParser()]);
return $parser;
}
示例6: getOptionParser
/**
* Gets the option parser instance and configures it.
*
* @return \Cake\Console\ConsoleOptionParser
*/
public function getOptionParser()
{
$parser = parent::getOptionParser();
$parser->description('Asset Management for CakePHP.');
foreach ($this->_taskMap as $task => $config) {
$taskParser = $this->{$task}->getOptionParser();
$parser->addSubcommand(Inflector::underscore($task), ['help' => $taskParser->description(), 'parser' => $taskParser]);
}
return $parser;
}
示例7: __construct
/**
* {@inheritDoc}
*/
public function __construct(ConsoleIo $io = null)
{
parent::__construct($io);
if (strtolower(substr(php_uname('s'), 0, 3)) === 'win') {
$this->_mkdirCommand = 'mkdir';
}
}
示例8: getOptionParser
public function getOptionParser()
{
$parser = parent::getOptionParser();
$parser->addOption('adapter', ['short' => 'a', 'help' => __('The adapter config name to use.'), 'default' => 'Local']);
$parser->addOption('model', ['short' => 'm', 'help' => __('The model / table to use.'), 'default' => 'Burzum/FileStorage.FileStorage']);
$parser->addSubcommand('image', ['help' => __('Image Processing Task.'), 'parser' => $this->Image->getOptionParser()]);
$parser->addSubcommand('store', ['help' => __('Stores a file in the DB.')]);
return $parser;
}
示例9: getOptionParser
/**
* Gets the option parser instance and configures it.
*
* @return \Cake\Console\ConsoleOptionParser
*/
public function getOptionParser()
{
$parser = parent::getOptionParser();
$parser->addOption('config', ['default' => 'default', 'help' => 'Name of a queue config to use', 'short' => 'c']);
$parser->addOption('queue', ['help' => 'Name of queue to override from loaded config', 'short' => 'Q']);
$parser->addOption('logger', ['help' => 'Name of a configured logger', 'default' => 'stdout', 'short' => 'l']);
$parser->addOption('worker', ['choices' => ['Sequential', 'Test'], 'default' => 'Sequential', 'help' => 'Name of worker class', 'short' => 'w'])->description(__('Runs a Queuesadilla worker.'));
return $parser;
}
示例10: getOptionParser
/**
* Get option parser.
*
* @return \Cake\Console\OptionParser
*/
public function getOptionParser()
{
$parser = parent::getOptionParser();
$parser->description(__d('debug_kit', 'Allows you to obtain some rough benchmarking statistics' . 'about a fully qualified URL.'))->addArgument('url', ['help' => __d('debug_kit', 'The URL to request.'), 'required' => true])->addOption('n', ['default' => 10, 'help' => __d('debug_kit', 'Number of iterations to perform.')])->addOption('t', ['default' => 100, 'help' => __d('debug_kit', 'Maximum total time for all iterations, in seconds.' . 'If a single iteration takes more than the timeout, only one request will be made')])->epilog(__d('debug_kit', 'Example Use: `cake benchmark --n 10 --t 100 http://localhost/testsite`. ' . '<info>Note:</info> this benchmark does not include browser render times.'));
return $parser;
}
示例11: getOptionParser
/**
* Gets the option parser instance and configures it.
*
* @return \Cake\Console\ConsoleOptionParser
*/
public function getOptionParser()
{
$parser = parent::getOptionParser();
$parser->description('CakePHP Language String Extraction:')->addOption('app', ['help' => 'Directory where your application is located.'])->addOption('paths', ['help' => 'Comma separated list of paths.'])->addOption('merge', ['help' => 'Merge all domain strings into the default.po file.', 'choices' => ['yes', 'no']])->addOption('output', ['help' => 'Full path to output directory.'])->addOption('files', ['help' => 'Comma separated list of files.'])->addOption('exclude-plugins', ['boolean' => true, 'default' => true, 'help' => 'Ignores all files in plugins if this command is run inside from the same app directory.'])->addOption('plugin', ['help' => 'Extracts tokens only from the plugin specified and puts the result in the plugin\'s Locale directory.'])->addOption('ignore-model-validation', ['boolean' => true, 'default' => false, 'help' => 'Ignores validation messages in the $validate property.' . ' If this flag is not set and the command is run from the same app directory,' . ' all messages in model validation rules will be extracted as tokens.'])->addOption('validation-domain', ['help' => 'If set to a value, the localization domain to be used for model validation messages.'])->addOption('exclude', ['help' => 'Comma separated list of directories to exclude.' . ' Any path containing a path segment with the provided values will be skipped. E.g. test,vendors'])->addOption('overwrite', ['boolean' => true, 'default' => false, 'help' => 'Always overwrite existing .pot files.'])->addOption('extract-core', ['help' => 'Extract messages from the CakePHP core libs.', 'choices' => ['yes', 'no']])->addOption('no-location', ['boolean' => true, 'default' => false, 'help' => 'Do not write file locations for each extracted message.']);
return $parser;
}
示例12: initialize
public function initialize()
{
parent::initialize();
$this->loadModel('Users');
$this->loadModel('UsersTypeMissions');
$this->loadModel('Missions');
}
示例13: getOptionParser
/**
* getOptionParser method
*
* @return $parser
*/
public function getOptionParser()
{
$parser = parent::getOptionParser();
$this->_io->styles('green_text', ['text' => 'green', 'blink' => true]);
$this->_io->styles('red_text', ['text' => 'red', 'blink' => true]);
$this->_io->styles('blue_text', ['text' => 'blue', 'blink' => true]);
$parser->addSubcommand('start_caching', ['help' => 'Cache and optimize original image in plugin webroot cache folder', 'parser' => ['description' => [__("<warning>This subcommand uses for cache and optimize all images from "), __("source folder to cache folder. Cache options gets from "), __("adaptive_image_config.php in /config dir. You also can "), __("disable image optimization if argument 'optimization' = false. "), __("If cache folder already exists - all images will be recached. </warning>")], 'arguments' => ['optimization' => ['help' => __('Enable\\Disable image optimization; boolean; <blue_text>(default: true)</blue_text>'), 'required' => false], 'src_path' => ['help' => __('Folder for source images, root is : /webroot/img/. <blue_text>(default: \'src_images\')</blue_text>'), 'required' => false]]]]);
$parser->addSubcommand('clear_cache', ['help' => 'Remove cache folder', 'parser' => ['description' => [__("<warning>Remove cache folder with cached images</warning>")]]]);
$parser->addSubcommand('check_for_img_tags', ['help' => 'Show places in code, where don\'t uses AdaptiveImgHelper for images; Search in /src dir', 'parser' => ['description' => [__("<warning>Show places in code, where don't uses AdaptiveImgHelper for images; Search in /src dir</warning>")]]]);
return $parser;
}
示例14: initialize
/**
* Initialization. Used to disconnect default loggers from consoleIO output
* and instantiating Cakebox objects.
*
* @return void
*/
public function initialize()
{
$this->_io->setLoggers(false);
$this->Info = new CakeboxInfo();
$this->Execute = new CakeboxExecute();
parent::initialize();
}
示例15: getOptionParser
/**
* Gets the option parser instance and configures it.
*
* @return \Cake\Console\ConsoleOptionParser
*/
public function getOptionParser()
{
$parser = parent::getOptionParser();
$parser->addOption('engine', ['choices' => ['Beanstalk', 'Iron', 'Memory', 'Mysql', 'Null', 'Redis', 'Synchronous'], 'default' => 'Mysql', 'help' => 'Name of engine', 'short' => 'e']);
$parser->addOption('queue', ['help' => 'Name of a queue', 'short' => 'q']);
$parser->addOption('logger', ['help' => 'Name of a configured logger', 'default' => 'stdout', 'short' => 'l']);
$parser->addOption('worker', ['choices' => ['Sequential', 'Test'], 'default' => 'Sequential', 'help' => 'Name of worker class', 'short' => 'w'])->description(__('Runs a Queuesadilla worker.'));
return $parser;
}