Fixes #1349 - Gives option to successfully setup multiple DB connections

Just rebased https://github.com/Elgg/Elgg/pull/410 (see it's comments)