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


PHP Queue::push方法代码示例

本文整理汇总了PHP中Queue::push方法的典型用法代码示例。如果您正苦于以下问题:PHP Queue::push方法的具体用法?PHP Queue::push怎么用?PHP Queue::push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Queue的用法示例。


在下文中一共展示了Queue::push方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: async

 /**
  * @param callable $callback A task to start processing in the background
  * @return Task
  */
 public function async(callable $callback) : Task
 {
     $id = TaskIdFactory::new();
     $task = new Task($this->subscriber, $id);
     $this->queue->push($id, $callback);
     return $task;
 }
开发者ID:adamnicholson,项目名称:kyew,代码行数:11,代码来源:Kyew.php

示例2: testDeprovision

 /**
  * Tests deprovision request
  */
 public function testDeprovision()
 {
     $_instanceId = 'wicker';
     $_payload = ['instance-id' => $_instanceId, 'owner-id' => 22, 'guest-location' => GuestLocations::DFE_CLUSTER];
     $_job = new DeprovisionJob($_instanceId, $_payload);
     $_result = \Queue::push($_job);
 }
开发者ID:rajeshpillai,项目名称:dfe-console,代码行数:10,代码来源:DeprovisionTest.php

示例3: postLogin

 public function postLogin(Request $request)
 {
     $this->validate($request, ['user_id' => 'required', 'password' => 'required']);
     $credentials = $request->only('user_id', 'password');
     $redirect = $this->redirectPath();
     $lock_new_users = true;
     $try = false;
     if (User::find($credentials['user_id'])) {
         // The user exists
         $try = true;
     } else {
         if ($lock_new_users) {
             return redirect('/locked');
         } else {
             if (($person = Person::find($credentials['user_id'])) && DataSource::check_login($credentials['user_id'], $credentials['password'])) {
                 // The ID exists and details are correct, but there isn't an account for it. Make one.
                 $user = User::create(['user_id' => $credentials['user_id'], 'name' => $person->name, 'password' => \Crypt::encrypt($credentials['password']), 'is_queued' => true]);
                 \Queue::push(new PrepareUser($user));
                 $redirect = '/setup';
                 $try = true;
             }
         }
     }
     if ($try && Auth::attempt($credentials, $request->has('remember'))) {
         return redirect()->intended($redirect);
     }
     return redirect($this->loginPath())->withInput($request->only('user_id', 'remember'))->withErrors(['user_id' => $this->getFailedLoginMessage()]);
 }
开发者ID:oeed,项目名称:Keystone-Next,代码行数:28,代码来源:AuthController.php

示例4: deletePicture

 public function deletePicture()
 {
     if (Input::has('keys')) {
         Queue::push('qiniu_delete', Input::get('keys'));
     }
     return Response::make('');
 }
开发者ID:Jv-Juven,项目名称:gift,代码行数:7,代码来源:UploadController.php

示例5: pushCampaign

 /**
  * @param int        $campaignId
  * @param int        $startTime
  * @param int        $startId
  * @param int        $endId
  * @param null|array $additionalData
  *
  * @return bool
  * @throws \Exception
  */
 public static function pushCampaign($campaignId, $startTime = null, $startId = null, $endId = null, $additionalData = null)
 {
     if ($startTime === null) {
         $startTime = time();
         $startTime -= $startTime % 60;
     }
     $campaign = new Campaign($campaignId);
     $campaign->reload();
     if (!$campaign->processors) {
         throw new \Exception('Cannot queue a Campaign with no Processors');
     }
     $lastTime = $campaign->lastSent;
     if ($lastTime != $startTime) {
         $campaign->lastSent = $startTime;
         $campaign->saveChanges();
         $message = new ProcessMessage();
         $message->setData('campaignId', $campaignId);
         $message->setData('startedAt', $startTime);
         $message->setData('lastSent', $lastTime);
         $message->setData('startId', $startId);
         $message->setData('endId', $endId);
         if ($additionalData) {
             $message->setData('additionalData', $additionalData);
         }
         \Queue::setDefaultQueueProvider("campaignqueue");
         \Queue::push(new StdQueue('defero_campaigns'), serialize($message));
         \Log::info('Queued Campaign ' . $campaignId);
         return true;
     }
     \Log::info('Campaign ' . $campaignId . ' already queued' . ' ~ ' . $lastTime . ' ' . $startTime);
     return false;
 }
