Index: branches/change-tagging/phase3/includes/ChangeTags.php |
— | — | @@ -68,11 +68,11 @@ |
69 | 69 | |
70 | 70 | // Insert the tags rows. |
71 | 71 | $tagsRows = array(); |
72 | | - foreach( $tags as $tag ) { |
73 | | - $tagsRows[] = array( 'ct_tag' => $tag, 'ct_rc_id' => $rc_id, 'ct_log_id' => $log_id, 'ct_rev_id' => $rev_id, 'ct_params' => $params ); |
| 72 | + foreach( $tags as $tag ) { // Filter so we don't insert NULLs as zero accidentally. |
| 73 | + $tagsRows[] = array_filter( array( 'ct_tag' => $tag, 'ct_rc_id' => $rc_id, 'ct_log_id' => $log_id, 'ct_rev_id' => $rev_id, 'ct_params' => $params ) ); |
74 | 74 | } |
75 | 75 | |
76 | | - $dbw->replace( 'change_tag', array( array( 'ct_tag', 'ct_rc_id', 'ct_rev_id', 'ct_log_id' ) ), $tagsRows, __METHOD__ ); |
| 76 | + $dbw->insert( 'change_tag', array( array( 'ct_tag', 'ct_rc_id', 'ct_rev_id', 'ct_log_id' ) ), $tagsRows, __METHOD__, array('IGNORE') ); |
77 | 77 | |
78 | 78 | return true; |
79 | 79 | } |
— | — | @@ -111,7 +111,7 @@ |
112 | 112 | // Add an INNER JOIN on change_tag |
113 | 113 | |
114 | 114 | $tables[] = 'change_tag'; |
115 | | - $join_conds['change_tag'] = array( 'RIGHT JOIN', "ct_$join_cond=$join_cond" ); |
| 115 | + $join_conds['change_tag'] = array( 'INNER JOIN', "ct_$join_cond=$join_cond" ); |
116 | 116 | $conds['ct_tag'] = $filter_tag; |
117 | 117 | } |
118 | 118 | } |