MyBB Community Forums
Define new Database connection from Plugin - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Development (https://community.mybb.com/forum-68.html)
+---- Thread: Define new Database connection from Plugin (/thread-72880.html)



Define new Database connection from Plugin - Dempsey - 2010-07-04

One of my MyBB based sites uses a 2nd database, which until now I add into inc/init.php after each upgrade as $db2, eg:

$db2->connect($config['hostname2'], $config['username2'], $config['password2']);
$db2->select_db($config['database2']);

But I know want to do this from a plugin so I don't have to make the modifications after each upgrade.

Which plugin hook if any could I use to create the database connection so that it would then be persistent across all files as it is when I manually add it into inc/init.php ?

Thanks


RE: Define new Database connection from Plugin - Tom K. - 2010-07-05

As far as i know, you would have to perform core edits. I dont know if the hooks system can handle this Confused