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

Forum on/off

Discussion in 'XenForo Questions and Support' started by DSF, May 16, 2012.

  1. DSF

    DSF Well-Known Member

    For backup's runs a server-cron.
    Now i will close the forum just before and open again just behind the backup.

    Where I find the on/off-Flag on the database? :(
     
  2. ragtek

    ragtek Guest

    that's how i'm doing this


    /** @var XenForo_Model_Option */
    $optionsM = XenForo_Model::create('XenForo_Model_Option');
    $optionsM->updateOptions(array('boardActive' => 0));


    PHP:
    // RAGTEK TESTUNIT BOOTSTRAP
     
    class RAGTEK_UNIT
    {
        CONST 
    IS_LIVE false;
     
        public function 
    init()
        {
            
    $startTime microtime(true);
            
    $fileDir dirname(__FILE__);
     
     
            require(
    $fileDir '/library/XenForo/Autoloader.php');
            
    XenForo_Autoloader::getInstance()->setupAutoloader($fileDir '/library');
     
            
    XenForo_Application::initialize($fileDir '/library'$fileDir);
            
    XenForo_Application::set('page_start_time'$startTime);
        }
     
        public function 
    deactivateBoard()
        {
            
    /** @var XenForo_Model_Option */
            
    $optionsM XenForo_Model::create('XenForo_Model_Option');
            
    $optionsM->updateOptions(array('boardActive' => 0));
        }
     
    CyclingTribe likes this.
  3. DSF

    DSF Well-Known Member

    Ok, that's the way for xF. The source has help me to found it. ;)

    I run it out of the box as apache-server-cron/php
    However, I have found it in: Database -> Table -> xf-data-registry -> Field -> options ...... "boardActive";s:1:"1"; ......
    Now ist a simple string-replace and update. :)
     
    CyclingTribe likes this.
  4. ragtek

    ragtek Guest

    It's for out of the box;)

    PHP:
    class RAGTEK_UNIT
    {
    CONST 
    IS_LIVE false;
     
    public function 
    init()
    {
    $startTime microtime(true);
    $fileDir dirname(__FILE__);
     
     
    require(
    $fileDir '/library/XenForo/Autoloader.php');
    XenForo_Autoloader::getInstance()->setupAutoloader($fileDir '/library');
     
    XenForo_Application::initialize($fileDir '/library'$fileDir);
    XenForo_Application::set('page_start_time'$startTime);
    }
     
    public static function 
    deactivateBoard()
    {
    /** @var XenForo_Model_Option */
    $optionsM XenForo_Model::create('XenForo_Model_Option');
    $optionsM->updateOptions(array('boardActive' => 0));
    }
     
    public static function 
    activateBoard()
    {
    /** @var XenForo_Model_Option */
    $optionsM XenForo_Model::create('XenForo_Model_Option');
    $optionsM->updateOptions(array('boardActive' => 1));
    }
    }
     
    $testSuite = new RAGTEK_UNIT();
    $testSuite->init();
    $testSuite->deactivateBoard();
    // RUN BACKUP
    $testSuite->activateBoard();
     
    alexD and DSF like this.

Share This Page