diff options
Diffstat (limited to 'lib/fileproxy.php')
-rw-r--r-- | lib/fileproxy.php | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/lib/fileproxy.php b/lib/fileproxy.php index 70db9cca23c..82c9298788c 100644 --- a/lib/fileproxy.php +++ b/lib/fileproxy.php @@ -27,14 +27,17 @@ * Manipulation happens by using 2 kind of proxy operations, pre and post proxies * that manipulate the filesystem call and the result of the call respectively * - * A pre-proxy recieves the filepath as arugments (or 2 filespaths in case of operations like copy or move) and return a boolean - * If a pre-proxy returnes false the file operation will be canceled + * A pre-proxy recieves the filepath as arugments (or 2 filespaths in case of + * operations like copy or move) and return a boolean + * If a pre-proxy returns false the file operation will be canceled * All filesystem operations have a pre-proxy * * A post-proxy recieves 2 arguments, the filepath and the result of the operation. - * The return calue of the post-proxy will be used as the new result of the operation - * The operations that have a post-proxy are - * file_get_contents, is_file, is_dir, file_exists, stat, is_readable, is_writable, fileatime, filemtime, filectime, file_get_contents, getMimeType, hash, fopen, free_space and search + * The return value of the post-proxy will be used as the new result of the operation + * The operations that have a post-proxy are: + * file_get_contents, is_file, is_dir, file_exists, stat, is_readable, + * is_writable, fileatime, filemtime, filectime, file_get_contents, + * getMimeType, hash, fopen, free_space and search */ class OC_FileProxy{ @@ -42,16 +45,7 @@ class OC_FileProxy{ public static $enabled=true; /** - * check if this proxy implments a specific proxy operation - * @param string #proxy name of the proxy operation - * @return bool - */ - public function provides($operation){ - return method_exists($this,$operation); - } - - /** - * fallback function when a proxy operation is not implement + * fallback function when a proxy operation is not implemented * @param string $function the name of the proxy operation * @param mixed * @@ -73,11 +67,10 @@ class OC_FileProxy{ self::$proxies[]=$proxy; } - public static function getProxies($operation,$post){ - $operation=(($post)?'post':'pre').$operation; + public static function getProxies($operation){ $proxies=array(); foreach(self::$proxies as $proxy){ - if($proxy->provides($operation)){ + if(method_exists($proxy,$operation)){ $proxies[]=$proxy; } } @@ -88,8 +81,8 @@ class OC_FileProxy{ if(!self::$enabled){ return true; } - $proxies=self::getProxies($operation,false); $operation='pre'.$operation; + $proxies=self::getProxies($operation); foreach($proxies as $proxy){ if(!is_null($filepath2)){ if($proxy->$operation($filepath,$filepath2)===false){ @@ -108,8 +101,8 @@ class OC_FileProxy{ if(!self::$enabled){ return $result; } - $proxies=self::getProxies($operation,true); $operation='post'.$operation; + $proxies=self::getProxies($operation); foreach($proxies as $proxy){ $result=$proxy->$operation($path,$result); } |