/** * 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(); }
public function initialize() { parent::initialize(); $this->ProcessManager = new \Liip\ProcessManager\ProcessManager(); $this->setPid(getmypid()); $this->setProcessName($this->pid); }
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(); }
/** * 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(); }
/** * 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(); }
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); } }
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'); }
public function initialize() { parent::initialize(); $this->stdout->styles('header', array('text' => 'blue', 'bold' => true)); $this->stdout->styles('bold', array('text' => 'white', 'bold' => true)); }
/** * Initialize seeder shell, make sure it's OK to seed * * @return void */ public function initialize() { parent::initialize(); $this->_checkSeedable(); }
public function initialize() { parent::initialize(); $this->QueueTask = ClassRegistry::init('Queue.QueueTask'); }
/** * 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(); }
public function initialize() { parent::initialize(); }