Index: trunk/extensions/ExternalData/ED_ParserFunctions.php |
— | — | @@ -215,7 +215,12 @@ |
216 | 216 | array_shift( $params ); // we already know the $parser ... |
217 | 217 | $args = EDUtils::parseParams( $params ); // parse params into name-value pairs |
218 | 218 | $data = ( array_key_exists( 'data', $args ) ) ? $args['data'] : null; |
219 | | - $server = ( array_key_exists( 'server', $args ) ) ? $args['server'] : null; |
| 219 | + $dbID = ( array_key_exists( 'db', $args ) ) ? $args['db'] : null; |
| 220 | + // For backwards-compatibility - 'db' parameter was added |
| 221 | + // in External Data version 1.3. |
| 222 | + if ( is_null( $dbID ) ) { |
| 223 | + $dbID = ( array_key_exists( 'server', $args ) ) ? $args['server'] : null; |
| 224 | + } |
220 | 225 | $table = ( array_key_exists( 'from', $args ) ) ? $args['from'] : null; |
221 | 226 | $conds = ( array_key_exists( 'where', $args ) ) ? $args['where'] : null; |
222 | 227 | $limit = ( array_key_exists( 'limit', $args ) ) ? $args['limit'] : null; |
— | — | @@ -223,7 +228,7 @@ |
224 | 229 | $options = array( 'LIMIT' => $limit, 'ORDER BY' => $orderBy ); |
225 | 230 | $mappings = EDUtils::paramToArray( $data ); // parse the data arg into mappings |
226 | 231 | |
227 | | - $external_values = EDUtils::getDBData( $server, $table, array_values( $mappings ), $conds, $options ); |
| 232 | + $external_values = EDUtils::getDBData( $dbID, $table, array_values( $mappings ), $conds, $options ); |
228 | 233 | // handle error cases |
229 | 234 | if ( is_null( $external_values ) ) |
230 | 235 | return; |
Index: trunk/extensions/ExternalData/ED_Utils.php |
— | — | @@ -141,7 +141,7 @@ |
142 | 142 | return $results; |
143 | 143 | } |
144 | 144 | |
145 | | - static function getDBData( $server_id, $from, $columns, $where, $options ) { |
| 145 | + static function getDBData( $dbID, $from, $columns, $where, $options ) { |
146 | 146 | global $edgDBServerType; |
147 | 147 | global $edgDBServer; |
148 | 148 | global $edgDBName; |
— | — | @@ -151,29 +151,29 @@ |
152 | 152 | global $edgDBTablePrefix; |
153 | 153 | |
154 | 154 | // Mandatory parameters |
155 | | - if ( ( ! array_key_exists( $server_id, $edgDBServerType ) ) || |
156 | | - ( ! array_key_exists( $server_id, $edgDBServer ) ) || |
157 | | - ( ! array_key_exists( $server_id, $edgDBName ) ) || |
158 | | - ( ! array_key_exists( $server_id, $edgDBUser ) ) || |
159 | | - ( ! array_key_exists( $server_id, $edgDBPass ) ) ) { |
| 155 | + if ( ( ! array_key_exists( $dbID, $edgDBServerType ) ) || |
| 156 | + ( ! array_key_exists( $dbID, $edgDBServer ) ) || |
| 157 | + ( ! array_key_exists( $dbID, $edgDBName ) ) || |
| 158 | + ( ! array_key_exists( $dbID, $edgDBUser ) ) || |
| 159 | + ( ! array_key_exists( $dbID, $edgDBPass ) ) ) { |
160 | 160 | echo ( wfMsgExt( "externaldata-db-incomplete-information", array( 'parse', 'escape' ) ) ); |
161 | 161 | return; |
162 | 162 | } |
163 | 163 | |
164 | | - $db_type = $edgDBServerType[$server_id]; |
165 | | - $db_server = $edgDBServer[$server_id]; |
166 | | - $db_name = $edgDBName[$server_id]; |
167 | | - $db_username = $edgDBUser[$server_id]; |
168 | | - $db_password = $edgDBPass[$server_id]; |
| 164 | + $db_type = $edgDBServerType[$dbID]; |
| 165 | + $db_server = $edgDBServer[$dbID]; |
| 166 | + $db_name = $edgDBName[$dbID]; |
| 167 | + $db_username = $edgDBUser[$dbID]; |
| 168 | + $db_password = $edgDBPass[$dbID]; |
169 | 169 | |
170 | 170 | // Optional parameters |
171 | | - if ( array_key_exists( $server_id, $edgDBFlags ) ) { |
172 | | - $db_flags = $edgDBFlags[$server_id]; |
| 171 | + if ( array_key_exists( $dbID, $edgDBFlags ) ) { |
| 172 | + $db_flags = $edgDBFlags[$dbID]; |
173 | 173 | } else { |
174 | 174 | $db_flags = DBO_DEFAULT; |
175 | 175 | } |
176 | | - if ( array_key_exists( $server_id, $edgDBTablePrefix ) ) { |
177 | | - $db_tableprefix = $edgDBTablePrefix[$server_id]; |
| 176 | + if ( array_key_exists( $dbID, $edgDBTablePrefix ) ) { |
| 177 | + $db_tableprefix = $edgDBTablePrefix[$dbID]; |
178 | 178 | } else { |
179 | 179 | $db_tableprefix = ''; |
180 | 180 | } |