Index: trunk/extensions/ExternalData/ED_Utils.php |
— | — | @@ -178,9 +178,25 @@ |
179 | 179 | $db_tableprefix = ''; |
180 | 180 | } |
181 | 181 | |
182 | | - // DatabaseBase::newFromType() was added in MW 1.17 |
183 | | - $realFunction = array( 'DatabaseBase', 'newFromType' ); |
184 | | - if ( is_callable( $realFunction ) ) { |
| 182 | + // DatabaseBase::newFromType() was added in MW 1.17 - it was |
| 183 | + // then replaced by DatabaseBase::factory() in MW 1.18 |
| 184 | + $factorFunction = array( 'DatabaseBase', 'factory' ); |
| 185 | + $newFromTypeFunction = array( 'DatabaseBase', 'newFromType' ); |
| 186 | + if ( is_callable( $factorFunction ) ) { |
| 187 | + $db = DatabaseBase::factory( $db_type, |
| 188 | + array( |
| 189 | + 'host' => $db_server, |
| 190 | + 'user' => $db_username, |
| 191 | + 'password' => $db_password, |
| 192 | + // Both 'dbname' and 'dbName' have been |
| 193 | + // used in different versions. |
| 194 | + 'dbname' => $db_name, |
| 195 | + 'dbName' => $db_name, |
| 196 | + 'flags' => $db_flags, |
| 197 | + 'tablePrefix' => $db_tableprefix, |
| 198 | + ) |
| 199 | + ); |
| 200 | + } elseif ( is_callable( $newFromTypeFunction ) ) { |
185 | 201 | $db = DatabaseBase::newFromType( $db_type, |
186 | 202 | array( |
187 | 203 | 'host' => $db_server, |