FTP Class: delete_dir bug |
[eluser]Unknown[/eluser]
Hello everyone, This is my first forum post. I did research about this topic and only thing I found was 5 years old topic (http://ellislab.com/forums/viewthread/73334/#390497) so... Right now I am working on project which goal is to remotely backup 100+ Websites. For that purpose I used native CI FTP library and, until now, I didn't have any troubles. But, when I tried to delete folder on remote server (delete_dir method) I end up with infinitive loop. After short investigation, I found following code problematic (/system/libraries/Ftp.php - Line 422): Code: $list = $this->list_files($filepath); First of all, $list variable contains relative names of files/folders, so this will not work when you have sub folders. Another problem is that, inside foreach loop, there is no condition which will check if $item is '.' or '..', so (at least on Linux system), this script will fail into infinitive loop. I fixed it simply, by extending CI native class and slight change inside that loop: Code: foreach ($list as $item) { Full code: Code: class MY_FTP extends CI_FTP {
|
Welcome Guest, Not a member yet? Register Sign In |