Пример #1
0
 public static function update($rssItems)
 {
     $logger = new Logger();
     $logger->log('info', 'Updating GUIDs');
     GuidFileHandler::addGuidFileIfNotExists();
     $aGuids = [];
     foreach ($rssItems as $rssItem) {
         array_push($aGuids, (string) $rssItem->guid);
     }
     GuidFileHandler::updateGuids($aGuids);
 }
 public static function checkForNewContent($rssFeed)
 {
     $log = new Logger();
     $rssFileContents = FileReader::readFile(Config::$rssGuidFileLocation);
     if (!$rssFileContents) {
         $log->log('info', 'GUID file is empty');
         return true;
     }
     $aGuids = GuidFileHandler::getGuids();
     foreach ($rssFeed->channel->item as $item) {
         if (!in_array((string) $item->guid, $aGuids)) {
             $log->log('info', 'Rss file has new content');
             return true;
         }
     }
     return false;
 }