Announcement

Collapse
No announcement yet.

Turn Active forum on/off programatically?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Turn Active forum on/off programatically?

    Hi!

    Is there any way to turn a forum on and off programatically from an extern script - like a cron job? I need this for scheduled backups

  • #2
    Ok - perhaps I could do it this way?

    Code:
    UPDATE vb_settings
    SET value = 0
    WHERE varname = bbactive
    But is this an "ok" way of doing it - or do vbulletin expose an api of some kind?

    Comment


    • #3
      The above manual manipulation of the vbulletin settings table, did not turn the forum off or on.

      I suspect that a Data Manager might be the way to go. Can anybody point me to some info on how to use a data manager to turn the board on or off?

      Comment


      • #4
        I think it's easier with two queries than DM.
        Turn off:
        Code:
        UPDATE datastore SET data=REPLACE(data,'s:8:"bbactive";i:1;','s:8:"bbactive";i:0;') WHERE title='options';
        UPDATE setting SET value=0 WHERE varname='bbactive';
        Turn on:
        Code:
        UPDATE datastore SET data=REPLACE(data,'s:8:"bbactive";i:0;','s:8:"bbactive";i:1;') WHERE title='options';
        UPDATE setting SET value=1 WHERE varname='bbactive';
        Note: 3.5.x is different. For anyone from 3.5.x looking for similar queries, please open a new thread in the appropriate forum.
        Best Regards,
        Andy Huang

        Comment


        • #5
          Andy, will that take into account if you have your datastore stored in the filesystem?
          ~~~~~

          Comment


          • #6
            Probably not until database is rebuilt, no.
            It's what we use to turn forums on and off when people's things gone outta wack -- of course, in those cases, we do set their datastore back to the database so it doesn't hinder anything we do with queries
            Best Regards,
            Andy Huang

            Comment


            • #7
              One good way to do it with a script might be to first run the update query on the setting table, then call build_datastore() with the appropriate parameters. That is, if you have loaded the vBulletin core.
              ~~~~~

              Comment


              • #8
                Thanx for the suggestions Andy Huang and sockwater

                I'm kind of curious about the build_datastore() method, but to start with, I will go for the solution Andy suggested and then start a thread at vbulletin.org about the build_datastore() method.

                Comment

                widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                Working...
                X