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
8a10c44e
Commit
8a10c44e
authored
10 years ago
by
Vincent Petry
Browse files
Options
Downloads
Plain Diff
Merge pull request #8015 from owncloud/storageinfo-reuse
Allow reusing FileInfo for getStorageInfo
parents
0805f678
da5541ac
No related branches found
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
apps/files/index.php
+2
-2
2 additions, 2 deletions
apps/files/index.php
lib/private/helper.php
+6
-3
6 additions, 3 deletions
lib/private/helper.php
with
8 additions
and
5 deletions
apps/files/index.php
+
2
−
2
View file @
8a10c44e
...
...
@@ -39,7 +39,7 @@ OCP\App::setActiveNavigationEntry('files_index');
// Load the files
$dir
=
isset
(
$_GET
[
'dir'
])
?
stripslashes
(
$_GET
[
'dir'
])
:
''
;
$dir
=
\OC\Files\Filesystem
::
normalizePath
(
$dir
);
$dirInfo
=
\OC\Files\Filesystem
::
getFileInfo
(
$dir
);
$dirInfo
=
\OC\Files\Filesystem
::
getFileInfo
(
$dir
,
false
);
// Redirect if directory does not exist
if
(
!
$dirInfo
||
!
$dirInfo
->
getType
()
===
'dir'
)
{
header
(
'Location: '
.
OCP\Util
::
getScriptName
()
.
''
);
...
...
@@ -70,7 +70,7 @@ $config = \OC::$server->getConfig();
$permissions
=
$dirInfo
->
getPermissions
();
// information about storage capacities
$storageInfo
=
OC_Helper
::
getStorageInfo
(
$dir
);
$storageInfo
=
OC_Helper
::
getStorageInfo
(
$dir
,
$dirInfo
);
$freeSpace
=
$storageInfo
[
'free'
];
$uploadLimit
=
OCP\Util
::
uploadLimit
();
$maxUploadFilesize
=
OCP\Util
::
maxUploadFilesize
(
$dir
,
$freeSpace
);
...
...
This diff is collapsed.
Click to expand it.
lib/private/helper.php
+
6
−
3
View file @
8a10c44e
...
...
@@ -875,12 +875,15 @@ class OC_Helper {
* Calculate the disc space for the given path
*
* @param string $path
* @param \OCP\Files\FileInfo $rootInfo (optional)
* @return array
*/
public
static
function
getStorageInfo
(
$path
)
{
public
static
function
getStorageInfo
(
$path
,
$rootInfo
=
null
)
{
// return storage info without adding mount points
$rootInfo
=
\OC\Files\Filesystem
::
getFileInfo
(
$path
,
false
);
$used
=
$rootInfo
[
'size'
];
if
(
is_null
(
$rootInfo
))
{
$rootInfo
=
\OC\Files\Filesystem
::
getFileInfo
(
$path
,
false
);
}
$used
=
$rootInfo
->
getSize
();
if
(
$used
<
0
)
{
$used
=
0
;
}
...
...
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