Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
16cfca6a
Commit
16cfca6a
authored
10 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
Better reuse of cache data for getFolderContents
parent
4438c7de
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/private/files/view.php
+11
-6
11 additions, 6 deletions
lib/private/files/view.php
tests/lib/files/view.php
+3
-2
3 additions, 2 deletions
tests/lib/files/view.php
with
14 additions
and
8 deletions
lib/private/files/view.php
+
11
−
6
View file @
16cfca6a
...
@@ -964,15 +964,20 @@ class View {
...
@@ -964,15 +964,20 @@ class View {
$cache
=
$storage
->
getCache
(
$internalPath
);
$cache
=
$storage
->
getCache
(
$internalPath
);
$user
=
\OC_User
::
getUser
();
$user
=
\OC_User
::
getUser
();
if
(
$cache
->
getStatus
(
$internalPath
)
<
Cache\Cache
::
COMPLETE
)
{
$data
=
$cache
->
get
(
$internalPath
);
$watcher
=
$storage
->
getWatcher
(
$internalPath
);
if
(
!
$data
or
$data
[
'size'
]
===
-
1
)
{
if
(
!
$storage
->
file_exists
(
$internalPath
))
{
return
array
();
}
$scanner
=
$storage
->
getScanner
(
$internalPath
);
$scanner
=
$storage
->
getScanner
(
$internalPath
);
$scanner
->
scan
(
$internalPath
,
Cache\Scanner
::
SCAN_SHALLOW
);
$scanner
->
scan
(
$internalPath
,
Cache\Scanner
::
SCAN_SHALLOW
);
}
else
{
$data
=
$cache
->
get
(
$internalPath
);
$watcher
=
$storage
->
getWatcher
(
$internalPath
);
}
else
if
(
$watcher
->
checkUpdate
(
$internalPath
,
$data
))
{
$
w
atche
r
->
checkUpdate
(
$internalPath
);
$
d
at
a
=
$ca
che
->
get
(
$internalPath
);
}
}
$folderId
=
$
cache
->
getId
(
$internalPath
)
;
$folderId
=
$
data
[
'fileid'
]
;
/**
/**
* @var \OC\Files\FileInfo[] $files
* @var \OC\Files\FileInfo[] $files
*/
*/
...
@@ -1034,7 +1039,7 @@ class View {
...
@@ -1034,7 +1039,7 @@ class View {
break
;
break
;
}
}
}
}
$rootEntry
[
'path'
]
=
substr
(
$path
.
'/'
.
$rootEntry
[
'name'
],
strlen
(
$user
)
+
2
);
// full path without /$user/
$rootEntry
[
'path'
]
=
substr
(
Filesystem
::
normalizePath
(
$path
.
'/'
.
$rootEntry
[
'name'
]
)
,
strlen
(
$user
)
+
2
);
// full path without /$user/
// if sharing was disabled for the user we remove the share permissions
// if sharing was disabled for the user we remove the share permissions
if
(
\OCP\Util
::
isSharingDisabledForUser
())
{
if
(
\OCP\Util
::
isSharingDisabledForUser
())
{
...
...
This diff is collapsed.
Click to expand it.
tests/lib/files/view.php
+
3
−
2
View file @
16cfca6a
...
@@ -177,8 +177,9 @@ class View extends \PHPUnit_Framework_TestCase {
...
@@ -177,8 +177,9 @@ class View extends \PHPUnit_Framework_TestCase {
function
testCacheIncompleteFolder
()
{
function
testCacheIncompleteFolder
()
{
$storage1
=
$this
->
getTestStorage
(
false
);
$storage1
=
$this
->
getTestStorage
(
false
);
\OC\Files\Filesystem
::
mount
(
$storage1
,
array
(),
'/'
);
\OC\Files\Filesystem
::
clearMounts
();
$rootView
=
new
\OC\Files\View
(
''
);
\OC\Files\Filesystem
::
mount
(
$storage1
,
array
(),
'/incomplete'
);
$rootView
=
new
\OC\Files\View
(
'/incomplete'
);
$entries
=
$rootView
->
getDirectoryContent
(
'/'
);
$entries
=
$rootView
->
getDirectoryContent
(
'/'
);
$this
->
assertEquals
(
3
,
count
(
$entries
));
$this
->
assertEquals
(
3
,
count
(
$entries
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment