diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2013-01-11 21:00:02 -0500 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2013-01-11 21:00:02 -0500 |
commit | 6f049d08893975af6725f3c3040d5499bb8cb871 (patch) | |
tree | 38a62204ea98b8bb784408622cbaa5defb4b4d74 /lib/files/view.php | |
parent | 9e2f3a53244e353cb75f9927e1c69ef40f589db7 (diff) | |
parent | 36cac7f924ad07738a3cb72fee06f21d07baad42 (diff) | |
download | nextcloud-server-6f049d08893975af6725f3c3040d5499bb8cb871.tar.gz nextcloud-server-6f049d08893975af6725f3c3040d5499bb8cb871.zip |
Merge branch 'filesystem' into filesystem-etags
Diffstat (limited to 'lib/files/view.php')
-rw-r--r-- | lib/files/view.php | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/lib/files/view.php b/lib/files/view.php index 7cc59149764..06027910123 100644 --- a/lib/files/view.php +++ b/lib/files/view.php @@ -765,27 +765,37 @@ class View { $subStorage = Filesystem::getStorage($mountPoint); if ($subStorage) { $subCache = $subStorage->getCache(''); - $rootEntry = $subCache->get(''); - $relativePath = trim(substr($mountPoint, $dirLength), '/'); - if ($pos = strpos($relativePath, '/')) { //mountpoint inside subfolder add size to the correct folder - $entryName = substr($relativePath, 0, $pos); - foreach ($files as &$entry) { - if ($entry['name'] === $entryName) { - $entry['size'] += $rootEntry['size']; + if ($subCache->getStatus('') === Cache\Cache::NOT_FOUND) { + $subScanner = $subStorage->getScanner(''); + $subScanner->scanFile(''); + } else { + $subWatcher = $subStorage->getWatcher(''); + $subWatcher->checkUpdate(''); + } + + $rootEntry = $subCache->get(''); + if ($rootEntry) { + $relativePath = trim(substr($mountPoint, $dirLength), '/'); + if ($pos = strpos($relativePath, '/')) { //mountpoint inside subfolder add size to the correct folder + $entryName = substr($relativePath, 0, $pos); + foreach ($files as &$entry) { + if ($entry['name'] === $entryName) { + $entry['size'] += $rootEntry['size']; + } } + } else { //mountpoint in this folder, add an entry for it + $rootEntry['name'] = $relativePath; + $rootEntry['type'] = $rootEntry['mimetype'] === 'httpd/unix-directory' ? 'dir' : 'file'; + $subPermissionsCache = $subStorage->getPermissionsCache(''); + $permissions = $subPermissionsCache->get($rootEntry['fileid'], $user); + if ($permissions === -1) { + $permissions = $subStorage->getPermissions($rootEntry['path']); + $subPermissionsCache->set($rootEntry['fileid'], $user, $permissions); + } + $rootEntry['permissions'] = $permissions; + $files[] = $rootEntry; } - } else { //mountpoint in this folder, add an entry for it - $rootEntry['name'] = $relativePath; - $rootEntry['type'] = $rootEntry['mimetype'] === 'httpd/unix-directory' ? 'dir' : 'file'; - $subPermissionsCache = $subStorage->getPermissionsCache(''); - $permissions = $subPermissionsCache->get($rootEntry['fileid'], $user); - if ($permissions === -1) { - $permissions = $subStorage->getPermissions($rootEntry['path']); - $subPermissionsCache->set($rootEntry['fileid'], $user, $permissions); - } - $rootEntry['permissions'] = $subPermissionsCache; - $files[] = $rootEntry; } } } |