FeedCache
FeedCache copied to clipboard
filemtime problem in populate_data()
Fist delete remote files when the files expire, function cache_feed.
private function cache_feed() { if($this->remote_file_exists($this->remote)) {
//---------------------line-added-begin
//First delete localfiles
unlink($this->local);
//---------------------line-added-end
//Second get and create the remote files, this refresh the filemtime used in check_expired
$compressed_content = '';
$remote_content = file_get_contents($this->remote);
$compressed_content = preg_replace('/\s*?\n\s*/', "\n", $remote_content);
$compressed_content = preg_replace('/( |\t)( |\t)*/', " ", $compressed_content);
file_put_contents($this->local, $compressed_content);
return true;
} else {
return false;
}
}