Add a Database::getType() function so that we can get rid of $wgDBtype in favour of OOP goodness.
This commit is contained in:
parent
c61af99e4f
commit
071bbbe218
1 changed files with 11 additions and 0 deletions
|
|
@ -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
|
||||
#------------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in a new issue