1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-15 12:05:21 +02:00

[ticket/11015] Make phpbb_convert_30_dbms_to_31 more future proof

It should allow any class name in the future, as long as that class
exists. And it should give a useful error message otherwise.

PHPBB3-11015
This commit is contained in:
Igor Wiedler 2012-11-17 01:40:32 +01:00
parent 5bc0f4b3d4
commit 0372ecf141

View File

@ -5421,10 +5421,15 @@ function phpbb_to_numeric($input)
*/ */
function phpbb_convert_30_dbms_to_31($dbms) function phpbb_convert_30_dbms_to_31($dbms)
{ {
if (!preg_match('#^phpbb_db_driver_#', $dbms)) if (class_exists($dbms))
{ {
return 'phpbb_db_driver_'.$dbms; return $dbms;
} }
return $dbms; if (class_exists('phpbb_db_driver_' . $dbms))
{
return 'phpbb_db_driver_' . $dbms;
}
throw new \RuntimeException('You have specified an invalid dbms driver.');
} }