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
cdc72ddd
Commit
cdc72ddd
authored
11 years ago
by
Morris Jobke
Browse files
Options
Downloads
Plain Diff
Merge pull request #5928 from owncloud/quota-totalsizeoffiles
Root size for home storage is now size of "files" subdir
parents
b51d4058
3e2fd994
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
+13
-0
13 additions, 0 deletions
lib/private/files/cache/homecache.php
tests/lib/files/cache/homecache.php
+26
-0
26 additions, 0 deletions
tests/lib/files/cache/homecache.php
with
39 additions
and
0 deletions
lib/private/files/cache/homecache.php
+
13
−
0
View file @
cdc72ddd
...
...
@@ -37,4 +37,17 @@ class HomeCache extends Cache {
}
return
$totalSize
;
}
public
function
get
(
$path
)
{
$data
=
parent
::
get
(
$path
);
if
(
$path
===
''
or
$path
===
'/'
)
{
// only the size of the "files" dir counts
$filesData
=
parent
::
get
(
'files'
);
if
(
isset
(
$filesData
[
'size'
]))
{
$data
[
'size'
]
=
$filesData
[
'size'
];
}
}
return
$data
;
}
}
This diff is collapsed.
Click to expand it.
tests/lib/files/cache/homecache.php
+
26
−
0
View file @
cdc72ddd
...
...
@@ -92,4 +92,30 @@ class HomeCache extends \PHPUnit_Framework_TestCase {
$this
->
assertFalse
(
$this
->
cache
->
inCache
(
$dir1
));
$this
->
assertFalse
(
$this
->
cache
->
inCache
(
$dir2
));
}
public
function
testRootFolderSizeIsFilesSize
()
{
$dir1
=
'files'
;
$afile
=
'test.txt'
;
$fileData
=
array
();
$fileData
[
''
]
=
array
(
'size'
=>
1500
,
'mtime'
=>
20
,
'mimetype'
=>
'httpd/unix-directory'
);
$fileData
[
$dir1
]
=
array
(
'size'
=>
1000
,
'mtime'
=>
20
,
'mimetype'
=>
'httpd/unix-directory'
);
$fileData
[
$afile
]
=
array
(
'size'
=>
500
,
'mtime'
=>
20
);
$this
->
cache
->
put
(
''
,
$fileData
[
''
]);
$this
->
cache
->
put
(
$dir1
,
$fileData
[
$dir1
]);
$this
->
assertTrue
(
$this
->
cache
->
inCache
(
$dir1
));
// check that root size ignored the unknown sizes
$data
=
$this
->
cache
->
get
(
'files'
);
$this
->
assertEquals
(
1000
,
$data
[
'size'
]);
$data
=
$this
->
cache
->
get
(
''
);
$this
->
assertEquals
(
1000
,
$data
[
'size'
]);
// clean up
$this
->
cache
->
remove
(
''
);
$this
->
cache
->
remove
(
$dir1
);
$this
->
assertFalse
(
$this
->
cache
->
inCache
(
$dir1
));
}
}
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