PDA

View Full Version : Backup Mode For Forums


ladyfyre
12-25-2002, 08:09 PM
I am due to begin backing up and restoring our MySql db to a new server (we are quickly outgrowing the old one, and will be adding a new second server to handle the MySql ONLY, hence i will be leaving everything else in place, but the db will have to be moved).

Our DB is HUGE...so this process will take over an hour, and more likely close to 3-4 to complete. During this time, i understand nothing can be written to the DB, because it would then not be accurate on the new server, and those updates would be lost. However....the mysql dump doesn't take NEARLY as long as it takes for the server to rebuild a DB from the .sql file.

I know i am not alone in wishing for this...so i am tossing it out there in hopes one of you geniuses can come up with a solution.....

Is there a way to set the entire set of forums to READ ONLY during a backup.....preferably with a BIG notice at the top of all pages that READ is enabled for their convenience, but no post views will be counted, and no posting will be allowed until the system is out of maintenance mode?

This would at least enable our users to be able to search for info.....rather than have a simple "Board closed" notice.

So....which one of you guys is gonna make my whole Holiday Season???

Xenon
12-25-2002, 09:02 PM
hmm, maybe the easiest way would be to modify db_mysql.php to check the queriestring first, and if it contains UPDATE or INSERT it would ignore it....

i think it should be easy to do, no admin options or something like that, just a little strstr() php edit :)

ladyfyre
12-25-2002, 09:29 PM
any chance you can tell me how to do that??? Or do i need to spend a few hours with my PHP books looking for the info to change?

I was actually kind of hoping for a tiny hack into the ADMIN CP, so that you could choose whether the boards should be on, off, or in "Maintenance Mode"......but then again, i never denied being a bit of a brat.

i would offer to pay for it...but that seems to irk people here.

Xenon
12-25-2002, 09:39 PM
well, i could (i thin ;)) code an ACP thing for it, but not for today, and i don't know when i'm back next time ;)

so, just the tip
open db_mysql.php
function query:
find $this->query_id = mysql_query($query_string,$this->link_id);
if (!$this->query_id) {
$this->halt("Invalid SQL: ".$query_string);
}

replace with:if(!strstr(strtoupper($query_string),"UPDATE") and !strstr(strtoupper($query_string), "INSERT")) { $this->query_id = mysql_query($query_string,$this->link_id);
if (!$this->query_id) {
$this->halt("Invalid SQL: ".$query_string);
}}

save the original as well :)
when you upload the hacekd file, no writing queries would be run anymore...
i don't know if it would work, because session also uses the updates but, just test it out :)