CodeIgniter Forums
Ftp class - reverse mirror function? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Ftp class - reverse mirror function? (/thread-29928.html)



Ftp class - reverse mirror function? - El Forum - 04-26-2010

[eluser]Dan King[/eluser]
Has anyone seen a function that does the opposite of ftp->mirror()? I'm looking for something that will take a directory structure on a remote ftp server, and recreate it on the web server. Basically the reverse of what the ftp->mirror() function does. Any help would be appreciated. Thanks!


Ftp class - reverse mirror function? - El Forum - 04-26-2010

[eluser]pickupman[/eluser]
If your server's are two different machines, what protocol would you use to access the webserver? A possible solution is to have both services on both machines, on the FTP server create the script the runs the mirror function. Have the function mirror to the webserver. Then create a script on the webserver, that calls via cURL or wget the url on the ftp server. This would trigger the script to run, and sync the ftp to the webserver.
If you have full access to the servers, you may also be able to use Subversion.


Ftp class - reverse mirror function? - El Forum - 04-26-2010

[eluser]Dan King[/eluser]
Yes, they're two different machines. I was going to use one as a backup, that would go out and download the files via FTP from the main machine. Also noticed there's no ftp->download() function, only ftp->upload(). Maybe I'll just create a MY_Ftp.php file and extend the class with some of my own functions. Didn't want to re-invent the wheel if I didn't have to though.


Ftp class - reverse mirror function? - El Forum - 06-07-2010

[eluser]caleblloyd[/eluser]
I have posted this extension at http://ellislab.com/forums/viewthread/157098/