Managing Multiple Databases
From MyUPBWiki
Note this is only compatible with UPB v2.1.1
In UPB's latest version, the forum is setup to support one database, however UPB's coding can support multiple ones at a time.
This tutorial will take you step by step in editing the config.php to support multiple forums.
- To install more than one database, rename config.php to something else, like config2.php
When you do this, make sure no one can access the forum. You might want to think about renaming the forum's directory temporarily to avoid other users gaining access to the install scripts. - Next, run the install.php script
- After you're done, your UPB forum should be a blank unmodified forum
- Open the config2.php and config.php in your favorite editor, the should look something like this:
<?php
define('INSTALLATION_MODE', false, true);
define('UPB_VERSION', '2.1.1b', true);
define('DB_DIR', './data_67c21d238c63d7.4588165', true);
define('ADMIN_EMAIL', 'admin@myforum.com', true);
?>
- Setup your config.php to look like this:
Noticed how the UPB_VERSION and INSTALLATION_MODE are outside the if statements. This is important when upgrading. Also be sure the change the "foo" and "bar" references to a descriptor of your choice.
<?php
define('UPB_VERSION', '2.1.1b', true);
define('INSTALLATION_MODE', false, true);
$_SESSION['forum'] = $_GET['forum'];
if($_SESSION['forum'] == 'foo') {
define('DB_DIR', './data_47c21d2f8c63d7.45846165', true);
define('ADMIN_EMAIL', 'admin@myforum.com', true);
} else
if($_SESSION['forum'] == 'bar') {
define('DB_DIR', './data_81c21d2fac6337.4d846e60', true);
define('ADMIN_EMAIL', 'webmaster@mybb.com', true);
} else {
die("Bad Forum Descriptor. See Admin for Help");
}
?>
'./data_47c21d2f8c63d7.45846165' and './data_81c21d2fac6337.4d846e60' should be replaced by the paths to the database directories created when you installed the forum
- Repeat this process for how ever many number of forums you want.
- Now to access your different forums, you should set URLs to index.php?forum=foo
