diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-10-09 18:38:52 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-10-09 18:38:52 +0000 |
commit | 0ca8f9b2d759777fdf367b61d1c6fca1a331058d (patch) | |
tree | b95a5cafd0e9b43b5b38a6fe397588ff2280e744 /includes | |
parent | f43e566964a6e85d2d1cc1d6b3ac06f97bf3e97e (diff) | |
download | brdo-0ca8f9b2d759777fdf367b61d1c6fca1a331058d.tar.gz brdo-0ca8f9b2d759777fdf367b61d1c6fca1a331058d.tar.bz2 |
#573292 by eMPee584: Allow enable file_unmanaged_delete() to handle stream wrapper URIs.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/file.inc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/includes/file.inc b/includes/file.inc index 7729544f1..0ff21f25b 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -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) { |