$this->addBadLink( $s->bl_to );
}
- wfDebug("preFill dbkeyfrom=$dbkeyfrom\n");
$this->mOldBadLinks = $this->mBadLinks;
$this->mOldGoodLinks = $this->mGoodLinks;
$this->mPreFilled = true;
default: # LINKCACHE_IMAGE
return false;
}
- wfDebug( "which = $which\n" );
- wfDebug( '$old = ' . implode(", ", $old) . "\n" );
- wfDebug( '$cur = ' . implode(", ", $cur) . "\n" );
- wfDebug( '$del = ' . implode(", ", $del) . "\n" );
- wfDebug( '$add = ' . implode(", ", $add) . "\n" );
-
- # Coefficients here (1,1,3,1) could probably be put in a global object
- $timeDumb = count( $old ) + count( $cur );
- $timeIncr = count( $del ) * 3 + count( $new );
- return $timeIncr < $timeDumb;
+ return true;
}
# Clears cache but leaves old preFill copies alone
if ( $wgLinkCache->incrementalSetup( LINKCACHE_GOOD, $del, $add ) ) {
# Delete where necessary
- $baseSql = "DELETE FROM links WHERE l_from='{$this->mTitleEnc}'";
- foreach ($del as $title => $id ) {
- wfDebug( "Incremental deletion from {$this->mTitleEnc} to $title\n" );
- $sql = $baseSql . " AND l_to={$id}";
+ if ( count( $del ) ) {
+ $sql = "DELETE FROM links WHERE l_from='{$this->mTitleEnc}' AND l_to IN(".
+ implode( ",", $del ) . ")";
wfQuery( $sql, $fname );
}
} else {
# Delete everything
- wfDebug( "Complete deletion from {$this->mTitleEnc}\n" );
$sql = "DELETE FROM links WHERE l_from='{$this->mTitleEnc}'";
wfQuery( $sql, $fname );
$sql = "INSERT INTO links (l_from,l_to) VALUES ";
$first = true;
foreach( $add as $lt => $lid ) {
- wfDebug( "Inserting from {$this->mTitleEnc} to $lt\n" );
if ( ! $first ) { $sql .= ","; }
$first = false;
$sql .= "('{$this->mTitleEnc}',{$lid})";
}
}
- if ( "" != $sql ) { wfQuery( $sql, $fname ); }
+ if ( "" != $sql ) {
+ wfQuery( $sql, $fname );
+ }
#------------------------------------------------------------------------------
# Bad links
if ( $wgLinkCache->incrementalSetup( LINKCACHE_BAD, $del, $add ) ) {
# Delete where necessary
- $baseSql = "DELETE FROM brokenlinks WHERE bl_from={$this->mId}";
- foreach ( $del as $title ) {
- $sql = $baseSql . " AND bl_to={$title}";
+ if ( count( $del ) ) {
+ $sql = "DELETE FROM brokenlinks WHERE bl_from={$this->mId} AND bl_to IN('" .
+ implode( "','", $del ) . "')";
wfQuery( $sql, $fname );
}
} else {
$sql .= "({$this->mId},'{$blt}')";
}
}
- if ( "" != $sql ) { wfQuery( $sql, $fname ); }
+ if ( "" != $sql ) {
+ wfQuery( $sql, $fname );
+ }
#------------------------------------------------------------------------------
# Image links
- if ( $wgLinkCache->incrementalSetup( LINKCACHE_IMAGE, $del, $add ) ) {
- # Delete where necessary
- $sql = "DELETE FROM imagelinks WHERE il_from='{$this->mTitleEnc}'";
- foreach ($del as $title ) {
- $sql = $baseSql . " AND il_to={$title}";
- wfQuery( $sql, $fname );
- }
- } else {
- # Delete all
- $sql = "DELETE FROM imagelinks WHERE il_from='{$this->mTitleEnc}'";
- wfQuery( $sql, $fname );
-
- # Get addition list
- $add = $wgLinkCache->getImageLinks();
- }
+ $sql = "DELETE FROM imagelinks WHERE il_from='{$this->mTitleEnc}'";
+ wfQuery( $sql, $fname );
+
+ # Get addition list
+ $add = $wgLinkCache->getImageLinks();
# Do the insertion
$sql = "";