On Thu, Mar 20, 2008 at 9:10 PM, greg@svn.wikimedia.org wrote:
Log Message:
Don't attempt to insert if there are no rows.
Modified Paths:
trunk/phase3/includes/Article.php
Modified: trunk/phase3/includes/Article.php
--- trunk/phase3/includes/Article.php 2008-03-21 00:39:32 UTC (rev 32274) +++ trunk/phase3/includes/Article.php 2008-03-21 01:10:14 UTC (rev 32275) @@ -3375,7 +3375,8 @@ foreach( $insertCats as $cat ) { $insertRows[] = array( 'cat_title' => $cat ); }
$dbw->insert( 'category', $insertRows, __METHOD__, 'IGNORE' );
if ( count( $insertRows ) )
$dbw->insert( 'category', $insertRows, __METHOD__, 'IGNORE' );
How could there be no rows at this point? The few lines before this are:
$insertCats = array_merge( $added, $deleted ); if( !$insertCats ) { # Okay, nothing to do return; } $insertRows = array();
$insertRows is guaranteed to have one element per element of $insertCats, and if $insertCats is empty, we've already returned.
Note that it was only today or last night or so that I added the check on $insertCats, though, so if you were seeing problems maybe it's because you didn't svn up recently enough.
On Thu, 20 Mar 2008 21:54:27 -0400 Simetrical Simetrical+wikilist@gmail.com wrote:
Note that it was only today or last night or so that I added the check on $insertCats, though, so if you were seeing problems maybe it's because you didn't svn up recently enough.
Heh, that was it. I was looking at a copy from 11 this morning, you made the change at 12:30. :) Reverted, thanks for the catch.
wikitech-l@lists.wikimedia.org