Esempio n. 1
0
 private function createCrowdAgent()
 {
     if ($id = CrowdAgent::where('platformAgentId', $workerId)->where('softwareAgent_id', $this->softwareAgent_id)->pluck('_id')) {
         return $id;
     } else {
         $agent = new CrowdAgent();
         $agent->_id = "crowdagent/{$platform}/{$workerId}";
         $agent->softwareAgent_id = $platform;
         $agent->platformAgentId = $workerId;
         $agent->save();
         return $agent->_id;
     }
 }
Esempio n. 2
0
 /**
  * needs workerId in postdata.
  */
 public function postUnflag()
 {
     try {
         $return = array('status' => 'ok');
         $this->authenticateUser();
         $workerid = Input::get('workerid');
         $crowdagent = CrowdAgent::where('_id', $workerid)->first();
         $crowdagent->unflag();
         $return['message'] = "Unflagged worker {$workerid} successfully.";
     } catch (Exception $e) {
         $return['message'] = $e->getMessage();
         $return['status'] = 'bad';
     }
     return $return;
 }
Esempio n. 3
0
 public static function createMainSearchFiltersCache()
 {
     // $mainSearchFilters['media']['formats'] = $this->getDistinctFieldAndCount('format', ['unit']);
     // $mainSearchFilters['media']['domains'] = $this->getDistinctFieldAndCount('domain', ['unit']);
     $mainSearchFilters['media']['categories'] = static::getCategories();
     $mainSearchFilters['media']['all'] = ["count" => Entity::whereIn('tags', ['unit'])->count(), "label" => "All Media"];
     //unset($mainSearchFilters['media']['documentTypes']['twrex']);
     $mainSearchFilters['job']['count'] = Entity::where('type', 'job')->count();
     $mainSearchFilters['workers']['count'] = CrowdAgent::all()->count();
     ksort($mainSearchFilters['media']['categories']);
     $entity = new Temp();
     $entity->_id = "mainSearchFilters";
     $entity->filters = $mainSearchFilters;
     $entity->save();
     return $entity->toArray();
 }
Esempio n. 4
0
 public function getUpdatecrowdagent()
 {
     foreach (CrowdAgent::get() as $worker) {
         set_time_limit(30);
         Queue::push('Queues\\UpdateCrowdAgent', array('crowdagent' => serialize($worker)));
     }
 }