Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3443488
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
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
Issue forks
drupal-3443488
Commits
0ca8f9b2
Commit
0ca8f9b2
authored
15 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
#573292
by eMPee584: Allow enable file_unmanaged_delete() to handle stream wrapper URIs.
parent
f43e5669
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
includes/file.inc
+7
-3
7 additions, 3 deletions
includes/file.inc
with
7 additions
and
3 deletions
includes/file.inc
+
7
−
3
View file @
0ca8f9b2
...
...
@@ -948,7 +948,7 @@ function file_delete(stdClass $file, $force = FALSE) {
* entry recorded in the files table.
*
* @param $path
* A string containing a filepath or URI.
* A string containing a file
path or
(streamwrapper)
URI.
* @return
* TRUE for success or path does not exist, or FALSE in the event of an
* error.
...
...
@@ -957,6 +957,8 @@ function file_delete(stdClass $file, $force = FALSE) {
* @see file_unmanaged_delete_recursive()
*/
function
file_unmanaged_delete
(
$path
)
{
// Resolve streamwrapper URI to local path.
$path
=
drupal_realpath
(
$path
);
if
(
is_dir
(
$path
))
{
watchdog
(
'file'
,
'%path is a directory and cannot be removed using file_unmanaged_delete().'
,
array
(
'%path'
=>
$path
),
WATCHDOG_ERROR
);
return
FALSE
;
...
...
@@ -989,14 +991,16 @@ function file_unmanaged_delete($path) {
* Note that this only deletes visible files with write permission.
*
* @param $path
* A string containing
a URI, filepath.
or directory path.
* A string containing
eiher an URI or a file
or directory path.
* @return
* TRUE for success or path does not exist,
or
FALSE in the event of an
* TRUE for success or
if
path does not exist, FALSE in the event of an
* error.
*
* @see file_unmanaged_delete()
*/
function
file_unmanaged_delete_recursive
(
$path
)
{
// Resolve streamwrapper URI to local path.
$path
=
drupal_realpath
(
$path
);
if
(
is_dir
(
$path
))
{
$dir
=
dir
(
$path
);
while
((
$entry
=
$dir
->
read
())
!==
FALSE
)
{
...
...
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