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
b489d6b0
Commit
b489d6b0
authored
11 years ago
by
Björn Schießle
Browse files
Options
Downloads
Patches
Plain Diff
fix infinite loop if folder and subfolder has the same name
parent
eaed786e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/files_encryption/lib/util.php
+13
-39
13 additions, 39 deletions
apps/files_encryption/lib/util.php
with
13 additions
and
39 deletions
apps/files_encryption/lib/util.php
+
13
−
39
View file @
b489d6b0
...
...
@@ -2,9 +2,10 @@
/**
* ownCloud
*
* @author Sam Tuke, Frank Karlitschek
* @author Sam Tuke, Frank Karlitschek
, Bjoern Schiessle
* @copyright 2012 Sam Tuke <samtuke@owncloud.com>,
* Frank Karlitschek <frank@owncloud.org>
* Frank Karlitschek <frank@owncloud.org>,
* Bjoern Schiessle <schiessle@owncloud.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
...
...
@@ -1360,59 +1361,32 @@ class Util {
}
}
/**
* @brief go recursively through a dir and collect all files and sub files.
* @param string $dir relative to the users files folder
* @return array with list of files relative to the users files folder
*/
public
function
getAllFiles
(
$dir
)
{
$result
=
array
();
$dirList
=
array
(
$dir
);
$content
=
$this
->
view
->
getDirectoryContent
(
\OC\Files\Filesystem
::
normalizePath
(
$this
->
userFilesDir
.
'/'
.
$dir
));
// handling for re shared folders
$pathSplit
=
explode
(
'/'
,
$dir
);
foreach
(
$content
as
$c
)
{
$sharedPart
=
$pathSplit
[
sizeof
(
$pathSplit
)
-
1
];
$targetPathSplit
=
array_reverse
(
explode
(
'/'
,
$c
[
'path'
]));
$path
=
''
;
// rebuild path
foreach
(
$targetPathSplit
as
$pathPart
)
{
if
(
$pathPart
!==
$sharedPart
)
{
$path
=
'/'
.
$pathPart
.
$path
;
while
(
$dirList
)
{
$dir
=
array_pop
(
$dirList
);
$content
=
$this
->
view
->
getDirectoryContent
(
\OC\Files\Filesystem
::
normalizePath
(
$this
->
userFilesDir
.
'/'
.
$dir
));
foreach
(
$content
as
$c
)
{
$usersPath
=
isset
(
$c
[
'usersPath'
])
?
$c
[
'usersPath'
]
:
$c
[
'path'
];
if
(
$c
[
'type'
]
===
'dir'
)
{
$dirList
[]
=
substr
(
$usersPath
,
strlen
(
"files"
));
}
else
{
break
;
$result
[]
=
substr
(
$usersPath
,
strlen
(
"files"
));
}
}
$path
=
$dir
.
$path
;
if
(
$c
[
'type'
]
===
'dir'
)
{
$result
=
array_merge
(
$result
,
$this
->
getAllFiles
(
$path
));
}
else
{
$result
[]
=
$path
;
}
}
return
$result
;
}
/**
...
...
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