开发者ID:qubes,项目名称:defero,代码行数:42,代码来源:Defero.php

示例6: fire

 public function fire()
 {
     $hosts = Host::where('state', '!=', 'disabled')->where('cron', '=', 'yes')->get(array('id'));
     foreach ($hosts as $host) {
         Queue::push('BackupController@dailyBackup', array('id' => $host->id));
     }
 }
开发者ID:snake007v,项目名称:nefarious-octo-woof,代码行数:7,代码来源:CronBackup.php

示例7: put

 public function put($uid)
 {
     $token = Input::get('token');
     $result = $this->contextIO->getConnectToken(null, $token);
     if (!$result) {
         return ['success' => 'false', 'error_message' => 'Failed to retrieve a connect token from context.io'];
     }
     $response = $result->getData();
     $responseJSON = json_encode($response);
     $response = json_decode($responseJSON);
     $data = $response->account;
     $serviceMap = ['imap.googlemail.com' => 'gmail', 'imap-mail.outlook.com:993' => 'outlook'];
     $desired_data = ['email_address' => $data->email_addresses[0], 'mailbox_id' => $data->id, 'service' => isset($serviceMap[$data->sources[0]->server]) ? $serviceMap[$data->sources[0]->server] : 'other'];
     $account = new Mailbox();
     $account->id = $uid;
     $account->mailbox_id = $desired_data['mailbox_id'];
     $account->email_address = $desired_data['email_address'];
     $account->service = $desired_data['service'];
     if (!$account->save()) {
         return ['success' => false, 'error_message' => 'Failed to save account details'];
     }
     // TODO: Start sync process
     // Queue Mailbox crawl
     try {
         Queue::push('ContextIOCrawlerController@dequeue', ['id' => $uid], 'contextio.sync.' . Config::get('queue.postfix'));
     } catch (Exception $e) {
         return ['success' => false, 'error_message' => $e->getMessage()];
     }
     return ['success' => true];
 }
开发者ID:andrewpurkett,项目名称:demo-dropbox-rest-service,代码行数:30,代码来源:ContextIOSubscriptionController.php

示例8: postEdit

 public function postEdit($id)
 {
     if (!$this->checkRoute()) {
         return Redirect::route('index');
     }
     $title = 'Edit A Modpack Code - ' . $this->site_name;
     $input = Input::only('code', 'launcher', 'modpack');
     $modpackcode = ModpackCode::find($id);
     $messages = ['unique' => 'A code for this launcher/modpack combination already exists in the database!'];
     $validator = Validator::make($input, ['code' => 'required|unique:modpack_codes,code,' . $modpackcode->id, 'launcher' => 'required', 'modpack' => 'required'], $messages);
     if ($validator->fails()) {
         // TODO this line originally redirects to modpack-code/edit, there's no route for this, is this an error?
         return Redirect::action('ModpackCodeController@getEdit', [$id])->withErrors($validator)->withInput();
     }
     $modpackcode->code = $input['code'];
     $modpackcode->modpack_id = $input['modpack'];
     $modpackcode->launcher_id = $input['launcher'];
     $modpackcode->last_ip = Request::getClientIp();
     $success = $modpackcode->save();
     if ($success) {
         Cache::tags('modpacks')->flush();
         Queue::push('BuildCache');
         return View::make('modpackcodes.edit', ['title' => $title, 'success' => true, 'modpackcode' => $modpackcode]);
     }
     return Redirect::action('ModpackCodeController@getEdit', [$id])->withErrors(['message' => 'Unable to add modpack code.'])->withInput();
 }
