PDA

View Full Version : Query to Shutdown forums


telc
03-28-2005, 02:08 AM
I would like a query that I can run that will shutdown my Forums and one the re-enable them.

I have a backup script that runs and I would like to be able to


#!/usr/local/bin/php
<?
//shutdown forums

// run my backup

// enable forums
?>


Or even a vbulletin cron that will shutdown the forums would be great.

Deaths
03-28-2005, 06:14 AM
How do you mean shutdown?

Just setting it to Offline, or..?

telc
03-28-2005, 10:47 AM
How do you mean shutdown?

Just setting it to Offline, or..?

Yes, like when you go in the admincp and disable the forums.

Deaths
03-28-2005, 11:20 AM
Ok.

Do you want the script itself to make the backup, or do you have a script which already does this?

telc
03-28-2005, 11:46 AM
Ok.

Do you want the script itself to make the backup, or do you have a script which already does this?


I already have a script to the do backup. Something like this:


enable_forums(false);

// my backup

enable_forums(true);

Deaths
03-28-2005, 11:51 AM
Query to turn off:

$DB_site->query("UPDATE ". TABLE_PREFIX ."settings SET bbactive = 1");

Query to turn on:

$DB_site->query("UPDATE ". TABLE_PREFIX ."settings SET bbactive = 0");

;)

telc
03-28-2005, 12:10 PM
It is also stored in Table:'datastore' Field:'options'

Deaths
03-28-2005, 12:12 PM
Hmmm, I see.

Have you tested my code, though?

telc
03-28-2005, 12:14 PM
I will when I get home from work. Thanks. I will let you know.

Deaths
03-28-2005, 12:15 PM
Ok, no problem.

If that doesn't work, I'll take a look at the datastore.

telc
03-28-2005, 12:19 PM
I just went in with phpMyAdmin and updated the value and it didn't disable the forum.

Deaths
03-28-2005, 12:33 PM
Ok, this *might* work, but it is untested:

build_datastore('bbactive', serialize('1'));

Or maybe:

$DB_site->query("UPDATE " . TABLE_PREFIX . "datastore SET ('bbactive', 's:1:"1"')");

I haven't tested them, but they should work... atleast one of them ^^.

Do test on a test board though, they can screw up your board bad if they don't work like supposed to :ermm:

telc
03-28-2005, 02:04 PM
Ok, this *might* work, but it is untested:

build_datastore('bbactive', serialize('1'));

Or maybe:

$DB_site->query("UPDATE " . TABLE_PREFIX . "datastore SET ('bbactive', 's:1:"1"')");

I haven't tested them, but they should work... atleast one of them ^^.

Do test on a test board though, they can screw up your board bad if they don't work like supposed to :ermm:

That query scares me, I am afraid to write back to that field. Other fields dont bother me.

Zachery
03-28-2005, 02:23 PM
Its two querys and try searching at vB.com I believe Steve M posted it on the forums.

telc
03-28-2005, 02:31 PM
Its two querys and try searching at vB.com I believe Steve M posted it on the forums.


Thanks! I found it:

http://www.vbulletin.com/forum/showpost.php?p=822082&postcount=4

Run these queries to turn off your forums in vB3:

UPDATE datastore SET data=REPLACE(data,'"bbactive";s:1:"1"','"bbactive";s:1:"0"') WHERE title='options';

UPDATE setting SET value=0 WHERE varname='bbactive';