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

Lack of Interest [Suggestion] - Databaseless On/Off Switch

Discussion in 'Closed Suggestions' started by Jafo, Aug 2, 2010.

  1. Jafo

    Jafo Active Member

    It would be nice if there was an option to use a file method to store the forums "on/off" status. When you turn a VB forum off, the script still has to access the db to see if the forum is off which can cause some issues during database repairs and dumps.

    I already wrote an in-house product to do it for my VB forums but it sure would be nice if it was stock.
     
  2. Mike

    Mike XenForo Developer Staff Member

    Given that admins can still access when it's off, I don't think this would really work. If you need to take it down because of DB issues, you're likely better off breaking execution in the config script.
     
  3. DSF

    DSF Well-Known Member

    A simple .htaccess with rewind to a landingpage and exclude my/our fix IP's is the easy way. :)
     
  4. Cezz

    Cezz Well-Known Member

    A wordpress style file based maintenance would be cool though... if you simply create a .maintenance in the domain root with the error message... This would disable for all even admin's and can be editied to allow for custom HTML page etc... After this no DB calls etc are made, this would be a great and easy way to take the site down with a nice error message while you do DB changes without having to break the config.php script..
     
  5. DSF

    DSF Well-Known Member

    @Ceri May
    This is a nice idea to. ;)
     
  6. Jafo

    Jafo Active Member

    Actually I have it setup in VB where I can exclude IP addresses. Also, it does break execution in the config file:

    $GLOBALS['preinit'] = '/path/to/writeable/maint.txt';

    if (defined('CWD'))
    {
    include_once(CWD . '/includes/pre-init.php');
    }

    From there it checks the maint.txt file which has a serialized array of the maintenance status, exclusions and the message to show to users.

    (pre-init):

    if (file_exists($GLOBALS['preinit']) and THIS_SCRIPT != 'maintenance_mode' and THIS_SCRIPT != 'login')
    {
    $arr = file_get_contents($GLOBALS['preinit']);
    $arr = unserialize($arr);
    if (!in_array($_SERVER['REMOTE_ADDR'], $arr['ips']))
    {
    ## include a file that shows the maint message and then exits..
    }
    }
     

Share This Page