<?php
echo "REBUILD2 START<br>";

error_reporting(E_ALL);
ini_set('display_errors', 1);

define('CWD', __DIR__);

require_once(CWD . '/includes/config.php');
require_once(CWD . '/includes/class_core.php');
require_once(CWD . '/includes/functions.php');

$vbulletin = new vB_Registry();
$vbulletin->fetch_config();

$vbulletin->db = new vB_Database_MySQLi($vbulletin);

$vbulletin->db->connect(
	$config['Database']['dbname'],
	$config['MasterServer']['servername'],
	$config['MasterServer']['port'],
	$config['MasterServer']['username'],
	$config['MasterServer']['password'],
	$config['MasterServer']['usepconnect'],
	(isset($config['SlaveServer']['servername']) ? $config['SlaveServer']['servername'] : ''),
	(isset($config['SlaveServer']['port']) ? $config['SlaveServer']['port'] : 3306),
	(isset($config['SlaveServer']['username']) ? $config['SlaveServer']['username'] : ''),
	(isset($config['SlaveServer']['password']) ? $config['SlaveServer']['password'] : ''),
	(isset($config['SlaveServer']['usepconnect']) ? $config['SlaveServer']['usepconnect'] : false),
	(isset($config['Misc']['configfile']) ? $config['Misc']['configfile'] : ''),
	(isset($config['Mysqli']['charset']) ? $config['Mysqli']['charset'] : '')
);

build_datastore('bitfields', '', 1);
build_datastore('bf_ugp', '', 1);
echo "BITFIELDS OK";

?>