From 3a949569159ff1dac28e5f7c198f5a4de51f4844 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Sat, 10 Sep 2016 00:19:24 +0200 Subject: [PATCH] [bridges] Remove calls to get_cached and remove_from_cache --- bridges/CADBridge.php | 2 -- bridges/CommonDreamsBridge.php | 2 -- bridges/CpasbienBridge.php | 1 - bridges/DauphineLibereBridge.php | 2 -- bridges/DeveloppezDotComBridge.php | 2 -- bridges/FuturaSciencesBridge.php | 2 -- bridges/JapanExpoBridge.php | 2 -- bridges/KununuBridge.php | 3 --- bridges/LeJournalDuGeekBridge.php | 2 -- bridges/LeMondeInformatiqueBridge.php | 2 -- bridges/LichessBridge.php | 3 --- bridges/NextInpactBridge.php | 2 -- bridges/NiceMatinBridge.php | 2 -- bridges/NumeramaBridge.php | 3 --- bridges/WikipediaBridge.php | 3 --- bridges/WordPressBridge.php | 3 --- 16 files changed, 36 deletions(-) diff --git a/bridges/CADBridge.php b/bridges/CADBridge.php index 1fdcfb5a..86dfdb06 100644 --- a/bridges/CADBridge.php +++ b/bridges/CADBridge.php @@ -16,8 +16,6 @@ class CADBridge extends FeedExpander { } private function CADExtractContent($url) { - if($this->get_cached_time($url) <= strtotime('-24 hours')) - $this->remove_from_cache($url); $html3 = $this->get_cached($url); // The request might fail due to missing https support or wrong URL diff --git a/bridges/CommonDreamsBridge.php b/bridges/CommonDreamsBridge.php index 937590c6..e8a4af38 100644 --- a/bridges/CommonDreamsBridge.php +++ b/bridges/CommonDreamsBridge.php @@ -17,8 +17,6 @@ class CommonDreamsBridge extends FeedExpander { } private function CommonDreamsExtractContent($url) { - if($this->get_cached_time($url) <= strtotime('-24 hours')) - $this->remove_from_cache($url); $html3 = $this->get_cached($url); $text = $html3->find('div[class=field--type-text-with-summary]', 0)->innertext; $html3->clear(); diff --git a/bridges/CpasbienBridge.php b/bridges/CpasbienBridge.php index 454d239d..829c5960 100644 --- a/bridges/CpasbienBridge.php +++ b/bridges/CpasbienBridge.php @@ -28,7 +28,6 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{ $item = array(); $item['author'] = $episode->find('a', 0)->text(); $item['title'] = $episode->find('a', 0)->text(); - $item['timestamp'] = $this->get_cached_time($episode->find('a', 0)->getAttribute('href')); $textefiche=$htmlepisode->find('#textefiche', 0)->find('p',1); if (isset($textefiche)) { $item['content'] = $textefiche->text(); diff --git a/bridges/DauphineLibereBridge.php b/bridges/DauphineLibereBridge.php index 2f645c95..fe4775ca 100644 --- a/bridges/DauphineLibereBridge.php +++ b/bridges/DauphineLibereBridge.php @@ -47,8 +47,6 @@ class DauphineLibereBridge extends FeedExpander { } private function ExtractContent($url) { - if($this->get_cached_time($url) <= strtotime('-24 hours')) - $this->remove_from_cache($url); $html2 = $this->get_cached($url); $text = $html2->find('div.column', 0)->innertext; $text = preg_replace('@]*?>.*?@si', '', $text); diff --git a/bridges/DeveloppezDotComBridge.php b/bridges/DeveloppezDotComBridge.php index cb277eca..fe08d286 100644 --- a/bridges/DeveloppezDotComBridge.php +++ b/bridges/DeveloppezDotComBridge.php @@ -42,8 +42,6 @@ class DeveloppezDotComBridge extends FeedExpander { } private function DeveloppezDotComExtractContent($url) { - if($this->get_cached_time($url) <= strtotime('-24 hours')) - $this->remove_from_cache($url); $articleHTMLContent = $this->get_cached($url); $text = $this->convert_smart_quotes($articleHTMLContent->find('div.content', 0)->innertext); $text = utf8_encode($text); diff --git a/bridges/FuturaSciencesBridge.php b/bridges/FuturaSciencesBridge.php index aef5813c..2cf846c2 100644 --- a/bridges/FuturaSciencesBridge.php +++ b/bridges/FuturaSciencesBridge.php @@ -86,8 +86,6 @@ class FuturaSciencesBridge extends FeedExpander { protected function parseItem($newsItem){ $item = $this->parseRSS_2_0_Item($newsItem); $item['uri'] = str_replace('#xtor=RSS-8', '', $item['uri']); - if($this->get_cached_time($item['uri']) <= strtotime('-24 hours')) - $this->remove_from_cache($item['uri']); $article = $this->get_cached($item['uri']) or $this->returnServerError('Could not request Futura-Sciences: ' . $item['uri']); $item['content'] = $this->ExtractArticleContent($article); diff --git a/bridges/JapanExpoBridge.php b/bridges/JapanExpoBridge.php index db8a2023..4019ae86 100644 --- a/bridges/JapanExpoBridge.php +++ b/bridges/JapanExpoBridge.php @@ -59,8 +59,6 @@ class JapanExpoBridge extends HttpCachingBridgeAbstract { if ($count >= 5) { break; } - if($this->get_cached_time($url) <= strtotime('-24 hours')) - $this->remove_from_cache($url); $article_html = $this->get_cached($url) or $this->returnServerError('Could not request JapanExpo: '.$url); $header = $article_html->find('header.pageHeadBox', 0); diff --git a/bridges/KununuBridge.php b/bridges/KununuBridge.php index 1162668f..da159ce6 100644 --- a/bridges/KununuBridge.php +++ b/bridges/KununuBridge.php @@ -224,9 +224,6 @@ class KununuBridge extends HttpCachingBridgeAbstract { */ private function extract_full_description($uri){ // Load full article - if($this->get_cached_time($uri) <= strtotime('-24 hours')) - $this->remove_from_cache($uri); - $html = $this->get_cached($uri); if($html === false) $this->returnServerError('Could not load full description!'); diff --git a/bridges/LeJournalDuGeekBridge.php b/bridges/LeJournalDuGeekBridge.php index c537a159..c723a2fa 100644 --- a/bridges/LeJournalDuGeekBridge.php +++ b/bridges/LeJournalDuGeekBridge.php @@ -17,8 +17,6 @@ class LeJournalDuGeekBridge extends FeedExpander { } private function LeJournalDuGeekExtractContent($url) { - if($this->get_cached_time($url) <= strtotime('-24 hours')) - $this->remove_from_cache($url); $articleHTMLContent = $this->get_cached($url); $text = $articleHTMLContent->find('div.post-content', 0)->innertext; diff --git a/bridges/LeMondeInformatiqueBridge.php b/bridges/LeMondeInformatiqueBridge.php index 3b3e5b4c..010228a3 100644 --- a/bridges/LeMondeInformatiqueBridge.php +++ b/bridges/LeMondeInformatiqueBridge.php @@ -12,8 +12,6 @@ class LeMondeInformatiqueBridge extends FeedExpander { protected function parseItem($newsItem){ $item = $this->parseRSS_1_0_Item($newsItem); - if($this->get_cached_time($item['uri']) <= strtotime('-24 hours')) - $this->remove_from_cache($item['uri']); $article_html = $this->get_cached($item['uri']) or $this->returnServerError('Could not request LeMondeInformatique: ' . $item['uri']); $item['content'] = $this->CleanArticle($article_html->find('div#article', 0)->innertext); diff --git a/bridges/LichessBridge.php b/bridges/LichessBridge.php index 28e44916..638811d2 100644 --- a/bridges/LichessBridge.php +++ b/bridges/LichessBridge.php @@ -17,9 +17,6 @@ class LichessBridge extends FeedExpander { } private function retrieve_lichess_post($blog_post_uri){ - if($this->get_cached_time($blog_post_uri) <= strtotime('-24 hours')) - $this->remove_from_cache($blog_post_uriuri); - $blog_post_html = $this->get_cached($blog_post_uri); $blog_post_div = $blog_post_html->find('#lichess_blog', 0); diff --git a/bridges/NextInpactBridge.php b/bridges/NextInpactBridge.php index a047f63a..815a2363 100644 --- a/bridges/NextInpactBridge.php +++ b/bridges/NextInpactBridge.php @@ -17,8 +17,6 @@ class NextInpactBridge extends FeedExpander { } private function ExtractContent($url) { - if($this->get_cached_time($url) <= strtotime('-24 hours')) - $this->remove_from_cache($url); $html2 = $this->get_cached($url); $text = '

'.$html2->find('span.sub_title', 0)->innertext.'

' .'

-

' diff --git a/bridges/NiceMatinBridge.php b/bridges/NiceMatinBridge.php index 9f0e5525..6d148ad4 100644 --- a/bridges/NiceMatinBridge.php +++ b/bridges/NiceMatinBridge.php @@ -17,8 +17,6 @@ class NiceMatinBridge extends FeedExpander { } private function NiceMatinExtractContent($url) { - if($this->get_cached_time($url) <= strtotime('-24 hours')) - $this->remove_from_cache($url); $html = $this->get_cached($url); if(!$html) return 'Could not acquire content from url: ' . $url . '!'; diff --git a/bridges/NumeramaBridge.php b/bridges/NumeramaBridge.php index 202d5528..ead340a4 100644 --- a/bridges/NumeramaBridge.php +++ b/bridges/NumeramaBridge.php @@ -17,9 +17,6 @@ class NumeramaBridge extends FeedExpander { } private function ExtractContent($url){ - if($this->get_cached_time($url) <= strtotime('-24 hours')) - $this->remove_from_cache($url); - $article_html = $this->get_cached($url) or $this->returnServerError('Could not request Numerama: '.$url); $contents = $article_html->find('section[class=related-article]', 0)->innertext = ''; // remove related articles block $contents = ''; // add post picture diff --git a/bridges/WikipediaBridge.php b/bridges/WikipediaBridge.php index d6b59a25..d7a90dca 100644 --- a/bridges/WikipediaBridge.php +++ b/bridges/WikipediaBridge.php @@ -175,9 +175,6 @@ class WikipediaBridge extends HttpCachingBridgeAbstract { * Loads the full article from a given URI */ private function LoadFullArticle($uri){ - if($this->get_cached_time($uri) <= strtotime('-24 hours')) - $this->remove_from_cache($uri); - $content_html = $this->get_cached($uri); if(!$content_html) diff --git a/bridges/WordPressBridge.php b/bridges/WordPressBridge.php index 03af466a..30e7e2aa 100644 --- a/bridges/WordPressBridge.php +++ b/bridges/WordPressBridge.php @@ -82,9 +82,6 @@ class WordPressBridge extends HttpCachingBridgeAbstract { $item['timestamp'] = strtotime($article->find('updated', 0)->innertext); } - if($this->get_cached_time($item['uri']) <= strtotime('-24 hours')) - $this->remove_from_cache($item['uri']); - $article_html = $this->get_cached($item['uri']); // Attempt to find most common content div