diff -r 5b37998e522e -r 162c1de6545a web/lib/Zend/Json/Server/Cache.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Json/Server/Cache.php Fri Mar 11 15:05:35 2011 +0100 @@ -0,0 +1,102 @@ +getServiceMap()->toJson())) { + return false; + } + + return true; + } + + /** + * Retrieve a cached SMD + * + * On success, returns the cached SMD (a JSON string); an failure, returns + * boolean false. + * + * @param string $filename + * @return string|false + */ + public static function getSmd($filename) + { + if (!is_string($filename) + || !file_exists($filename) + || !is_readable($filename)) + { + return false; + } + + + if (false === ($smd = @file_get_contents($filename))) { + return false; + } + + return $smd; + } + + /** + * Delete a file containing a cached SMD + * + * @param string $filename + * @return bool + */ + public static function deleteSmd($filename) + { + if (is_string($filename) && file_exists($filename)) { + unlink($filename); + return true; + } + + return false; + } +}