mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
lperera: #1819 - Patch to prevent caching empty responses in RestfulService
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@46731 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
0235aee5df
commit
5f4422f54a
@ -56,10 +56,6 @@ class RestfulService extends ViewableData {
|
||||
$this->rawXML = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
// save the response in cache
|
||||
$fp = @fopen($cache_path,"w+");
|
||||
@fwrite($fp,$this->rawXML);
|
||||
@fclose($fp);
|
||||
}
|
||||
|
||||
// Try using file_get_contents if cURL is not installed in your system.
|
||||
@ -67,6 +63,11 @@ class RestfulService extends ViewableData {
|
||||
|
||||
// results returned - from cache / live
|
||||
if($this->rawXML != ""){
|
||||
// save the response in cache
|
||||
$fp = @fopen($cache_path,"w+");
|
||||
@fwrite($fp,$this->rawXML);
|
||||
@fclose($fp);
|
||||
|
||||
if($this->checkErrors == true) {
|
||||
return $this->errorCatch($this->rawXML);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user