Index: trunk/extensions/LocalisationUpdate/LocalisationUpdate.class.php |
— | — | @@ -307,10 +307,11 @@ |
308 | 308 | // If this message wasn't changed in english |
309 | 309 | if ( !array_key_exists( $key , $forbiddenKeys ) ) { |
310 | 310 | // See if we can update the database |
| 311 | + |
311 | 312 | $values = array( 'lo_value' => $base_messages[$key] ); |
312 | 313 | $conds = array( 'lo_language' => $langcode, 'lo_key' => $key ); |
313 | | - $db->update( 'localisation', $values, $conds, __METHOD__ ); |
314 | | - if ( $db->affectedRows() == 0 ) { // Otherwise do a new insert |
| 314 | + $result = $db->select( 'localisation', 'lo_value', $conds, __METHOD__ ); |
| 315 | + if($db->numRows($result) == 0) { |
315 | 316 | $inserts = array( |
316 | 317 | 'lo_value' => $base_messages[$key], |
317 | 318 | 'lo_language' => $langcode, |
— | — | @@ -320,6 +321,11 @@ |
321 | 322 | if ( $db->affectedRows() == 0 ) { |
322 | 323 | throw new MWException( "An error has occured while inserting a new message into the database!" ); |
323 | 324 | } |
| 325 | + } else { |
| 326 | + $db->update( 'localisation', $values, $conds, __METHOD__ ); |
| 327 | + if ( $db->affectedRows() == 0 ) { |
| 328 | + throw new MWException( "An error has occured while updateing a message in the database!" ); |
| 329 | + } |
324 | 330 | } |
325 | 331 | |
326 | 332 | // Output extra logmessages when needed |