1 users online. Create an account or sign in to join them.Users
rmdirr function
A for , submitted by brendo on 22 October 2009
Announcement
Symphony's issue tracker has been moved to Github.
Issues are displayed here for reference only and cannot be created or edited.
Browse
Closed#155: rmdirr function
heh. well spotted. Interestingly, General::rmdirr() is not used anywhere in Symphony’s core. I would suggest we remove it.
One more mystery was revealed. The smiley face already has gone! :P
This issue is closed.
In
class.general.phpthe functionrmdirrcannot possibly work as it references$fwhich is never declared.It would be nice to rewrite the function to make use of
deleteFileso that it can be used in extensions etc.I’ve used this one in the past: function deleteDirectory($dir) { if (!file_exists($dir)) return true; if (!is_dir($dir)) return unlink($dir);
foreach (scandir($dir) as $item) { if ($item == '.' || $item == '..') continue; if (!$this->deleteDirectory($dir.DIRECTORY_SEPARATOR.$item)) return false; } return rmdir($dir); }Which I guess could be rewritten as the following to make use of
deleteFilefunction rmdirr($dir) { if (!file_exists($dir)) return true; if (!is_dir($dir)) return $this->deleteFile($dir); foreach (scandir($dir) as $item) { if ($item == '.' || $item == '..') continue; if (!$this->rmdirr($dir.DIRECTORY_SEPARATOR.$item)) return false; } return rmdir($dir); }