|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00030 class Zend_Server_Cache 00031 { 00035 protected static $_skipMethods = array(); 00036 00050 public static function save($filename, Zend_Server_Interface $server) 00051 { 00052 if (!is_string($filename) 00053 || (!file_exists($filename) && !is_writable(dirname($filename)))) 00054 { 00055 return false; 00056 } 00057 00058 $methods = $server->getFunctions(); 00059 00060 if ($methods instanceof Zend_Server_Definition) { 00061 $definition = new Zend_Server_Definition(); 00062 foreach ($methods as $method) { 00063 if (in_array($method->getName(), self::$_skipMethods)) { 00064 continue; 00065 } 00066 $definition->addMethod($method); 00067 } 00068 $methods = $definition; 00069 } 00070 00071 if (0 === @file_put_contents($filename, serialize($methods))) { 00072 return false; 00073 } 00074 00075 return true; 00076 } 00077 00109 public static function get($filename, Zend_Server_Interface $server) 00110 { 00111 if (!is_string($filename) 00112 || !file_exists($filename) 00113 || !is_readable($filename)) 00114 { 00115 return false; 00116 } 00117 00118 00119 if (false === ($dispatch = @file_get_contents($filename))) { 00120 return false; 00121 } 00122 00123 if (false === ($dispatchArray = @unserialize($dispatch))) { 00124 return false; 00125 } 00126 00127 $server->loadFunctions($dispatchArray); 00128 00129 return true; 00130 } 00131 00138 public static function delete($filename) 00139 { 00140 if (is_string($filename) && file_exists($filename)) { 00141 unlink($filename); 00142 return true; 00143 } 00144 00145 return false; 00146 } 00147 }