本文整理汇总了PHP中Resque::enqueue方法的典型用法代码示例。如果您正苦于以下问题:PHP Resque::enqueue方法的具体用法?PHP Resque::enqueue怎么用?PHP Resque::enqueue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resque
的用法示例。
在下文中一共展示了Resque::enqueue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: perform
/**
* Performs the task, can access all $this->crap setup in setUp)
*/
public function perform()
{
$url = $this->args["url"];
$data = json_decode($this->app->cURL->getData($url, 0), true);
$warID = $data["id"];
$timeDeclared = $data["timeDeclared"];
$timeStarted = $data["timeStarted"];
$timeFinished = $data["timeFinished"];
$openForAllies = $data["openForAllies"];
$mutual = $data["mutual"];
$aggressor = $data["aggressor"]["id"];
$aggressorShipsKilled = $data["aggressor"]["shipsKilled"];
$aggressorISKKilled = $data["aggressor"]["iskKilled"];
$defender = $data["defender"]["id"];
$defenderShipsKilled = $data["defender"]["shipsKilled"];
$defenderISKKilled = $data["defender"]["iskKilled"];
$lastUpdated = date("Y-m-d H:i:s");
$this->app->wars->insertWar($warID, $timeDeclared, $timeStarted, $timeFinished, $openForAllies, $mutual, $aggressor, $aggressorShipsKilled, $aggressorISKKilled, $defender, $defenderShipsKilled, $defenderISKKilled);
$this->app->Db->execute("UPDATE wars SET lastUpdated = :lastUpdated WHERE warID = :warID", array(":lastUpdated" => $lastUpdated, ":warID" => $warID));
// Throw the killmail url after the killmail populate task
if ($aggressorShipsKilled > 0 || $defenderShipsKilled > 0) {
$killmailURL = $data["killmails"];
\Resque::enqueue("default", "\\ProjectRena\\Task\\Resque\\populateWarKillmails", array("url" => $killmailURL, "warID" => $warID));
}
}
示例2: execute
/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
//Init rena
/** @var RenaApp $app */
$app = RenaApp::getInstance();
$app->StatsD->increment("ccpRequests");
$data = $app->EVEEVEAllianceList->getData();
if (isset($data["result"]["alliances"])) {
foreach ($data["result"]["alliances"] as $alliance) {
$output->writeln("Updating/Adding: " . $alliance["name"]);
// Update all the corporations in the alliance.. maybe we missed one?
foreach ($alliance["memberCorporations"] as $corporation) {
\Resque::enqueue("default", "\\ProjectRena\\Task\\Resque\\updateCorporation", array("corporationID" => $corporation["corporationID"]));
}
$allianceID = $alliance["allianceID"];
$allianceName = $alliance["name"];
$allianceTicker = $alliance["shortName"];
$memberCount = $alliance["memberCount"];
$executorCorporationID = $alliance["executorCorpID"];
$information = json_decode($app->cURL->getData("https://public-crest.eveonline.com/alliances/{$allianceID}/"), true)["description"];
$app->alliances->updateAllianceDetails($allianceID, $allianceName, $allianceTicker, $memberCount, $executorCorporationID, $information);
$app->alliances->setLastUpdated($allianceID, date("Y-m-d H:i:s"));
}
}
}
示例3: execute
/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
//Init rena
/** @var RenaApp $app */
$app = RenaApp::getInstance();
$run = true;
$oldKillID = 0;
do {
$p = \RedisQ\Action::listen("redisq.zkillboard.com");
if ($p["killID"] > $oldKillID) {
// Get the killmail data.
$k = $app->CrestFunctions->generateFromCREST($p);
// Poke statsd
$app->StatsD->increment("zKillboardReceived");
// Now lets make the json and hash
$json = json_encode($k, JSON_NUMERIC_CHECK);
$hash = $app->CrestFunctions->generateCRESTHash($k);
//$hash = hash("sha256", ":" . $k["killTime"] . ":" . $k["solarSystemID"] . ":" . $k["moonID"] . "::" . $k["victim"]["characterID"] . ":" . $k["victim"]["shipTypeID"] . ":" . $k["victim"]["damageTaken"] . ":");
// Lets insert the killmail!
$insert = $app->killmails->insertIntoKillmails($p["killID"], 0, $hash, "zkillboardRedisQ", $json);
// Upgrade it
if ($insert > 0) {
\Resque::enqueue("turbo", "\\ProjectRena\\Task\\Resque\\upgradeKillmail", array("killID" => $p["killID"]));
}
}
$oldKillID = $p["killID"];
} while ($run == true);
}
示例4: dispatch
/**
* @param RemoteMessage $message
* @return void
*/
public function dispatch(RemoteMessage $message)
{
$this->events()->trigger(__FUNCTION__ . '.pre', $this, array('message' => $message));
$payload = array('message_class' => get_class($message), 'message_data' => $message->toArray());
$jobId = \Resque::enqueue($this->queue, $this->receiverJobClass, $payload, $this->trackStatus);
$this->events()->trigger(__FUNCTION__ . '.post', $this, array('message' => $message, 'jobId' => $jobId));
}
示例5: perform
public function perform()
{
\Resque::setBackend('127.0.0.1:6379');
\Resque::enqueue('default', 'ProofPilot\\Jobs\\VerificationNoticeJob', array());
\Resque::enqueue('default', 'ProofPilot\\Jobs\\InterventionStartJob', array());
\Resque::enqueue('default', 'ProofPilot\\Jobs\\GeneralNotificationInterventionJob', array());
}
示例6: control
public function control()
{
$this->redirectToSternIndiaEndpoint('forgot.php');
$config = Config::getInstance();
//$this->addToView('is_registration_open', $config->getValue('is_registration_open'));
// if (isset($_POST['email']) && $_POST['Submit'] == 'Send Reset') {
// /$_POST['email'] = 'prabhat@sternindia.com';
if (isset($_POST['email'])) {
$this->disableCaching();
$dao = DAOFactory::getDAO('UserDAO');
$user = $dao->getByEmail($_POST['email']);
if (isset($user)) {
$token = $user->setPasswordRecoveryToken();
$es = new ViewManager();
$es->caching = false;
//$es->assign('apptitle', $config->getValue('app_title_prefix')."ThinkUp" );
$es->assign('first_name', $user->first_name);
$es->assign('recovery_url', "session/reset.php?token={$token}");
$es->assign('application_url', Utils::getApplicationURL(false));
$es->assign('site_root_path', $config->getValue('site_root_path'));
$message = $es->fetch('_email.forgotpassword.tpl');
$subject = $config->getValue('app_title_prefix') . "Stern India Password Recovery";
//Will put the things in queue to mail the things.
Resque::enqueue('user_mail', 'Mailer', array($_POST['email'], $subject, $message));
$this->addToView('link_sent', true);
} else {
$this->addErrorMessage('Error: account does not exist.');
}
}
$this->setViewTemplate('Session/forgot.tpl');
return $this->generateView();
}
示例7: restGetQueueAdd
public function restGetQueueAdd()
{
$this->changeViewModel('json');
$queue = $this->params()->fromQuery('queue', 'default');
$jobId = \Resque::enqueue($queue, 'Core\\Jobs\\TestJob', array('name' => $queue), true);
return new JsonModel(array('id' => $jobId, 'size' => \Resque::size($queue)));
}
示例8: execute
/**
* Executes the cronjob task
*
* @param mixed $pid
* @param mixed $md5
*/
public static function execute($pid, $md5)
{
/** @var RenaApp $app */
$app = RenaApp::getInstance();
// Foreach page, throw the war url in question at the Resque task
$data = json_decode($app->cURL->getData("https://public-crest.eveonline.com/wars/", 0), true);
$pageCount = $data["pageCount"];
$currPage = 1;
while ($currPage <= $pageCount) {
// Get the data for the current page
$data = json_decode($app->cURL->getData("https://public-crest.eveonline.com/wars/?page=" . $currPage, 0), true);
foreach ($data["items"] as $war) {
// Figure out if it's already inserted, and if it has ended (or has zero kills)
$inserted = $app->wars->getWarByID($war["id"]);
// If nothing is inserted we'll update
if (empty($inserted)) {
\Resque::enqueue("default", "\\ProjectRena\\Task\\Resque\\populateWars", array("url" => $war["href"]));
}
$date = new DateTime("+36 hour");
$dateIn36Hours = $date->format("Y-m-d H:i:s");
if (!empty($inserted) && $inserted["lastUpdated"] > $dateIn36Hours) {
\Resque::enqueue("default", "\\ProjectRena\\Task\\Resque\\populateWars", array("url" => $war["href"]));
}
}
// Increment the currentPage variable, so we can fetch the next set of wars
$currPage++;
}
exit;
// Keep this at the bottom, to make sure the fork exits
}
示例9: testAfterEnqueueEventCallbackFires
public function testAfterEnqueueEventCallbackFires()
{
$callback = 'afterEnqueueEventCallback';
$event = 'afterEnqueue';
Resque_Event::listen($event, array($this, $callback));
Resque::enqueue('jobs', 'Test_Job', array('somevar'));
$this->assertContains($callback, $this->callbacksHit, $event . ' callback (' . $callback . ') was not called');
}
示例10: send
/**
* Enqueue the message.
*
* @param \PhpGcmQueue\Message $message Message to send.
* @param \DateTime|boolean $delay When to send the message.
*/
public static function send(Message $message, $delay = false)
{
$args = ['serverApiKey' => self::$serverApiKey, 'gcmUrl' => self::$gcmUrl, 'message' => $message->toArray(), 'queueName' => self::$queueName, 'sendJob' => self::$sendJob];
if ($delay) {
$args['delay'] = $delay->format('U');
}
\Resque::enqueue(self::$queueName, self::$sendJob, $args);
}
示例11: sendResetPasswordEmail
public function sendResetPasswordEmail($args)
{
require NOVOPHP_VENDORS_DIR . '/PHPResque/lib/Resque.php';
date_default_timezone_set('GMT');
Resque::setBackend(RESQUE_SERVER_REDIS);
$jobId = Resque::enqueue("email", "ResetPasswordEmail_Job", $args, true);
return $jobId;
}
示例12: schedule_update
public function schedule_update()
{
$this->Maintainer->updateExistingMaintainer('sjosegonzalez');
$maintainers = $this->Maintainer->find('all', array('contain' => false, 'order' => array('Maintainer.username ASC')));
foreach ($maintainers as $maintainer) {
$this->out(sprintf(__('[Maintainer] %s'), $maintainer['Maintainer']['username']));
Resque::enqueue('default', 'UpdateMaintainerJob', array($maintainer['Maintainer']['username']));
}
}
示例13: notify
/**
* Notify about the notice.
*
* If there is a PHP Resque client given in the configuration, then use that to queue up a job to
* send this out later. This should help speed up operations.
*
* @param Airbrake\Notice $notice
*/
public function notify(Notice $notice)
{
if ($this->configuration->queue && class_exists('Resque')) {
$data = array('notice' => serialize($notice), 'configuration' => serialize($this->configuration));
\Resque::enqueue($this->configuration->queue, 'Airbrake\\Resque\\NotifyJob', $data);
return;
}
return $this->connection->send($notice);
}
示例14: execute
/**
* @param $pid
* @param $md5
*/
public static function execute($pid, $md5)
{
$app = RenaApp::getInstance();
if ($app->Storage->get("Api904") >= date("Y-m-d H:i:s")) {
return;
}
\Resque::enqueue("now", "\\ProjectRena\\Task\\Resque\\updateAlliances");
exit;
}
示例15: enqueue
public function enqueue(Job $job, $trackStatus = false)
{
if ($job instanceof ContainerAwareJob) {
$job->setKernelOptions($this->kernelOptions);
}
$result = \Resque::enqueue($job->queue, \get_class($job), $job->args, $trackStatus);
if ($trackStatus) {
return new \Resque_Job_Status($result);
}
return null;
}