mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-29 06:38:51 +03:00
Fixing cache issue causing memory leak
This commit is contained in:
parent
5a2a6fbdba
commit
ca9cc12b0c
1 changed files with 5 additions and 3 deletions
|
@ -22,13 +22,15 @@ class CommonDreamsBridge extends BridgeAbstract{
|
||||||
function CommonDreamsExtractContent($url) {
|
function CommonDreamsExtractContent($url) {
|
||||||
$html3 = file_get_html($url);
|
$html3 = file_get_html($url);
|
||||||
$text = $html3->find('div[class=field--type-text-with-summary]', 0)->innertext;
|
$text = $html3->find('div[class=field--type-text-with-summary]', 0)->innertext;
|
||||||
|
$html3->clear();
|
||||||
|
unset ($html3);
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = file_get_html('http://www.commondreams.org/rss.xml') or $this->returnError('Could not request CommonDreams.', 404);
|
$html = file_get_html('http://www.commondreams.org/rss.xml') or $this->returnError('Could not request CommonDreams.', 404);
|
||||||
$limit = 0;
|
$limit = 0;
|
||||||
foreach($html->find('item') as $element) {
|
foreach($html->find('item') as $element) {
|
||||||
if($limit < 2) {
|
if($limit < 4) {
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
$item->title = $element->find('title', 0)->innertext;
|
$item->title = $element->find('title', 0)->innertext;
|
||||||
$item->uri = CommonDreamsUrl($element->find('guid', 0)->innertext);
|
$item->uri = CommonDreamsUrl($element->find('guid', 0)->innertext);
|
||||||
|
@ -50,7 +52,7 @@ class CommonDreamsBridge extends BridgeAbstract{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCacheDuration(){
|
public function getCacheDuration(){
|
||||||
// return 3600*2; // 2 hours
|
return 3600; // 1 hours
|
||||||
return 0;
|
// return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue