/**
  * Send a job, with a particular type
  * 
  * @param string $type
  *				one of background|scheduled
  * @param string $method
  *				the name of the job, must have a worker defined for it in a GearmanHandler somewhere
  * @param array $args
  *				the method arguments
  */
 public function sendJob($type, $method, $args = array(), $timestamp = 0)
 {
     $client = new \Net\Gearman\Client();
     $client->addServer($this->host, $this->port);
     array_unshift($args, $method);
     array_unshift($args, Director::baseFolder());
     switch ($type) {
         case 'scheduled':
             $client->doEpoch(self::HANDLER_NAME, serialize($args), $timestamp);
             break;
         default:
             $client->doBackground(self::HANDLER_NAME, serialize($args));
     }
 }
        } else {
            $newItems = array();
            parse_str(substr($arg, 0, 2) == '--' ? substr($arg, 2) : $arg, $newItems);
            $_GET = array_merge($_GET, $newItems);
        }
    }
    $_REQUEST = array_merge($_REQUEST, $_GET);
}
// Set 'url' GET parameter
if (isset($_SERVER['argv'][1])) {
    $_REQUEST['url'] = $_SERVER['argv'][1];
    $_GET['url'] = $_SERVER['argv'][1];
}
/**
 * Include SilverStripe's core code
 */
require_once "core/Core.php";
global $databaseConfig;
// We don't have a session in cli-script, but this prevents errors
$_SESSION = null;
// Connect to database
require_once "model/DB.php";
DB::connect($databaseConfig);
// Get the request URL from the querystring arguments
$_SERVER['REQUEST_URI'] = BASE_URL;
// Direct away - this is the "main" function, that hands control to the apporopriate controller
DataModel::set_inst(new DataModel());
$injector = Injector::inst();
$client = new \Net\Gearman\Client();
$client->addServer();
$client->doBackground('silverstripe_handler', serialize(array(Director::baseFolder(), 'GearmanTest', 'other param')));