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
d7bb8c4c
Commit
d7bb8c4c
authored
14 years ago
by
Thibaut GRIDEL
Browse files
Options
Downloads
Patches
Plain Diff
code duplication: use lib_filesystem.php instead
parent
6e8001b0
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
inc/HTTP/WebDAV/Server/Filesystem.php
+3
-59
3 additions, 59 deletions
inc/HTTP/WebDAV/Server/Filesystem.php
with
3 additions
and
59 deletions
inc/HTTP/WebDAV/Server/Filesystem.php
+
3
−
59
View file @
d7bb8c4c
...
...
@@ -34,6 +34,7 @@
*/
require_once
(
"../inc/lib_base.php"
);
oc_require_once
(
"lib_log.php"
);
oc_require_once
(
"lib_filesystem.php"
);
oc_require_once
(
"HTTP/WebDAV/Server.php"
);
oc_require_once
(
"System.php"
);
...
...
@@ -176,7 +177,7 @@
// plain file (WebDAV resource)
$info
[
"props"
][]
=
$this
->
mkprop
(
"resourcetype"
,
""
);
if
(
OC_FILESYSTEM
::
is_readable
(
$fspath
))
{
$info
[
"props"
][]
=
$this
->
mkprop
(
"getcontenttype"
,
$this
->
_m
imetype
(
$fspath
));
$info
[
"props"
][]
=
$this
->
mkprop
(
"getcontenttype"
,
OC_FILESYSTEM
::
getM
imetype
(
$fspath
));
}
else
{
$info
[
"props"
][]
=
$this
->
mkprop
(
"getcontenttype"
,
"application/x-non-readable"
);
}
...
...
@@ -191,63 +192,6 @@
return
$info
;
}
/**
* detect if a given program is found in the search PATH
*
* helper function used by _mimetype() to detect if the
* external 'file' utility is available
*
* @param string program name
* @param string optional search path, defaults to $PATH
* @return bool true if executable program found in path
*/
function
_can_execute
(
$name
,
$path
=
false
)
{
// path defaults to PATH from environment if not set
if
(
$path
===
false
)
{
$path
=
getenv
(
"PATH"
);
}
// check method depends on operating system
if
(
!
strncmp
(
PHP_OS
,
"WIN"
,
3
))
{
// on Windows an appropriate COM or EXE file needs to exist
$exts
=
array
(
".exe"
,
".com"
);
$check_fn
=
"file_exists"
;
}
else
{
// anywhere else we look for an executable file of that name
$exts
=
array
(
""
);
$check_fn
=
"is_executable"
;
}
// now check the directories in the path for the program
foreach
(
explode
(
PATH_SEPARATOR
,
$path
)
as
$dir
)
{
// skip invalid path entries
if
(
!
file_exists
(
$dir
))
continue
;
if
(
!
is_dir
(
$dir
))
continue
;
// and now look for the file
foreach
(
$exts
as
$ext
)
{
if
(
$check_fn
(
"
$dir
/
$name
"
.
$ext
))
return
true
;
}
}
return
false
;
}
/**
* try to detect the mime type of a file
*
* @param string file path
* @return string guessed mime type
*/
function
_mimetype
(
$fspath
)
{
return
OC_FILESYSTEM
::
getMimeType
(
$fspath
);
return
$mime_type
;
}
/**
* HEAD method handler
*
...
...
@@ -263,7 +207,7 @@
if
(
!
OC_FILESYSTEM
::
file_exists
(
$fspath
))
return
false
;
// detect resource type
$options
[
'mimetype'
]
=
$this
->
_m
imetype
(
$fspath
);
$options
[
'mimetype'
]
=
OC_FILESYSTEM
::
getM
imetype
(
$fspath
);
// detect modification time
// see rfc2518, section 13.7
...
...
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