[eluser]learnq[/eluser]
Hi,
I want to whole site go offline when the update script runs via corn job.
When the site is updating, ..it should not accept any Mysql query&show;any pages.
Is there a easy way to do this in CI ?
[eluser]Ty Bex[/eluser]
HIGH LEVEL DETAILS:
This is not a perfect solution but it will work.
This is only requre a local file read and no db connectivity.
1.) Create a file called "site_status.txt"
2.) The content of the file is a simple "1" for server up and "0" for server down.
3.) Write a library "l_stite_status.php" that opens and reads the value and sets a variable to 1 or 0 "var_site_status"
4.) Autoload the library
5.) In every class or at a higher level with a hook in codeigniter call the library and check if the value is a 1 or 0
6.) If there var_site_status equals 0 then redirect to a site is down for maintenance static html page.
Now just have your cron over write a 1 or 0 to the site_status.txt
[eluser]devbro[/eluser]
i am not sure if this would help or no but give it a try.
in your default application create a custom hook.
create either a "pre_controller" or a "post_controller_constructor"
this hook would go and check if an update is in progress. if so then kill the request and redirect to a "server is under update" page.
just remember that your cron job should reset whatever it is that tells the hook that update is in progress. it can be a temp file or a database record.