protected function insertNewEntries() { $feedsModel = $this->getServiceManager()->get('feeds'); $entriesModel = $this->getServiceManager()->get('entries'); $updater = new Updater($feedsModel, $entriesModel); $updater->update(1000); }
public function importAction() { $file = $this->getFile('file'); $messenger = new FlashMessenger(); if (!$file || $file['error'] > 0) { $messenger->add(sprintf('File \'%s\' has not been correctly uploaded.', $file['name']), 'import-error'); $this->redirect('settings'); } $subscriptions = @simplexml_load_file($file['tmp_name']); if (!$subscriptions || !$subscriptions->body) { $messenger->add(sprintf('\'%s\' is not a valid OPML file.', $file['name']), 'import-error'); $this->redirect('settings'); } $feeds = $this->getServiceManager()->get('feeds'); $tags = $this->getServiceManager()->get('tags'); $entries = $this->getServiceManager()->get('entries'); $opml = new Opml(); $opml->process($subscriptions->body, $feeds, $tags); $updater = new Updater($feeds, $entries); $updater->update(); return $this->redirect(''); }