Skip to content

Commit

Permalink
Merge pull request #8 from owncloud/transfer-ownership-masterkey-task
Browse files Browse the repository at this point in the history
Change required for move operation
  • Loading branch information
Vincent Petry authored Jul 31, 2017
2 parents cdadf2e + fd1e1fa commit 4fdfce0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/Crypto/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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'
Expand Down

0 comments on commit 4fdfce0

Please sign in to comment.