[Pkg-owncloud-commits] [owncloud] 163/394: use \OCP\Share::getItemSharedWith to also finds source of files in a shared folder

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:11:54 UTC 2013


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

taffit pushed a commit to annotated tag v4.5.10
in repository owncloud.

commit 1f4713d320b8344f69e7562fc4f7418afc104451
Author: Björn Schießle <schiessle at owncloud.com>
Date:   Fri Nov 30 14:08:57 2012 +0100

    use \OCP\Share::getItemSharedWith to also finds source of files in a shared folder
---
 apps/files_versions/lib/versions.php |   20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php
index a5836b7..5cf1175 100644
--- a/apps/files_versions/lib/versions.php
+++ b/apps/files_versions/lib/versions.php
@@ -36,16 +36,13 @@ class Storage {
 	const DEFAULTMAXVERSIONS=50;
 
 	private static function getUidAndFilename($filename)
-	{
+	{		
 		if (\OCP\App::isEnabled('files_sharing')
 		    && substr($filename, 0, 7) == '/Shared'
-		    && $source = \OCP\Share::getItemSharedWith('file',
-					substr($filename, 7),
-					\OC_Share_Backend_File::FORMAT_SHARED_STORAGE)) {
-			$filename = $source['path'];
-			$pos = strpos($filename, '/files', 1);
-			$uid = substr($filename, 1, $pos - 1);
-			$filename = substr($filename, $pos + 6);
+		    && $source = \OC_Files_Sharing_Util::getSourcePath(substr($filename, 8))) {
+			$pos = strpos($source, '/files', 1);
+			$uid = substr($source, 1, $pos - 1);
+			$filename = substr($source, $pos + 6);
 		} else {
 			$uid = \OCP\User::getUser();
 		}
@@ -60,7 +57,6 @@ class Storage {
 			list($uid, $filename) = self::getUidAndFilename($filename);
 			$files_view = new \OC_FilesystemView('/'. $uid .'/files');
 			$users_view = new \OC_FilesystemView('/'.$uid);
-
 			//check if source file already exist as version to avoid recursions.
 			// todo does this check work?
 			if ($users_view->file_exists($filename)) {
@@ -91,12 +87,12 @@ class Storage {
 				return false;
 			}
 
-
+			$versions_fileview = new \OC_FilesystemView('/'.$uid.'/files_versions');
+			$versionsFolderName=\OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath('');
+			
 			// check mininterval if the file is being modified by the owner (all shared files should be versioned despite mininterval)
 			if ($uid == \OCP\User::getUser()) {
-				$versions_fileview = new \OC_FilesystemView('/'.$uid.'/files_versions');
 				$versionsName=\OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath($filename);
-				$versionsFolderName=\OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath('');
 				$matches=glob($versionsName.'.v*');
 				sort($matches);
 				$parts=explode('.v',end($matches));

-- 
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