--- imagecache/imagecache.module Fri Jun 20 08:21:42 2008 +++ imagecache/imagecache.module Tue Sep 23 21:14:27 2008 @@ -629,15 +629,21 @@ * @param string $path * A filepath relative to file_directory_path. */ -function _imagecache_recursive_delete($dir) { - $d = dir($dir); - while (($entry = $d->read()) !== false) { - if ($entry == '.' || $entry == '..') continue; - $path = $dir .'/'. $entry; - if (is_file($path)) unlink($path); - if (is_dir($path)) _imagecache_recursive_delete($path); - } - rmdir($dir); +function _imagecache_recursive_delete($path) { + if (is_file($path) || is_link($path)) { + unlink($path); + } + elseif (is_dir($path)) { + if ($d = opendir($path)) { + while (($entry = readdir($d)) !== false) { + if ($entry == '.' || $entry == '..') continue; + $entry_path = $path .DIRECTORY_SEPARATOR. $entry; + _imagecache_recursive_delete($entry_path); + } + closedir($d); + } + rmdir($path); + } } /**