Turn Active forum on/off programatically?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Markowitch
    New Member
    • Nov 2005
    • 28

    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
  • Markowitch
    New Member
    • Nov 2005
    • 28

    #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

    • Markowitch
      New Member
      • Nov 2005
      • 28

      #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

      • Andy Huang
        Senior Member
        • Feb 2004
        • 4602

        #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

        • David Grove
          Senior Member
          • Apr 2008
          • 3507
          • 5.5.x

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

          Comment

          • Andy Huang
            Senior Member
            • Feb 2004
            • 4602

            #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

            • David Grove
              Senior Member
              • Apr 2008
              • 3507
              • 5.5.x

              #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

              • Markowitch
                New Member
                • Nov 2005
                • 28

                #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...