Beispiel #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     // Log what we are going to do in the laravel.log file
     \Log::info('Started command ' . $this->name, array('src' => __CLASS__));
     // Call the addToQueue helper to queue jobs for
     // the EVE Server, Map and General EVE info
     \App\Services\Queue\QueueHelper::addToQueue('\\Seat\\EveQueues\\Full\\Server', 0, NULL, 'ServerStatus', 'Server');
     \App\Services\Queue\QueueHelper::addToQueue('\\Seat\\EveQueues\\Full\\Map', 0, NULL, 'Map', 'Eve');
     \App\Services\Queue\QueueHelper::addToQueue('\\Seat\\EveQueues\\Full\\Eve', 0, NULL, 'Eve', 'Eve');
     // Log the start of the key processing
     \Log::info('Starting job submissions for all keys', array('src' => __CLASS__));
     // Get the keys that are not disabled and process them.
     foreach (\SeatKey::where('isOk', '=', 1)->get() as $key) {
         // It is important to know the type of key we are working
         // with so that we may know which API calls will
         // apply to it. For that reason, we run the
         // Seat\EveApi\BaseApi\determineAccess()
         // function to get this.
         $access = EveApi\BaseApi::determineAccess($key->keyID);
         // If we failed to determine the access type of the
         // key, continue to the next key.
         if (!isset($access['type'])) {
             \Log::error('Unable to determine type for key ' . $key->keyID, array('src' => __CLASS__));
             continue;
         }
         // Based on the type of key that we have determined it
         // to be, we will call the appropriate addToQueue
         // helper to schedule update jobs for
         switch ($access['type']) {
             case 'Character':
                 // Do a fresh AccountStatus lookup
                 Account\AccountStatus::update($key->keyID, $key->vCode);
                 \App\Services\Queue\QueueHelper::addToQueue('\\Seat\\EveQueues\\Full\\Character', $key->keyID, $key->vCode, 'Character', 'Eve');
                 break;
             case 'Corporation':
                 \App\Services\Queue\QueueHelper::addToQueue('\\Seat\\EveQueues\\Full\\Corporation', $key->keyID, $key->vCode, 'Corporation', 'Eve');
                 break;
             default:
                 break;
         }
     }
 }
Beispiel #2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     // Log what we are going to do in the laravel.log file
     \Log::info('Started command ' . $this->name, array('src' => __CLASS__));
     // Get the keys that are not disabled and process them.
     foreach (\SeatKey::where('isOk', '=', 1)->get() as $key) {
         // It is important to know the type of key we are working
         // with so that we may know which API calls will
         // apply to it. For that reason, we run the
         // Seat\EveApi\BaseApi\determineAccess()
         // function to get this.
         $access = EveApi\BaseApi::determineAccess($key->keyID);
         // If we failed to determine the access type of the
         // key, continue to the next key.
         if (!isset($access['type'])) {
             //TODO: Log this key's problems and disable it
             continue;
         }
         // If the key is a of type 'Character', then we can
         // continue to submit a updater job
         if ($access['type'] == 'Character') {
             // Do a fresh AccountStatus lookup
             Account\AccountStatus::update($key->keyID, $key->vCode);
             // Once the fresh account status lookup is done, call the
             // addToQueue helper to queue a new job.
             \App\Services\Queue\QueueHelper::addToQueue('\\Seat\\EveQueues\\Full\\Character', $key->keyID, $key->vCode, 'Character', 'Eve');
         }
     }
 }
Beispiel #3
0
 public function getUpdateJob($keyID)
 {
     // Ensure that this user may access the data for $keyID
     if (!\Auth::isSuperUser()) {
         if (!in_array($keyID, Session::get('valid_keys'))) {
             App::abort(404);
         }
     }
     // Get the full key and vCode
     $key = SeatKey::where('keyID', $keyID)->first();
     if (!$key) {
         App::abort(404);
     }
     // Check that there is not already an outstanding job for this keyID
     $queue_check = DB::table('queue_information')->whereIn('status', array('Queued', 'Working'))->where('ownerID', $key->keyID)->first();
     if ($queue_check) {
         return Response::json(array('state' => 'existing', 'jobID' => $queue_check->jobID));
     }
     // Else, queue a job for this
     $access = EveApi\BaseApi::determineAccess($key->keyID);
     if (!isset($access['type'])) {
         return Response::json(array('state' => 'error', 'jobID' => null));
     }
     // Only process Character keys here
     if ($access['type'] == 'Character') {
         // Do a fresh AccountStatus lookup
         Account\AccountStatus::update($keyID, $key->vCode);
         $jobID = \App\Services\Queue\QueueHelper::addToQueue('\\Seat\\EveQueues\\Full\\Character', $key->keyID, $key->vCode, 'Character', 'Eve');
         return Response::json(array('state' => 'new', 'jobID' => $jobID));
     } elseif ($access['type'] == 'Corporation') {
         $jobID = \App\Services\Queue\QueueHelper::addToQueue('\\Seat\\EveQueues\\Full\\Corporation', $key->keyID, $key->vCode, 'Corporation', 'Eve');
         return Response::json(array('state' => 'new', 'jobID' => $jobID));
     } else {
         return Response::json(array('keyID' => $key->keyID, 'vCode' => $key->vCode, 'state' => 'error', 'jobID' => null));
     }
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     // Log what we are going to do in the laravel.log file
     \Log::info('Started command ' . $this->name, array('src' => __CLASS__));
     // Get the keys that are not disabled and process them.
     foreach (\SeatKey::where('isOk', '=', 1)->get() as $key) {
         // It is important to know the type of key we are working
         // with so that we may know which API calls will
         // apply to it. For that reason, we run the
         // Seat\EveApi\BaseApi\determineAccess()
         // function to get this.
         $access = EveApi\BaseApi::determineAccess($key->keyID);
         // If we failed to determine the access type of the
         // key, continue to the next key.
         if (!isset($access['type'])) {
             //TODO: Log this key's problems and disable it
             continue;
         }
         // Only process Corporation keys
         if ($access['type'] == 'Corporation') {
             // Call the addToQueue helper to add a new update job. We
             // call the partial call here because some calls for
             // the corporation apis have bery long cache timers
             // and there is no use in doing all that work
             // for cached data. This one calls the
             // Assets updater
             \App\Services\Queue\QueueHelper::addToQueue('\\Seat\\EveQueues\\Partial\\CorporationAssets', $key->keyID, $key->vCode, 'CorporationAssets', 'Eve');
         }
     }
 }