Ejemplo n.º 1
0
 public function run()
 {
     $this->showHeader();
     $cli_args = $this->parseArguments();
     $args = array_merge($this->init_args, $cli_args);
     Console::output('');
     $this->includeConfigFile($args);
     if (!empty($args['bootstrap'])) {
         $this->includeBootstrapFile($args['bootstrap']);
     }
     Base::init();
     $cmd = $args['cmd'];
     if ($this->debug) {
         Console::output("%C[Info]%n: Preparing to execute: {$args['cmd']}");
     }
     if (!in_array($cmd, $this->valid_cmd)) {
         $this->help();
     } else {
         $this->{$cmd}($args);
     }
 }
Ejemplo n.º 2
0
use CKFQueue\Base as CKFQ;
class DemoConfig implements PHPQueue\Interfaces\Config
{
    public static $backend_types = array('Generic' => array('backend' => 'Beanstalkd', 'server' => '127.0.0.1', 'tube' => 'genericjobs'));
    /**
     * @param string $type
     * @return array
     */
    public static function getConfig($type = null)
    {
        $config = isset(self::$backend_types[$type]) ? self::$backend_types[$type] : array();
        return $config;
    }
    /**
     * @return string
     */
    public static function getAppRoot()
    {
        return __DIR__;
    }
    /**
     * @return string No trailing slash
     */
    public static function getLogRoot()
    {
        return __DIR__;
    }
}
CKFQ::setConfigClass('DemoConfig');
CKFQ::init();
Ejemplo n.º 3
0
<?php

require_once 'config.php';
use Clio\Console;
use CKFQueue\Base as CKFQ;
try {
    CKFQ::addJob(array('Hello'), array('name' => "Michael", "email" => "*****@*****.**"));
    CKFQ::addJob(array('Hello'), array('name' => "Susan", "email" => "*****@*****.**"));
    CKFQ::addJob(array('Hello'), array('name' => "Cherryanne", "email" => "*****@*****.**"));
    Console::output("Successfully added 3 jobs.");
} catch (Exception $ex) {
    Console::output("Failed to add to queue: " . $ex->getMessage());
}