aboutsummaryrefslogtreecommitdiffstats
path: root/lib/files/view.php
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2013-01-10 12:09:55 -0500
committerMichael Gapczynski <mtgap@owncloud.com>2013-01-10 12:09:55 -0500
commitaa15fcf22f4c32026eca5ff8ae5e5df244f2c53e (patch)
treee631c3edbf2e5fbbbb38ed89339f76cbee5b1725 /lib/files/view.php
parent106541361c3857ed8e35c6869c91faffb8ae984d (diff)
downloadnextcloud-server-aa15fcf22f4c32026eca5ff8ae5e5df244f2c53e.tar.gz
nextcloud-server-aa15fcf22f4c32026eca5ff8ae5e5df244f2c53e.zip
Scan mount points in root before adding a entry
Diffstat (limited to 'lib/files/view.php')
-rw-r--r--lib/files/view.php46
1 files changed, 28 insertions, 18 deletions
diff --git a/lib/files/view.php b/lib/files/view.php
index 94c89603aed..703cda5123c 100644
--- a/lib/files/view.php
+++ b/lib/files/view.php
@@ -767,27 +767,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::COMPLETE) {
+ $subScanner = $subStorage->getScanner('');
+ $subScanner->scan('', Cache\Scanner::SCAN_SHALLOW);
+ } 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'] = $permissions;
- $files[] = $rootEntry;
}
}
}