Revision: 45970
Author: werdna
Date: 2009-01-21 19:55:13 +0000 (Wed, 21 Jan 2009)
Log Message:
-----------
Fix weird problem where the REPLACE would get false positives on INSERT --
inserting 0 instead of NULL into fields.
Use an INSERT IGNORE for extrar safety.
Modified Paths:
--------------
branches/change-tagging/phase3/includes/ChangeTags.php
Modified: branches/change-tagging/phase3/includes/ChangeTags.php
===================================================================
--- branches/change-tagging/phase3/includes/ChangeTags.php 2009-01-21
19:54:55 UTC (rev 45969)
+++ branches/change-tagging/phase3/includes/ChangeTags.php 2009-01-21
19:55:13 UTC (rev 45970)
@@ -68,11 +68,11 @@
// Insert the tags rows.
$tagsRows = array();
- foreach( $tags as $tag ) {
- $tagsRows[] = array( 'ct_tag' => $tag, 'ct_rc_id' =>
$rc_id, 'ct_log_id' => $log_id, 'ct_rev_id' => $rev_id, 'ct_params' => $params
);
+ foreach( $tags as $tag ) { // Filter so we don't insert NULLs
as zero accidentally.
+ $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 ) );
}
- $dbw->replace( 'change_tag', array( array( 'ct_tag',
'ct_rc_id', 'ct_rev_id', 'ct_log_id' ) ), $tagsRows, __METHOD__ );
+ $dbw->insert( 'change_tag', array( array( 'ct_tag', 'ct_rc_id',
'ct_rev_id', 'ct_log_id' ) ), $tagsRows, __METHOD__, array('IGNORE') );
return true;
}
@@ -111,7 +111,7 @@
// Add an INNER JOIN on change_tag
$tables[] = 'change_tag';
- $join_conds['change_tag'] = array( 'RIGHT JOIN',
"ct_$join_cond=$join_cond" );
+ $join_conds['change_tag'] = array( 'INNER JOIN',
"ct_$join_cond=$join_cond" );
$conds['ct_tag'] = $filter_tag;
}
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs