Index: trunk/extensions/ExternalData/ED_Utils.php |
— | — | @@ -134,15 +134,35 @@ |
135 | 135 | } |
136 | 136 | |
137 | 137 | $db_type = $edgDBServerType[$server_id]; |
| 138 | + $db_server = $edgDBServer[$server_id]; |
| 139 | + $db_name = $edgDBName[$server_id]; |
| 140 | + $db_username = $edgDBUser[$server_id]; |
| 141 | + $db_password = $edgDBPass[$server_id]; |
| 142 | + |
| 143 | + // DatabaseBase::newFromType() was added in MW 1.18 |
| 144 | + if ( method_exists( 'DatabaseBase', 'newFromType' ) ) { |
| 145 | + $db = DatabaseBase::newFromType( $db_type, |
| 146 | + array( |
| 147 | + 'host' => $db_server, |
| 148 | + 'user' => $db_username, |
| 149 | + 'password' => $db_password, |
| 150 | + 'dbname' => $db_name, |
| 151 | + ) |
| 152 | + ); |
| 153 | + } else { |
| 154 | + if ( $db_type == "mysql" ) { |
| 155 | + $db = new Database( $db_server, $db_username, $db_password, $db_name ); |
| 156 | + } elseif ( $db_type == "postgres" ) { |
| 157 | + $db = new DatabasePostgres( $db_server, $db_username, $db_password, $db_name ); |
| 158 | + } elseif ( $db_type == "mssql" ) { |
| 159 | + $db = new DatabaseMssql( $db_server, $db_username, $db_password, $db_name ); |
| 160 | + } elseif ( $db_type == "oracle" ) { |
| 161 | + $db = new DatabaseOracle( $db_server, $db_username, $db_password, $db_name ); |
| 162 | + } else { |
| 163 | + $db = null; |
| 164 | + } |
| 165 | + } |
138 | 166 | |
139 | | - $db = DatabaseBase::newFromType( $db_type, |
140 | | - array( |
141 | | - 'host' => $edgDBServer[$server_id], |
142 | | - 'user' => $edgDBUser[$server_id], |
143 | | - 'password' => $edgDBPass[$server_id], |
144 | | - 'dbname' => $edgDBName[$server_id], |
145 | | - ) ); |
146 | | - |
147 | 167 | if ( $db == null ) { |
148 | 168 | echo ( wfMsgExt( "externaldata-db-unknown-type", array( 'parse', 'escape' ) ) ); |
149 | 169 | return; |