Forum on/off

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? :(
 
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));
    }
 
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. :)
 
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();
 
Top Bottom