开发者ID:helkarakse,项目名称:modpackindex,代码行数:26,代码来源:ModpackCodeController.php

示例9: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     // message
     $data = array('type' => $this->argument('type'), 'id' => $this->argument('id'), 'date' => $this->argument('date'));
     // add message to queue
     Queue::push("Scraper", $data);
 }
开发者ID:Tjoosten,项目名称:harvester,代码行数:12,代码来源:ManualQueueCommand.php

示例10: addToQueue

 public static function addToQueue($queue, $ownerID, $vCode, $api, $scope)
 {
     // Prepare the auth array
     if ($vCode != null) {
         $auth = array('keyID' => $ownerID, 'vCode' => $vCode);
     } else {
         $auth = array();
     }
     // Check the databse if there are jobs outstanding ie. they have the status
     // Queued or Working. If not, we will queue a new job, else just capture the
     // jobID and return that
     $jobID = \SeatQueueInformation::where('ownerID', '=', $ownerID)->where('api', '=', $api)->whereIn('status', array('Queued', 'Working'))->first();
     // Check if the $jobID was found, else, queue a new job
     if (!$jobID) {
         $jobID = \Queue::push($queue, $auth);
         \SeatQueueInformation::create(array('jobID' => $jobID, 'ownerID' => $ownerID, 'api' => $api, 'scope' => $scope, 'status' => 'Queued'));
     } else {
         // To aid in potential capacity debugging, lets write a warning log entry so that a user
         // is able to see that a new job was not submitted
         \Log::warning('A new job was not submitted due a similar one still being outstanding. Details: ' . $jobID, array('src' => __CLASS__));
         // Set the jobID to the ID from the database
         $jobID = $jobID->jobID;
     }
     return $jobID;
 }
开发者ID:boweiliu,项目名称:seat,代码行数:25,代码来源:helpers.php

示例11: show

 function show(Pilot $pilot)
 {
     $active = Flight::with('departure', 'departure.country', 'arrival', 'arrival.country')->whereVatsimId($pilot->vatsim_id)->whereIn('state', array(0, 1, 3, 4))->first();
     $flights = Flight::with('departure', 'departure.country', 'arrival', 'arrival.country')->whereVatsimId($pilot->vatsim_id)->whereState(2)->orderBy('arrival_time', 'desc')->take(15)->get();
     $flightCount = Flight::whereVatsimId($pilot->vatsim_id)->whereState(2)->count();
     $stats = new FlightStat(Flight::whereVatsimId($pilot->vatsim_id));
     if ($pilot->processing == 0) {
         Queue::push('LegacyUpdate', $pilot->vatsim_id, 'legacy');
         $pilot->processing = 2;
         $pilot->save();
     }
     if ($pilot->processing == 2) {
         Messages::success('The data for this pilot is currently being processed. In a couple of minutes, all statistics will be available.')->one();
     }
     $distances = $stats->distances($pilot->distance);
     $citypair = $stats->citypair();
     if ($flights->count() > 0) {
         $durations = $stats->durations($pilot->duration);
         extract($durations);
     }
     // Charts: popular airlines, airports and aircraft
     $airlines = $stats->topAirlines();
     $airports = $stats->topAirports();
     $aircraft = $stats->topAircraft();
     $this->javascript('assets/javascript/jquery.flot.min.js');
     $this->javascript('assets/javascript/jquery.flot.pie.min.js');
     $this->autoRender(compact('pilot', 'flights', 'active', 'distances', 'airlines', 'aircraft', 'airports', 'longest', 'shortest', 'citypair', 'hours', 'minutes'), $pilot->name);
 }
开发者ID:T-SummerStudent,项目名称:new,代码行数:28,代码来源:PilotController.php

