diff options
author | icewind1991 <icewind1991@gmail.com> | 2012-11-07 08:02:59 -0800 |
---|---|---|
committer | icewind1991 <icewind1991@gmail.com> | 2012-11-07 08:02:59 -0800 |
commit | 5cad2d7ccc3d2b4ccd9e1b090e28787f1c28b6ca (patch) | |
tree | 21018d10ed45eb7bf31deff6753902297a5ae9bb | |
parent | 311b04f6098674897e78ff0223cacbbfe381d044 (diff) | |
parent | 99aa972a404a76837152109541f0fdf71f8b376d (diff) | |
download | nextcloud-server-5cad2d7ccc3d2b4ccd9e1b090e28787f1c28b6ca.tar.gz nextcloud-server-5cad2d7ccc3d2b4ccd9e1b090e28787f1c28b6ca.zip |
Merge pull request #307 from owncloud/etag-function-overwrite
Allow apps to change the way etags are generated
-rw-r--r-- | lib/connector/sabre/node.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php index 5fc106b85ed..9fffa108d2a 100644 --- a/lib/connector/sabre/node.php +++ b/lib/connector/sabre/node.php @@ -26,6 +26,13 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr const LASTMODIFIED_PROPERTYNAME = '{DAV:}lastmodified'; /** + * Allow configuring the method used to generate Etags + * + * @var array(class_name, function_name) + */ + public static $ETagFunction = null; + + /** * The path to the current node * * @var string @@ -178,7 +185,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr * If the array is empty, all properties should be returned * * @param array $properties - * @return void + * @return array */ public function getProperties($properties) { if (is_null($this->property_cache)) { @@ -209,7 +216,12 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr * @return string|null Returns null if the ETag can not effectively be determined */ static protected function createETag($path) { - return uniqid('', true); + if(self::$ETagFunction) { + $hash = call_user_func(self::$ETagFunction, $path); + return $hash; + }else{ + return uniqid('', true); + } } /** |