Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
5be4af9f
Commit
5be4af9f
authored
11 years ago
by
Vincent Petry
Browse files
Options
Downloads
Patches
Plain Diff
Now also preventing to override "files" dir size with -1
Fixes #6526
parent
b6474506
Branches
Branches containing commit
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/cache/homecache.php
+1
-1
1 addition, 1 deletion
lib/private/files/cache/homecache.php
tests/lib/files/cache/homecache.php
+12
-6
12 additions, 6 deletions
tests/lib/files/cache/homecache.php
with
13 additions
and
7 deletions
lib/private/files/cache/homecache.php
+
1
−
1
View file @
5be4af9f
...
...
@@ -16,7 +16,7 @@ class HomeCache extends Cache {
* @return int
*/
public
function
calculateFolderSize
(
$path
)
{
if
(
$path
!==
'/'
and
$path
!==
''
)
{
if
(
$path
!==
'/'
and
$path
!==
''
and
$path
!==
'files'
)
{
return
parent
::
calculateFolderSize
(
$path
);
}
...
...
This diff is collapsed.
Click to expand it.
tests/lib/files/cache/homecache.php
+
12
−
6
View file @
5be4af9f
...
...
@@ -62,33 +62,39 @@ class HomeCache extends \PHPUnit_Framework_TestCase {
}
/**
* Tests that the root folder size calculation ignores the subdirs
that have an unknown
* size. This makes sure that quota calculation still
works as it's based on the root
* folder size.
* Tests that the root
and files
folder size calculation ignores the subdirs
*
that have an unknown
size. This makes sure that quota calculation still
*
works as it's based on the "files"
folder size.
*/
public
function
testRootFolderSizeIgnoresUnknownUpdate
()
{
$dir1
=
'knownsize'
;
$dir2
=
'unknownsize'
;
$dir1
=
'
files/
knownsize'
;
$dir2
=
'
files/
unknownsize'
;
$fileData
=
array
();
$fileData
[
''
]
=
array
(
'size'
=>
-
1
,
'mtime'
=>
20
,
'mimetype'
=>
'httpd/unix-directory'
);
$fileData
[
'files'
]
=
array
(
'size'
=>
-
1
,
'mtime'
=>
20
,
'mimetype'
=>
'httpd/unix-directory'
);
$fileData
[
$dir1
]
=
array
(
'size'
=>
1000
,
'mtime'
=>
20
,
'mimetype'
=>
'httpd/unix-directory'
);
$fileData
[
$dir2
]
=
array
(
'size'
=>
-
1
,
'mtime'
=>
25
,
'mimetype'
=>
'httpd/unix-directory'
);
$this
->
cache
->
put
(
''
,
$fileData
[
''
]);
$this
->
cache
->
put
(
'files'
,
$fileData
[
'files'
]);
$this
->
cache
->
put
(
$dir1
,
$fileData
[
$dir1
]);
$this
->
cache
->
put
(
$dir2
,
$fileData
[
$dir2
]);
$this
->
assertTrue
(
$this
->
cache
->
inCache
(
'files'
));
$this
->
assertTrue
(
$this
->
cache
->
inCache
(
$dir1
));
$this
->
assertTrue
(
$this
->
cache
->
inCache
(
$dir2
));
// check that root size ignored the unknown sizes
// check that files and root size ignored the unknown sizes
$this
->
assertEquals
(
1000
,
$this
->
cache
->
calculateFolderSize
(
'files'
));
$this
->
assertEquals
(
1000
,
$this
->
cache
->
calculateFolderSize
(
''
));
// clean up
$this
->
cache
->
remove
(
''
);
$this
->
cache
->
remove
(
'files'
);
$this
->
cache
->
remove
(
$dir1
);
$this
->
cache
->
remove
(
$dir2
);
$this
->
assertFalse
(
$this
->
cache
->
inCache
(
'files'
));
$this
->
assertFalse
(
$this
->
cache
->
inCache
(
$dir1
));
$this
->
assertFalse
(
$this
->
cache
->
inCache
(
$dir2
));
}
...
...
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