1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Close forum in a cron job?

Discussion in 'XenForo Development Discussions' started by Jaxel, Aug 14, 2013.

  1. Jaxel

    Jaxel Well-Known Member

    I'm trying to set up a cron job. At the beginning of the cron, I want to close the forums; then reopen the forum when the cron is done. What would be the best way to do this?
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    Set the board disabled option using the appropriate classes.
     
  3. Jaxel

    Jaxel Well-Known Member

    And how would I do that?
     
  4. Chris D

    Chris D XenForo Developer Staff Member

  5. Jaxel

    Jaxel Well-Known Member

    Thanks.
     
  6. Jaxel

    Jaxel Well-Known Member

    I am having one major issue with this:
    Code:
    $this->closeForum();
    exec("mysqldump ---");
    $this->openForum();
    It closes the forum fine... and then fires the exec command.

    However, then the system has to wait for the exec command to send an all clear... which could be 10 minutes down the line, since mysqldumps can take a while. However, by then, the php script has been disconnected from the server and the open forum command never gets fired.

    Is there some way around this? I thought the new XF cron system was supposed to handle stuff like this.
     
    BamaStangGuy likes this.
  7. AndyB

    AndyB Well-Known Member

    Curious why you want to close the forum during a mysqldump.
     
  8. Jaxel

    Jaxel Well-Known Member

    Why wouldn't you?

    Don't you shut your forum down while you do your backups so people can't add new stuff to the database?
     
  9. AndyB

    AndyB Well-Known Member

    No I don't shut my forum when doing a mysqldump. During the mysqldump the database is automatically locked during the backup process, so there's no need close the forum through the forum software.
     
  10. Jaxel

    Jaxel Well-Known Member

    But even the mysqldump documents explicitly state that the table locks do not guarantee logical consistency.

    Either way, this isn't a discussion over whether or not to close the forums... its asking for a fix for a specific problem.
     

Share This Page