From fd1e1fae0355d2444c1bfe1ff2d5018990c8ada5 Mon Sep 17 00:00:00 2001 From: Sujith H Date: Thu, 27 Jul 2017 17:37:36 +0530 Subject: [PATCH] Change required for move operation This change is required so that move operation executed by transer-ownership command. Signed-off-by: Sujith H --- lib/Crypto/Encryption.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/Crypto/Encryption.php b/lib/Crypto/Encryption.php index 59ca46b1..1bb6dbe7 100644 --- a/lib/Crypto/Encryption.php +++ b/lib/Crypto/Encryption.php @@ -164,12 +164,14 @@ public function getDisplayName() { * @param string $mode php stream open mode * @param array $header contains the header data read from the file * @param array $accessList who has access to the file contains the key 'users' and 'public' + * @param string|null $sourceFileOfRename Either false or the name of source file to be renamed. + * This is helpful for revision increment during move operation between storage. * * @return array $header contain data as key-value pairs which should be * written to the header, in case of a write operation * or if no additional data is needed return a empty array */ - public function begin($path, $user, $mode, array $header, array $accessList) { + public function begin($path, $user, $mode, array $header, array $accessList, $sourceFileOfRename = null) { $this->path = $this->getPathToRealFile($path); $this->accessList = $accessList; $this->user = $user; @@ -189,7 +191,12 @@ public function begin($path, $user, $mode, array $header, array $accessList) { // always use the version from the original file, also part files // need to have a correct version number if they get moved over to the // final location - $this->version = (int)$this->keyManager->getVersion($this->stripPartFileExtension($path), new View()); + if ($sourceFileOfRename !== null) { + $this->version = $this->keyManager->getVersion($sourceFileOfRename, new View()); + } else { + $this->version = (int)$this->keyManager->getVersion($this->stripPartFileExtension($path), new View()); + } + if ( $mode === 'w'