Merge pull request #5544 from owncloud/fixing-3593-2-master

Add FileId header and switch fileid and instance id
remotes/origin/stable6
Thomas Müller 11 years ago
commit c3898061a8
  1. 16
      lib/private/connector/sabre/filesplugin.php
  2. 2
      lib/private/connector/sabre/node.php

@ -40,6 +40,8 @@ class OC_Connector_Sabre_FilesPlugin extends Sabre_DAV_ServerPlugin
$this->server = $server;
$this->server->subscribeEvent('beforeGetProperties', array($this, 'beforeGetProperties'));
$this->server->subscribeEvent('afterCreateFile', array($this, 'sendFileIdHeader'));
$this->server->subscribeEvent('afterWriteContent', array($this, 'sendFileIdHeader'));
}
/**
@ -70,4 +72,18 @@ class OC_Connector_Sabre_FilesPlugin extends Sabre_DAV_ServerPlugin
}
/**
* @param $filePath
* @param Sabre_DAV_INode $node
* @throws Sabre_DAV_Exception_BadRequest
*/
public function sendFileIdHeader($filePath, Sabre_DAV_INode $node = null) {
if ($node instanceof OC_Connector_Sabre_Node) {
$fileId = $node->getFileId();
if (!is_null($fileId)) {
$this->server->httpResponse->setHeader('OC-FileId', $fileId);
}
}
}
}

@ -276,7 +276,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
if (isset($this->fileinfo_cache['fileid'])) {
$instanceId = OC_Util::getInstanceId();
$id = sprintf('%08d', $this->fileinfo_cache['fileid']);
return $instanceId . $id;
return $id . $instanceId;
}
return null;

Loading…
Cancel
Save