Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorBjörn Schießle <bjoern@schiessle.org>2012-11-26 20:47:45 +0400
committerBjörn Schießle <bjoern@schiessle.org>2012-11-26 20:47:45 +0400
commitd6bc7757abd2aa21cc8192ec6292f91177438690 (patch)
tree5e88c862a7bf606e7c546183fd71a28ea25889bf /apps
parent94db6c64a9d79e1cade6d0aae1602852be39b41c (diff)
parent1b4f24915742f9aaaf03041a972c89be5973c9f2 (diff)
Merge pull request #581 from schiesbn/add_user_to_fscache
make sure to add the right user as owner of a file to the file cache table
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/sharedstorage.php21
1 files changed, 15 insertions, 6 deletions
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index d2489f9cbad..de41750f1da 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');
+ }
}