Add a Database::getType() function so that we can get rid of $wgDBtype in favour of OOP goodness.

This commit is contained in:
Tim Starling 2010-01-07 00:22:18 +00:00
parent c61af99e4f
commit 071bbbe218

View file

@ -284,6 +284,17 @@ abstract class DatabaseBase {
}
}
/**
* Get the type of the DBMS, as it appears in $wgDBtype.
*/
function getType() {
if ( preg_match( '/^Database(\w+)$/', get_class( $this ), $m ) ) {
return strtolower( $m[1] );
} else {
throw new MWException( get_class( $this ) .'::getType: unable to determine type.' );
}
}
#------------------------------------------------------------------------------
# Other functions
#------------------------------------------------------------------------------