Index: trunk/phase3/includes/Article.php |
— | — | @@ -3372,31 +3372,35 @@ |
3373 | 3373 | $insertCats = array_merge( $added, $deleted ); |
3374 | 3374 | $insertRows = array(); |
3375 | 3375 | foreach( $insertCats as $cat ) { |
3376 | | - $insertRows []= array( 'cat_title' => $cat ); |
| 3376 | + $insertRows[] = array( 'cat_title' => $cat ); |
3377 | 3377 | } |
3378 | 3378 | $dbw->insert( 'category', $insertRows, __METHOD__, 'IGNORE' ); |
3379 | 3379 | |
3380 | 3380 | $addFields = array( 'cat_pages = cat_pages + 1' ); |
3381 | 3381 | $removeFields = array( 'cat_pages = cat_pages - 1' ); |
3382 | 3382 | if( $ns == NS_CATEGORY ) { |
3383 | | - $addFields []= 'cat_subcats = cat_subcats + 1'; |
3384 | | - $removeFields []= 'cat_subcats = cat_subcats - 1'; |
| 3383 | + $addFields[] = 'cat_subcats = cat_subcats + 1'; |
| 3384 | + $removeFields[] = 'cat_subcats = cat_subcats - 1'; |
3385 | 3385 | } elseif( $ns == NS_IMAGE ) { |
3386 | | - $addFields []= 'cat_files = cat_files + 1'; |
3387 | | - $removeFields []= 'cat_files = cat_files - 1'; |
| 3386 | + $addFields[] = 'cat_files = cat_files + 1'; |
| 3387 | + $removeFields[] = 'cat_files = cat_files - 1'; |
3388 | 3388 | } |
3389 | 3389 | |
3390 | | - $dbw->update( |
3391 | | - 'category', |
3392 | | - $addFields, |
3393 | | - array( 'cat_title' => $added ), |
3394 | | - __METHOD__ |
3395 | | - ); |
3396 | | - $dbw->update( |
3397 | | - 'category', |
3398 | | - $removeFields, |
3399 | | - array( 'cat_title' => $deleted ), |
3400 | | - __METHOD__ |
3401 | | - ); |
| 3390 | + if ( $added ) { |
| 3391 | + $dbw->update( |
| 3392 | + 'category', |
| 3393 | + $addFields, |
| 3394 | + array( 'cat_title' => $added ), |
| 3395 | + __METHOD__ |
| 3396 | + ); |
| 3397 | + } |
| 3398 | + if ( $deleted ) { |
| 3399 | + $dbw->update( |
| 3400 | + 'category', |
| 3401 | + $removeFields, |
| 3402 | + array( 'cat_title' => $deleted ), |
| 3403 | + __METHOD__ |
| 3404 | + ); |
| 3405 | + } |
3402 | 3406 | } |
3403 | 3407 | } |
Index: trunk/phase3/includes/Database.php |
— | — | @@ -1569,8 +1569,7 @@ |
1570 | 1570 | $list .= "$value"; |
1571 | 1571 | } elseif ( ($mode == LIST_AND || $mode == LIST_OR) && is_array($value) ) { |
1572 | 1572 | if( count( $value ) == 0 ) { |
1573 | | - // Empty input... or should this throw an error? |
1574 | | - $list .= '0'; |
| 1573 | + throw new MWException( __METHOD__.': empty input' ); |
1575 | 1574 | } elseif( count( $value ) == 1 ) { |
1576 | 1575 | // Special-case single values, as IN isn't terribly efficient |
1577 | 1576 | $list .= $field." = ".$this->addQuotes( $value[0] ); |