1
0
Fork 0
forked from blallo/rss-bridge

[Wikipedia] Use cache for full articles

This commit is contained in:
logmanoriginal 2016-08-28 19:39:23 +02:00
parent a7b3519c35
commit 7363acfa6b

View file

@ -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 . '!');