当前位置: 首页>>代码示例>>PHP>>正文


PHP Resque::enqueue方法代码示例

本文整理汇总了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));
     }
 }
开发者ID:bllevy2,项目名称:projectRena,代码行数:28,代码来源:populateWars.php

示例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"));
         }
     }
 }
开发者ID:bllevy2,项目名称:projectRena,代码行数:31,代码来源:UpdateAllianceListTask.php

示例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);
 }
开发者ID:bllevy2,项目名称:projectRena,代码行数:34,代码来源:zkillboardReceiveTask.php

示例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));
 }
开发者ID:prooph,项目名称:psb-php-resque-dispatcher,代码行数:11,代码来源:MessageDispatcher.php

示例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());
 }
开发者ID:ddobei,项目名称:Fresque,代码行数:7,代码来源:GeneralNotificationInterventionJob.php

示例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();
 }
开发者ID:prabhatse,项目名称:olx_hack,代码行数:32,代码来源:class.ForgotPasswordController.php

示例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)));
 }
开发者ID:ahyswang,项目名称:eva-engine,代码行数:7,代码来源:QueueController.php

示例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
 }
开发者ID:bllevy2,项目名称:projectRena,代码行数:36,代码来源:populateWarsCronjob.php

示例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');
 }
开发者ID:HMAZonderland,项目名称:php-resque-ex,代码行数:8,代码来源:EventTest.php

示例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);
 }
开发者ID:stevetauber,项目名称:php-gcm-queue,代码行数:14,代码来源:Client.php

示例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;
 }
开发者ID:Rming,项目名称:novophp,代码行数:8,代码来源:UsersHelper.php

示例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']));
     }
 }
开发者ID:superstarrajini,项目名称:cakepackages,代码行数:9,代码来源:MaintainerShell.php

示例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);
 }
开发者ID:p-makowski,项目名称:Airbrake-Magento,代码行数:17,代码来源:Client.php

示例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;
 }
开发者ID:milleruk,项目名称:projectRena,代码行数:13,代码来源:updateAlliancesCronjob.php

示例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;
 }
开发者ID:rosstuck,项目名称:BCCResqueBundle,代码行数:11,代码来源:Resque.php


注:本文中的Resque::enqueue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。