[Pkg-owncloud-commits] [owncloud] 143/394: make sure to add the right user as owner of a file to the file cache table

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:11:49 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 1b4f24915742f9aaaf03041a972c89be5973c9f2
Author: Björn Schießle <schiessle at owncloud.com>
Date:   Mon Nov 26 15:09:02 2012 +0100

    make sure to add the right user as owner of a file to the file cache table
---
 apps/files_sharing/lib/sharedstorage.php |   21 +++++++++++++++------
 lib/filecache.php                        |    1 -
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index d2489f9..de41750 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -112,12 +112,9 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
 		if ($path == '' || $path == '/' || !$this->isCreatable(dirname($path))) {
 			return false;
 		} else if ($source = $this->getSourcePath($path)) {
-			$parts = explode('/', $source, 4);
-			$user =  $parts[1];
-			$intPath = '/'.$parts[3];
 			$storage = OC_Filesystem::getStorage($source);
 			if( ($storage->mkdir($this->getInternalPath($source))) ) {
-				OC_FileCache::put($intPath ,array('user'=>$user), '/'.$user.'/files');
+				$this->updateFSCache($path);
 				return true;
 			}
 		}
@@ -308,7 +305,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
 			$intPath = '/'.$parts[3];
 			$storage = OC_Filesystem::getStorage($source);
 			if( ( $result = $storage->file_put_contents($this->getInternalPath($source), $data) ) ) {
-				OC_FileCache::put($intPath ,array('user'=>$user), '/'.$user.'/files');
+				$this->updateFSCache($path);
 				return $result;
 			}	
 		}
@@ -412,7 +409,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
 			$intPath = '/'.$parts[3];
 
 			if ( $write && $storage->touch($this->getInternalPath($source)) ) {
-				OC_FileCache::put($intPath ,array('user'=>$user), '/'.$user.'/files');
+				$this->updateFSCache($path);
 			}
 			return $storage->fopen($this->getInternalPath($source), $mode);
 		}
@@ -467,4 +464,16 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
 		//TODO
 		return false;
 	}
+	
+	private function updateFSCache($path) {
+		$source = $this->getSourcePath($path);
+		$parts = explode('/', $source, 4);
+		$user =  $parts[1];
+		$intPath = '/'.$parts[3];
+		
+		$mtime = $this->filemtime($path);
+		$size = $this->filesize($path);
+		$mime = $this->getMimeType($path);
+		OC_FileCache::put($intPath ,array('user'=>$user, 'size'=>$size, 'mtime'=>$mtime, 'mimetype'=>$mime, 'writable'=>true),'/'.$user.'/files');
+	}
 }
diff --git a/lib/filecache.php b/lib/filecache.php
index e7b5374..6a1b1f3 100644
--- a/lib/filecache.php
+++ b/lib/filecache.php
@@ -537,7 +537,6 @@ class OC_FileCache{
 			$fullPath = OC_Filesystem::normalizePath($root.'/'.$path);
 			$sharedPos =  strpos($fullPath, '/Shared/');
 			if ( $sharedPos !== false && ($source = OC_Files_Sharing_Util::getSourcePath(substr($fullPath, $sharedPos+8))) ) {
-				$source = OC_Files_Sharing_Util::getSourcePath(str_replace('/Shared/', '', $path));
 				$parts = explode('/', $source, 4);
 				$root =  '/'.$parts[1].'/files';
 				$path = '/'.$parts[3];

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