Exemplo n.º 1
0
 protected function cron()
 {
     set_time_limit(0);
     ItemUpdater::set_feeds(Feeds::get_instance()->getAll());
     ItemUpdater::$fatal = false;
     foreach (ItemUpdater::process() as $feed => $updated) {
         $name = Feeds::get_instance()->get($feed);
         $name = $name['name'];
         if ($updated < 0) {
             $text = 'An error occurred while updating feed "%1$s".';
         } else {
             $text = Locale::ngettext('Updated feed "%1$s". Added %2$d item.', 'Updated feed "%1$s". Added %2$d items.', $updated);
         }
         $messages[] = array('msg' => sprintf($text, $name, $updated), 'updated' => $updated);
     }
     if (isset($_GET['output'])) {
         return array('success' => 1, 'msgs' => $messages);
     } else {
         die;
     }
 }
Exemplo n.º 2
0
 public static function set_feeds($feeds)
 {
     self::$feeds = $feeds;
 }