Index: trunk/extensions/ExternalData/ExternalData.php |
— | — | @@ -48,6 +48,8 @@ |
49 | 49 | $edgDBName = array(); |
50 | 50 | $edgDBUser = array(); |
51 | 51 | $edgDBPass = array(); |
| 52 | +$edgDBFlags = array(); |
| 53 | +$edgDBTablePrefix = array(); |
52 | 54 | |
53 | 55 | function edgRegisterParser( &$parser ) { |
54 | 56 | $parser->setFunctionHook( 'get_external_data', array( 'EDParserFunctions', 'doGetExternalData' ) ); |
Index: trunk/extensions/ExternalData/ED_Utils.php |
— | — | @@ -133,7 +133,10 @@ |
134 | 134 | global $edgDBName; |
135 | 135 | global $edgDBUser; |
136 | 136 | global $edgDBPass; |
| 137 | + global $edgDBFlags; |
| 138 | + global $edgDBTablePrefix; |
137 | 139 | |
| 140 | + // Mandatory parameters |
138 | 141 | if ( ( ! array_key_exists( $server_id, $edgDBServerType ) ) || |
139 | 142 | ( ! array_key_exists( $server_id, $edgDBServer ) ) || |
140 | 143 | ( ! array_key_exists( $server_id, $edgDBName ) ) || |
— | — | @@ -149,7 +152,19 @@ |
150 | 153 | $db_username = $edgDBUser[$server_id]; |
151 | 154 | $db_password = $edgDBPass[$server_id]; |
152 | 155 | |
153 | | - // DatabaseBase::newFromType() was added in MW 1.18 |
| 156 | + // Optional parameters |
| 157 | + if ( array_key_exists( $server_id, $edgDBFlags ) ) { |
| 158 | + $db_flags = $edgDBFlags[$server_id]; |
| 159 | + } else { |
| 160 | + $db_flags = DBO_DEFAULT; |
| 161 | + } |
| 162 | + if ( array_key_exists( $server_id, $edgDBTablePrefix ) ) { |
| 163 | + $db_tableprefix = $edgDBTablePrefix[$server_id]; |
| 164 | + } else { |
| 165 | + $db_tableprefix = ''; |
| 166 | + } |
| 167 | + |
| 168 | + // DatabaseBase::newFromType() was added in MW 1.17 |
154 | 169 | $realFunction = array( 'DatabaseBase', 'newFromType' ); |
155 | 170 | if ( is_callable( $realFunction ) ) { |
156 | 171 | $db = DatabaseBase::newFromType( $db_type, |
— | — | @@ -158,9 +173,16 @@ |
159 | 174 | 'user' => $db_username, |
160 | 175 | 'password' => $db_password, |
161 | 176 | 'dbname' => $db_name, |
| 177 | + 'flags' => $db_flags, |
| 178 | + 'tableprefix' => $db_tableprefix, |
162 | 179 | ) |
163 | 180 | ); |
164 | 181 | } else { |
| 182 | + if ( ( $db_flags !== DBO_DEFAULT ) || ( $db_tableprefix !== '' ) ) { |
| 183 | + print wfMsg( "externaldata-db-option-unsupported", '<code>$edgDBFlags</code>', '<code>$edgDBTablePrefix</code>' ); |
| 184 | + return; |
| 185 | + } |
| 186 | + |
165 | 187 | if ( $db_type == "mysql" ) { |
166 | 188 | $db = new Database( $db_server, $db_username, $db_password, $db_name ); |
167 | 189 | } elseif ( $db_type == "postgres" ) { |