Example #1
0
 public function actionUpdate()
 {
     $httpRequest = $this->context->getService('httpRequest');
     if ($this->option->get('cron') != $httpRequest->getQuery('cron')) {
         throw new \Nette\Application\BadRequestException("Invalid request");
     }
     $feeds = $this->feed->get_all();
     foreach ($feeds as $feed) {
         try {
             $articles = $this->feed->parse_articles($feed->id);
             $this->article->add_multiple($articles);
             // Debugger::dump($articles);
             // exit;
         } catch (\Exception $e) {
             $this->error->save($feed->id, $e);
         }
         libxml_clear_errors();
     }
     $this->terminate();
 }