Esempio n. 1
0
 /**
  * import mails from ccp's API.
  * @param array $options
  */
 public function api_import(array $options)
 {
     $log = Registry::getInstance()->getLogger();
     $log->info("api import running");
     foreach (User::findWithApiKeys() as $user) {
         /** @var User $user */
         foreach ($user['keys'] as $keyid => $key) {
             // skip inactive keys
             if (!$key['active']) {
                 continue;
             }
             try {
                 $stats = EveApi::fetch($key);
                 $log->info("processed key {$keyid} for user " . $user->name . " : " . $stats['old'] . ' known / ' . $stats['new'] . " new");
             } catch (\Exception $e) {
                 // we caught a pheal exception, we should implement proper handling of errors here
                 $log->warning("key {$keyid} caused pheal exception: " . $e->getMessage());
             }
         }
     }
 }