[Pkg-owncloud-commits] [owncloud] 33/61: define type in pre hook

David Prévot taffit at moszumanska.debian.org
Thu Jul 31 03:51:46 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit d677040bdc8b77f0bf881bb2e053694691aca192
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date:   Fri Jul 18 14:34:04 2014 +0200

    define type in pre hook
---
 apps/files_encryption/hooks/hooks.php | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index c40fc43..61ba0c5 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -419,10 +419,14 @@ class Hooks {
 		$mp1 = $view->getMountPoint('/' . $user . '/files/' . $params['oldpath']);
 		$mp2 = $view->getMountPoint('/' . $user . '/files/' . $params['newpath']);
 
+		$type = $view->is_dir('/' . $user . '/files/' . $params['oldpath']) ? 'folder' : 'file';
+
 		if ($mp1 === $mp2) {
 			self::$renamedFiles[$params['oldpath']] = array(
 				'uid' => $ownerOld,
-				'path' => $pathOld);
+				'path' => $pathOld,
+				'type' => $type,
+				);
 		}
 	}
 
@@ -451,6 +455,7 @@ class Hooks {
 				isset(self::$renamedFiles[$params['oldpath']]['path'])) {
 			$ownerOld = self::$renamedFiles[$params['oldpath']]['uid'];
 			$pathOld = self::$renamedFiles[$params['oldpath']]['path'];
+			$type =  self::$renamedFiles[$params['oldpath']]['type'];
 			unset(self::$renamedFiles[$params['oldpath']]);
 		} else {
 			\OCP\Util::writeLog('Encryption library', "can't get path and owner from the file before it was renamed", \OCP\Util::DEBUG);
@@ -485,8 +490,7 @@ class Hooks {
 		}
 
 		// handle share keys
-		if (!$view->is_dir($oldKeyfilePath)) {
-			$type = 'file';
+		if ($type === 'file') {
 			$oldKeyfilePath .= '.key';
 			$newKeyfilePath .= '.key';
 
@@ -498,7 +502,6 @@ class Hooks {
 			}
 
 		} else {
-			$type = "folder";
 			// handle share-keys folders
 			$view->rename($oldShareKeyPath, $newShareKeyPath);
 		}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list