Skip to content
Snippets Groups Projects
Commit 5cad2d7c authored by Robin Appelman's avatar Robin Appelman
Browse files

Merge pull request #307 from owncloud/etag-function-overwrite

Allow apps to change the way etags are generated
parents 311b04f6 99aa972a
Branches
No related tags found
No related merge requests found
......@@ -25,6 +25,13 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
const GETETAG_PROPERTYNAME = '{DAV:}getetag';
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
*
......@@ -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,8 +216,13 @@ 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) {
if(self::$ETagFunction) {
$hash = call_user_func(self::$ETagFunction, $path);
return $hash;
}else{
return uniqid('', true);
}
}
/**
* Returns the ETag surrounded by double-quotes for this path.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment