コード例 #1
0
 protected function updateConquerableStations()
 {
     $stationLastUpdate = $this->em->getRepository('AppBundle:ApiUpdate')->getLastUpdateByType(ApiUpdate::CONQUERABLE_STATIONS);
     $update = false;
     if ($stationLastUpdate === null || $this->now->diffInHours(Carbon::instance($stationLastUpdate->getCreatedAt())) > 24) {
         $this->log->info('Updating Conquerable Stations');
         $this->evedata_registry->get(ConquerableStationManager::getName())->updateConquerableStations();
         $update = $this->update_service->createApiUpdate(ApiUpdate::CACHE_STYLE_LONG, ApiUpdate::CONQUERABLE_STATIONS, true);
         $this->em->persist($update);
         $update = true;
     }
     return $update;
 }
コード例 #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $force = $input->getOption('force', false);
     $em = $this->getContainer()->get('doctrine.orm.entity_manager');
     $log = $this->getContainer()->get('logger');
     $dataUpdateService = $this->getContainer()->get('app.evedataupdate.service');
     $updateRegistry = $this->getContainer()->get('app.evedata.registry');
     $log->info('Preparing Reference Data');
     $corps = $em->getRepository('AppBundle:Corporation')->findAll();
     $now = new Carbon();
     $stationLastUpdate = $em->getRepository('AppBundle:ApiUpdate')->getLastUpdateByType(ApiUpdate::CONQUERABLE_STATIONS);
     $refTypeLastUpdate = $em->getRepository('AppBundle:ApiUpdate')->getLastUpdateByType(ApiUpdate::REF_TYPES);
     $update = false;
     if ($stationLastUpdate === null || $now->diffInHours(Carbon::instance($stationLastUpdate->getCreatedAt())) > 24) {
         $log->info('Updating Conquerable Stations');
         $updateRegistry->get(ConquerableStationManager::getName())->updateConquerableStations();
         $update = $dataUpdateService->createApiUpdate(ApiUpdate::CACHE_STYLE_LONG, ApiUpdate::CONQUERABLE_STATIONS, true);
         $em->persist($update);
         $update = true;
     }
     if ($refTypeLastUpdate === null || $now->diffInHours(Carbon::Instance($refTypeLastUpdate->getCreatedAt())) > 24) {
         $log->info('Updating Reference Types');
         $updateRegistry->get(RefTypeManager::getName())->updateRefTypes();
         $update = $dataUpdateService->createApiUpdate(ApiUpdate::CACHE_STYLE_LONG, ApiUpdate::REF_TYPES, true);
         $em->persist($update);
         $update = true;
     }
     if ($update) {
         $log->info('Flushing Data');
         $em->flush();
     }
     $corp_ids = [];
     foreach ($corps as $c) {
         $log->info("Starting Update {$c->getCorporationDetails()->getName()}\n\n");
         $this->getContainer()->get('app.corporation.manager')->checkCorporationDetails($c);
         $dataUpdateService->updateShortTimerCalls($c, $force);
         $em->flush();
         $dataUpdateService->updateLongTimerCalls($c, $force);
         $em->flush();
         $corp_ids[] = $c->getId();
         $log->info("Finished Updated {$c->getCorporationDetails()->getName()}");
     }
     $log->info("Updating Compound Fields.");
     $start = microtime(true);
     $dataUpdateService->updateAssetCache($corp_ids);
     $log->info(sprintf("Done in %s", microtime(true) - $start));
 }