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:
Sam Minnee 2007-12-13 00:39:33 +00:00
parent 0235aee5df
commit 5f4422f54a

View File

@ -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 {