本文整理汇总了PHP中AppShell::initialize方法的典型用法代码示例。如果您正苦于以下问题:PHP AppShell::initialize方法的具体用法?PHP AppShell::initialize怎么用?PHP AppShell::initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppShell
的用法示例。
在下文中一共展示了AppShell::initialize方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* Overwrite shell initialize to dynamically load all Queue Related Tasks.
*
* @return void
*/
public function initialize()
{
$paths = App::path('Console/Command/Task');
foreach ($paths as $path) {
$Folder = new Folder($path);
$res = array_merge($this->tasks, $Folder->find('Queue.*\\.php'));
foreach ($res as &$r) {
$r = basename($r, 'Task.php');
}
$this->tasks = $res;
}
$plugins = CakePlugin::loaded();
foreach ($plugins as $plugin) {
$pluginPaths = App::path('Console/Command/Task', $plugin);
foreach ($pluginPaths as $pluginPath) {
$Folder = new Folder($pluginPath);
$res = $Folder->find('Queue.*Task\\.php');
foreach ($res as &$r) {
$r = $plugin . '.' . basename($r, 'Task.php');
}
$this->tasks = array_merge($this->tasks, $res);
}
}
parent::initialize();
$this->QueuedTask->initConfig();
}
示例2: initialize
public function initialize()
{
parent::initialize();
$this->ProcessManager = new \Liip\ProcessManager\ProcessManager();
$this->setPid(getmypid());
$this->setProcessName($this->pid);
}
示例3: initialize
public function initialize()
{
$this->pluginPath = dirname(dirname(dirname(__FILE__))) . DS;
$this->bootstrapPath = $this->pluginPath . 'Vendor' . DS . 'bootstrap' . DS;
$this->Folder = new Folder($this->bootstrapPath);
parent::initialize();
}
示例4: initialize
/**
* Overwrite shell initialize to dynamically load all queue related tasks.
*
* @return void
*/
public function initialize()
{
// Check for tasks inside plugins and application
$paths = App::path('Console/Command/Task');
foreach ($paths as $path) {
$Folder = new Folder($path);
$res = array_merge($this->tasks, $Folder->find('Queue.*\\.php'));
foreach ($res as &$r) {
$r = basename($r, 'Task.php');
}
$this->tasks = $res;
}
$plugins = App::objects('plugin');
foreach ($plugins as $plugin) {
$pluginPaths = App::path('Console/Command/Task', $plugin);
foreach ($pluginPaths as $pluginPath) {
$Folder = new Folder($pluginPath);
$res = $Folder->find('Queue.*Task\\.php');
foreach ($res as &$r) {
$r = $plugin . '.' . basename($r, 'Task.php');
}
$this->tasks = array_merge($this->tasks, $res);
}
}
$conf = Configure::read('Queue');
if (!is_array($conf)) {
$conf = [];
}
// Merge with default configuration vars.
Configure::write('Queue', array_merge(['workers' => 3, 'sleepTime' => 10, 'gcprop' => 10, 'defaultWorkerTimeout' => 2 * MINUTE, 'defaultWorkerRetries' => 4, 'workerMaxRuntime' => 0, 'cleanupTimeout' => DAY, 'exitWhenNothingToDo' => false], $conf));
parent::initialize();
}
示例5: initialize
/**
* initialize method
*
* If the flags -h, -help or --help are present bail here and show help
*
* @return void
* @access public
*/
function initialize()
{
parent::initialize();
/*
if (file_exists(APP . 'Config' . DS . 'index.php')) {
include(APP . 'Config' . DS . 'index.php');
if (!empty($config)) {
$this->settings = am($this->settings, $config);
}
}
*/
$this->_loadModels();
}
示例6: initialize
public function initialize()
{
parent::initialize();
$this->_settings = Configure::read('Gearman') ?: array('servers' => array('127.0.0.1'));
if (!self::$GearmanWorker) {
$serversList = implode(',', $this->_settings['servers']);
$this->log('Creating instance of GearmanWorker with servers: ' . $serversList, 'info', 'gearman');
self::$GearmanWorker = new GearmanWorker();
self::$GearmanWorker->addServers($serversList);
self::$GearmanWorker->addOptions(GEARMAN_WORKER_GRAB_UNIQ);
self::$GearmanWorker->addOptions(GEARMAN_WORKER_NON_BLOCKING);
}
}
示例7: initialize
public function initialize()
{
parent::initialize();
//$this->loadModel('Gallery');
$this->loadModel('Locality');
$this->loadModel('ApertureConnector.Keyword');
$this->loadModel('ApertureConnector.Place');
$this->loadModel('ApertureConnector.Version');
$this->loadModel('ApertureConnector.IptcProperty');
$this->loadModel('ApertureConnector.OtherProperty');
$this->loadModel('ApertureConnector.ExifStringProperty');
$this->loadModel('ApertureConnector.ExifNumberProperty');
$this->loadModel('ApertureConnector.ImageProxyState');
}
示例8: initialize
public function initialize()
{
parent::initialize();
$this->stdout->styles('header', array('text' => 'blue', 'bold' => true));
$this->stdout->styles('bold', array('text' => 'white', 'bold' => true));
}
示例9: initialize
/**
* Initialize seeder shell, make sure it's OK to seed
*
* @return void
*/
public function initialize()
{
parent::initialize();
$this->_checkSeedable();
}
示例10: initialize
public function initialize()
{
parent::initialize();
$this->QueueTask = ClassRegistry::init('Queue.QueueTask');
}
示例11: initialize
/**
* Initialize method
*
* If the flags -h, -help or --help are present bail here and show help
*
* @return void
*/
public function initialize()
{
parent::initialize();
$this->_loadModels();
}
示例12: initialize
public function initialize()
{
parent::initialize();
}