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
41e2d64c
Commit
41e2d64c
authored
11 years ago
by
Michael Gapczynski
Browse files
Options
Downloads
Patches
Plain Diff
Add support for copying/moving folders between storages, move isIgnoredDir() to Filesystem
parent
0f314c14
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/files/cache/scanner.php
+1
-13
1 addition, 13 deletions
lib/files/cache/scanner.php
lib/files/filesystem.php
+13
-0
13 additions, 0 deletions
lib/files/filesystem.php
lib/files/view.php
+24
-8
24 additions, 8 deletions
lib/files/view.php
with
38 additions
and
21 deletions
lib/files/cache/scanner.php
+
1
−
13
View file @
41e2d64c
...
@@ -115,7 +115,7 @@ class Scanner {
...
@@ -115,7 +115,7 @@ class Scanner {
\OC_DB
::
beginTransaction
();
\OC_DB
::
beginTransaction
();
while
(
$file
=
readdir
(
$dh
))
{
while
(
$file
=
readdir
(
$dh
))
{
$child
=
(
$path
)
?
$path
.
'/'
.
$file
:
$file
;
$child
=
(
$path
)
?
$path
.
'/'
.
$file
:
$file
;
if
(
!
$this
->
isIgnoredDir
(
$file
))
{
if
(
!
\OC\Files\Filesystem
::
isIgnoredDir
(
$file
))
{
$data
=
$this
->
scanFile
(
$child
,
$recursive
===
self
::
SCAN_SHALLOW
);
$data
=
$this
->
scanFile
(
$child
,
$recursive
===
self
::
SCAN_SHALLOW
);
if
(
$data
)
{
if
(
$data
)
{
if
(
$data
[
'size'
]
===
-
1
)
{
if
(
$data
[
'size'
]
===
-
1
)
{
...
@@ -149,18 +149,6 @@ class Scanner {
...
@@ -149,18 +149,6 @@ class Scanner {
return
$size
;
return
$size
;
}
}
/**
* @brief check if the directory should be ignored when scanning
* NOTE: the special directories . and .. would cause never ending recursion
* @param String $dir
* @return boolean
*/
private
function
isIgnoredDir
(
$dir
)
{
if
(
$dir
===
'.'
||
$dir
===
'..'
)
{
return
true
;
}
return
false
;
}
/**
/**
* @brief check if the file should be ignored when scanning
* @brief check if the file should be ignored when scanning
* NOTE: files with a '.part' extension are ignored as well!
* NOTE: files with a '.part' extension are ignored as well!
...
...
This diff is collapsed.
Click to expand it.
lib/files/filesystem.php
+
13
−
0
View file @
41e2d64c
...
@@ -453,6 +453,19 @@ class Filesystem {
...
@@ -453,6 +453,19 @@ class Filesystem {
return
(
in_array
(
$filename
,
$blacklist
));
return
(
in_array
(
$filename
,
$blacklist
));
}
}
/**
* @brief check if the directory should be ignored when scanning
* NOTE: the special directories . and .. would cause never ending recursion
* @param String $dir
* @return boolean
*/
static
public
function
isIgnoredDir
(
$dir
)
{
if
(
$dir
===
'.'
||
$dir
===
'..'
)
{
return
true
;
}
return
false
;
}
/**
/**
* following functions are equivalent to their php builtin equivalents for arguments/return values.
* following functions are equivalent to their php builtin equivalents for arguments/return values.
*/
*/
...
...
This diff is collapsed.
Click to expand it.
lib/files/view.php
+
24
−
8
View file @
41e2d64c
...
@@ -372,11 +372,18 @@ class View {
...
@@ -372,11 +372,18 @@ class View {
$result
=
false
;
$result
=
false
;
}
}
}
else
{
}
else
{
$source
=
$this
->
fopen
(
$path1
.
$postFix1
,
'r'
);
if
(
$this
->
is_dir
(
$path1
))
{
$target
=
$this
->
fopen
(
$path2
.
$postFix2
,
'w'
);
$result
=
$this
->
copy
(
$path1
,
$path2
);
list
(
$count
,
$result
)
=
\OC_Helper
::
streamCopy
(
$source
,
$target
);
if
(
$result
===
true
)
{
list
(
$storage1
,
$internalPath1
)
=
Filesystem
::
resolvePath
(
$absolutePath1
.
$postFix1
);
$result
=
$this
->
deleteAll
(
$path1
);
$storage1
->
unlink
(
$internalPath1
);
}
}
else
{
$source
=
$this
->
fopen
(
$path1
.
$postFix1
,
'r'
);
$target
=
$this
->
fopen
(
$path2
.
$postFix2
,
'w'
);
list
(
$count
,
$result
)
=
\OC_Helper
::
streamCopy
(
$source
,
$target
);
list
(
$storage1
,
$internalPath1
)
=
Filesystem
::
resolvePath
(
$absolutePath1
.
$postFix1
);
$storage1
->
unlink
(
$internalPath1
);
}
}
}
if
(
$this
->
fakeRoot
==
Filesystem
::
getRoot
()
&&
!
Cache\Scanner
::
isPartialFile
(
$path1
))
{
if
(
$this
->
fakeRoot
==
Filesystem
::
getRoot
()
&&
!
Cache\Scanner
::
isPartialFile
(
$path1
))
{
\OC_Hook
::
emit
(
\OC_Hook
::
emit
(
...
@@ -459,9 +466,18 @@ class View {
...
@@ -459,9 +466,18 @@ class View {
$result
=
false
;
$result
=
false
;
}
}
}
else
{
}
else
{
$source
=
$this
->
fopen
(
$path1
.
$postFix1
,
'r'
);
if
(
$this
->
is_dir
(
$path1
)
&&
(
$dh
=
$this
->
opendir
(
$path1
)))
{
$target
=
$this
->
fopen
(
$path2
.
$postFix2
,
'w'
);
$this
->
mkdir
(
$path2
);
list
(
$count
,
$result
)
=
\OC_Helper
::
streamCopy
(
$source
,
$target
);
while
(
$file
=
readdir
(
$dh
))
{
if
(
!
Filesystem
::
isIgnoredDir
(
$file
))
{
$result
=
$this
->
copy
(
$path1
.
'/'
.
$file
,
$path2
.
'/'
.
$file
);
}
}
}
else
{
$source
=
$this
->
fopen
(
$path1
.
$postFix1
,
'r'
);
$target
=
$this
->
fopen
(
$path2
.
$postFix2
,
'w'
);
list
(
$count
,
$result
)
=
\OC_Helper
::
streamCopy
(
$source
,
$target
);
}
}
}
if
(
$this
->
fakeRoot
==
Filesystem
::
getRoot
())
{
if
(
$this
->
fakeRoot
==
Filesystem
::
getRoot
())
{
\OC_Hook
::
emit
(
\OC_Hook
::
emit
(
...
...
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