How to run a codeigniter application on offline mode - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: How to run a codeigniter application on offline mode (/showthread.php?tid=21544) |
How to run a codeigniter application on offline mode - El Forum - 08-13-2009 [eluser]Jack Taylor[/eluser] Hi All, I am using CI just for last one years, I develop several application on it. But now a days I think that how we can run an application on offline mode [internet not available]. I am thinking on it. Can someone suggest me that how a CI application on offline mode? How much I have to change on my existing application. Thanks Jack How to run a codeigniter application on offline mode - El Forum - 08-13-2009 [eluser]davidbehler[/eluser] You mean with no connection to the server the application is running on? How to run a codeigniter application on offline mode - El Forum - 08-13-2009 [eluser]Jack Taylor[/eluser] Hi, Yes, I mean to say that one copy of my CI application already running on my local system, on every request I will check the internet availability, if internet is available than every request will go to my online sever otherwise request will redirect to my local server and I will track every change in my database (insert, update, delete) and databases will syncronize later when internet connection is available. I am using MySql database. Thanks Jack How to run a codeigniter application on offline mode - El Forum - 08-13-2009 [eluser]davidbehler[/eluser] You already do that or you want to know how to achieve that behavior? How to run a codeigniter application on offline mode - El Forum - 08-13-2009 [eluser]Jack Taylor[/eluser] Yes I am lot interested to know how to achieve that behavior. How to run a codeigniter application on offline mode - El Forum - 08-13-2009 [eluser]davidbehler[/eluser] I guess you would have to do quite some hacking: 1. The database class needs to be adjusted to switch connections depending on you being online/offline. Alternatively you could only change the config/database.php file and set the connection depending on your online/offline state. Code: if (!@$fp = fsockopen("http://www.google.com", 80, $errno, $errstr, 1)){ 3. As far as the synchronizing is concerned, you would have to turn the logged changes into insert/update/delete querys and run them on your online database. Again no built-in solution in CI. @2 and 3: This might help...haven't looked into it in detail but master/slave or master/master replication might be exactly what you need: http://www.howtoforge.com/mysql_master_master_replication How to run a codeigniter application on offline mode - El Forum - 08-13-2009 [eluser]wabu[/eluser] This might also lead to: http://ellislab.com/forums/viewthread/125328/ [Haven't tried it yet myself.] |