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
5bfff6c5
Commit
5bfff6c5
authored
12 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
use absolute paths when resolving mount points
parent
3437071c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
lib/files.php
+0
-10
0 additions, 10 deletions
lib/files.php
lib/files/cache/permissions.php
+3
-0
3 additions, 0 deletions
lib/files/cache/permissions.php
lib/files/view.php
+26
-9
26 additions, 9 deletions
lib/files/view.php
lib/public/share.php
+2
-2
2 additions, 2 deletions
lib/public/share.php
with
31 additions
and
21 deletions
lib/files.php
+
0
−
10
View file @
5bfff6c5
...
...
@@ -249,13 +249,3 @@ class OC_Files {
return
false
;
}
}
function
fileCmp
(
$a
,
$b
)
{
if
(
$a
[
'type'
]
==
'dir'
and
$b
[
'type'
]
!=
'dir'
)
{
return
-
1
;
}
elseif
(
$a
[
'type'
]
!=
'dir'
and
$b
[
'type'
]
==
'dir'
)
{
return
1
;
}
else
{
return
strnatcasecmp
(
$a
[
'name'
],
$b
[
'name'
]);
}
}
This diff is collapsed.
Click to expand it.
lib/files/cache/permissions.php
+
3
−
0
View file @
5bfff6c5
...
...
@@ -50,6 +50,9 @@ class Permissions {
* @return int[]
*/
static
public
function
getMultiple
(
$fileIds
,
$user
)
{
if
(
count
(
$fileIds
)
===
0
)
{
return
array
();
}
$params
=
$fileIds
;
$params
[]
=
$user
;
$inPart
=
implode
(
', '
,
array_fill
(
0
,
count
(
$fileIds
),
'?'
));
...
...
This diff is collapsed.
Click to expand it.
lib/files/view.php
+
26
−
9
View file @
5bfff6c5
...
...
@@ -110,6 +110,7 @@ class View {
*/
public
function
getLocalFile
(
$path
)
{
$parent
=
substr
(
$path
,
0
,
strrpos
(
$path
,
'/'
));
$path
=
$this
->
getAbsolutePath
(
$path
);
list
(
$storage
,
$internalPath
)
=
Filesystem
::
resolvePath
(
$path
);
if
(
Filesystem
::
isValidPath
(
$parent
)
and
$storage
)
{
return
$storage
->
getLocalFile
(
$internalPath
);
...
...
@@ -124,6 +125,7 @@ class View {
*/
public
function
getLocalFolder
(
$path
)
{
$parent
=
substr
(
$path
,
0
,
strrpos
(
$path
,
'/'
));
$path
=
$this
->
getAbsolutePath
(
$path
);
list
(
$storage
,
$internalPath
)
=
Filesystem
::
resolvePath
(
$path
);
if
(
Filesystem
::
isValidPath
(
$parent
)
and
$storage
)
{
return
$storage
->
getLocalFolder
(
$internalPath
);
...
...
@@ -334,8 +336,8 @@ class View {
$mp1
=
$this
->
getMountPoint
(
$path1
.
$postFix1
);
$mp2
=
$this
->
getMountPoint
(
$path2
.
$postFix2
);
if
(
$mp1
==
$mp2
)
{
list
(
$storage
,
$internalPath1
)
=
Filesystem
::
resolvePath
(
$
p
ath1
.
$postFix1
);
list
(,
$internalPath2
)
=
Filesystem
::
resolvePath
(
$
p
ath2
.
$postFix2
);
list
(
$storage
,
$internalPath1
)
=
Filesystem
::
resolvePath
(
$
absoluteP
ath1
.
$postFix1
);
list
(,
$internalPath2
)
=
Filesystem
::
resolvePath
(
$
absoluteP
ath2
.
$postFix2
);
if
(
$storage
)
{
$result
=
$storage
->
rename
(
$internalPath1
,
$internalPath2
);
}
else
{
...
...
@@ -345,7 +347,7 @@ class View {
$source
=
$this
->
fopen
(
$path1
.
$postFix1
,
'r'
);
$target
=
$this
->
fopen
(
$path2
.
$postFix2
,
'w'
);
$count
=
\OC_Helper
::
streamCopy
(
$source
,
$target
);
list
(
$storage1
,
$internalPath1
)
=
Filesystem
::
resolvePath
(
$
p
ath1
.
$postFix1
);
list
(
$storage1
,
$internalPath1
)
=
Filesystem
::
resolvePath
(
$
absoluteP
ath1
.
$postFix1
);
$storage1
->
unlink
(
$internalPath1
);
$result
=
$count
>
0
;
}
...
...
@@ -417,8 +419,8 @@ class View {
$mp1
=
$this
->
getMountPoint
(
$path1
.
$postFix1
);
$mp2
=
$this
->
getMountPoint
(
$path2
.
$postFix2
);
if
(
$mp1
==
$mp2
)
{
list
(
$storage
,
$internalPath1
)
=
Filesystem
::
resolvePath
(
$
p
ath1
.
$postFix1
);
list
(,
$internalPath2
)
=
Filesystem
::
resolvePath
(
$
p
ath2
.
$postFix2
);
list
(
$storage
,
$internalPath1
)
=
Filesystem
::
resolvePath
(
$
absoluteP
ath1
.
$postFix1
);
list
(,
$internalPath2
)
=
Filesystem
::
resolvePath
(
$
absoluteP
ath2
.
$postFix2
);
if
(
$storage
)
{
$result
=
$storage
->
copy
(
$internalPath1
,
$internalPath2
);
}
else
{
...
...
@@ -552,7 +554,7 @@ class View {
array
(
Filesystem
::
signal_param_path
=>
$path
)
);
}
list
(
$storage
,
$internalPath
)
=
Filesystem
::
resolvePath
(
$
p
ath
.
$postFix
);
list
(
$storage
,
$internalPath
)
=
Filesystem
::
resolvePath
(
$
absoluteP
ath
.
$postFix
);
if
(
$storage
)
{
$result
=
$storage
->
hash
(
$type
,
$internalPath
,
$raw
);
$result
=
\OC_FileProxy
::
runPostProxies
(
'hash'
,
$absolutePath
,
$result
);
...
...
@@ -587,7 +589,7 @@ class View {
return
false
;
}
$run
=
$this
->
runHooks
(
$hooks
,
$path
);
list
(
$storage
,
$internalPath
)
=
Filesystem
::
resolvePath
(
$
p
ath
.
$postFix
);
list
(
$storage
,
$internalPath
)
=
Filesystem
::
resolvePath
(
$
absoluteP
ath
.
$postFix
);
if
(
$run
and
$storage
)
{
if
(
!
is_null
(
$extraParam
))
{
$result
=
$storage
->
$operation
(
$internalPath
,
$extraParam
);
...
...
@@ -747,8 +749,23 @@ class View {
$files
[
$i
][
'permissions'
]
=
$permissions
[
$file
[
'fileid'
]];
}
usort
(
$files
,
"fileCmp"
);
return
$files
;
if
(
$mimetype_filter
)
{
foreach
(
$files
as
$file
)
{
if
(
strpos
(
$mimetype_filter
,
'/'
))
{
if
(
$file
[
'mimetype'
]
===
$mimetype_filter
)
{
$result
[]
=
$file
;
}
}
else
{
if
(
$file
[
'mimepart'
]
===
$mimetype_filter
)
{
$result
[]
=
$file
;
}
}
}
}
else
{
$result
=
$files
;
}
return
$result
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
lib/public/share.php
+
2
−
2
View file @
5bfff6c5
...
...
@@ -534,7 +534,7 @@ class Share {
$backend
=
self
::
getBackend
(
$itemType
);
// Get filesystem root to add it to the file target and remove from the file source, match file_source with the file cache
if
(
$itemType
==
'file'
||
$itemType
==
'folder'
)
{
$root
=
\OC
_
Filesystem
::
getRoot
();
$root
=
\OC
\Files\
Filesystem
::
getRoot
();
$where
=
'INNER JOIN `*PREFIX*fscache` ON `file_source` = `*PREFIX*fscache`.`id`'
;
if
(
!
isset
(
$item
))
{
$where
.
=
' WHERE `file_target` IS NOT NULL'
;
...
...
@@ -621,7 +621,7 @@ class Share {
}
else
{
if
(
$itemType
==
'file'
||
$itemType
==
'folder'
)
{
$where
.
=
' `file_target` = ?'
;
$item
=
\OC
_
Filesystem
::
normalizePath
(
$item
);
$item
=
\OC
\Files\
Filesystem
::
normalizePath
(
$item
);
}
else
{
$where
.
=
' `item_target` = ?'
;
}
...
...
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