From 7363acfa6b39d14ca2b2a5d446de0165187a1ed8 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Sun, 28 Aug 2016 19:39:23 +0200 Subject: [PATCH] [Wikipedia] Use cache for full articles --- bridges/WikipediaBridge.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bridges/WikipediaBridge.php b/bridges/WikipediaBridge.php index 7a28403..ea75441 100644 --- a/bridges/WikipediaBridge.php +++ b/bridges/WikipediaBridge.php @@ -3,7 +3,7 @@ define('WIKIPEDIA_SUBJECT_TFA', 0); // Today's featured article define('WIKIPEDIA_SUBJECT_DYK', 1); // Did you know... -class WikipediaBridge extends BridgeAbstract{ +class WikipediaBridge extends HttpCachingBridgeAbstract { public function loadMetadatas(){ $this->maintainer = 'logmanoriginal'; $this->name = 'Wikipedia bridge for many languages'; @@ -188,7 +188,10 @@ class WikipediaBridge extends BridgeAbstract{ * Loads the full article from a given URI */ private function LoadFullArticle($uri){ - $content_html = $this->getSimpleHTMLDOM($uri); + if($this->get_cached_time($uri) <= strtotime('-24 hours')) + $this->remove_from_cache($uri); + + $content_html = $this->get_cached($uri); if(!$content_html) $this->returnServerError('Could not load site: ' . $uri . '!');