forked from blallo/rss-bridge
[Wikipedia] Use cache for full articles
This commit is contained in:
parent
a7b3519c35
commit
7363acfa6b
1 changed files with 5 additions and 2 deletions
|
@ -3,7 +3,7 @@
|
||||||
define('WIKIPEDIA_SUBJECT_TFA', 0); // Today's featured article
|
define('WIKIPEDIA_SUBJECT_TFA', 0); // Today's featured article
|
||||||
define('WIKIPEDIA_SUBJECT_DYK', 1); // Did you know...
|
define('WIKIPEDIA_SUBJECT_DYK', 1); // Did you know...
|
||||||
|
|
||||||
class WikipediaBridge extends BridgeAbstract{
|
class WikipediaBridge extends HttpCachingBridgeAbstract {
|
||||||
public function loadMetadatas(){
|
public function loadMetadatas(){
|
||||||
$this->maintainer = 'logmanoriginal';
|
$this->maintainer = 'logmanoriginal';
|
||||||
$this->name = 'Wikipedia bridge for many languages';
|
$this->name = 'Wikipedia bridge for many languages';
|
||||||
|
@ -188,7 +188,10 @@ class WikipediaBridge extends BridgeAbstract{
|
||||||
* Loads the full article from a given URI
|
* Loads the full article from a given URI
|
||||||
*/
|
*/
|
||||||
private function LoadFullArticle($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)
|
if(!$content_html)
|
||||||
$this->returnServerError('Could not load site: ' . $uri . '!');
|
$this->returnServerError('Could not load site: ' . $uri . '!');
|
||||||
|
|
Loading…
Reference in a new issue