示例12: postEdit

 public function postEdit($id)
 {
     if (!$this->checkRoute()) {
         return Redirect::route('index');
     }
     $title = 'Edit A Modpack Code - ' . $this->site_name;
     $input = Input::only('name', 'deck', 'description', 'slug');
     $modpacktag = ModpackTag::find($id);
     $messages = ['unique' => 'This modpack tag already exists in the database!'];
     $validator = Validator::make($input, ['name' => 'required|unique:modpack_tags,name,' . $modpacktag->id, 'deck' => 'required'], $messages);
     if ($validator->fails()) {
         return Redirect::action('ModpackTagController@getEdit', [$id])->withErrors($validator)->withInput();
     }
     $modpacktag->name = $input['name'];
     $modpacktag->deck = $input['deck'];
     $modpacktag->description = $input['description'];
     $modpacktag->last_ip = Request::getClientIp();
     if ($input['slug'] == '' || $input['slug'] == $modpacktag->slug) {
         $slug = Str::slug($input['name']);
     } else {
         $slug = $input['slug'];
     }
     $modpacktag->slug = $slug;
     $success = $modpacktag->save();
     if ($success) {
         Cache::tags('modpacks')->flush();
         Queue::push('BuildCache');
         return View::make('tags.modpacks.edit', ['title' => $title, 'success' => true, 'modpacktag' => $modpacktag]);
     }
     return Redirect::action('ModpackTagController@getEdit', [$id])->withErrors(['message' => 'Unable to edit modpack code.'])->withInput();
 }
开发者ID:helkarakse,项目名称:modpackindex,代码行数:31,代码来源:ModpackTagController.php

示例13: placeNodeInLimbo

 public function placeNodeInLimbo($node_id, $integration_id)
 {
     $node = Node::find($node_id);
     $node->limbo = true;
     Queue::push('DeployAgentToNode', array('message' => array('node_id' => $node_id, 'integration_id' => $integration_id)));
     $node->save();
 }
开发者ID:crudbug,项目名称:Dashboard,代码行数:7,代码来源:NodesController.php

示例14: store

 /**
  * Store a newly created upload in storage.
  *
  * @return Response
  */
 public function store()
 {
     Upload::setRules('store');
     if (!Upload::canCreate()) {
         return $this->_access_denied();
     }
     $file = Input::file('file');
     $hash = md5(microtime() . time());
     $data = [];
     $data['path'] = public_path() . '/uploads/' . $hash . '/';
     mkdir($data['path']);
     $data['url'] = url('uploads/' . $hash);
     $data['name'] = preg_replace('/[^a-zA-Z0-9_.-]/', '_', $file->getClientOriginalName());
     $data['type'] = $file->getMimeType();
     $data['size'] = $file->getSize();
     $data['uploadable_type'] = Request::header('X-Uploader-Class');
     $data['uploadable_id'] = Request::header('X-Uploader-Id') ? Request::header('X-Uploader-Id') : 0;
     $data['token'] = Request::header('X-CSRF-Token');
     $file->move($data['path'], $data['name']);
     if (property_exists($data['uploadable_type'], 'generate_image_thumbnails')) {
         Queue::push('ThumbnailService', array('path' => $data['path'] . '/' . $data['name']));
     }
     $upload = new Upload();
     $upload->fill($data);
     if (!$upload->save()) {
         return $this->_validation_error($upload);
     }
     if (Request::ajax()) {
         return Response::json($upload, 201);
     }
     return Redirect::back()->with('notification:success', $this->created_message);
 }
开发者ID:k4ml,项目名称:laravel-base,代码行数:37,代码来源:UploadsController.php

示例15: toDBResult

 public function toDBResult()
 {
     foreach ($this->items as $item) {
         $result_id = $item->toDBResult();
         \Queue::push(new \App\Commands\ProcessResult($result_id));
     }
 }
开发者ID:flo5581,项目名称:amazon,代码行数:7,代码来源:AmazonPageCollection.php


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