From af0ecb6b292e92c8fd6a879f571347e273c7ce82 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 7 Dec 2003 01:59:32 +0000 Subject: [PATCH] Fix namespace bug resulting in serious data corruption; dump an obsolete global, fix display of complaint message --- maintenance/rebuildlinks.inc | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/maintenance/rebuildlinks.inc b/maintenance/rebuildlinks.inc index 7db35a284f..cf532cc946 100644 --- a/maintenance/rebuildlinks.inc +++ b/maintenance/rebuildlinks.inc @@ -5,9 +5,6 @@ # See rebuildlinks.php, for example. # -# Turn this on if you've got memory to burn -$wgUseMemoryTables = false; - # Buffer this many rows before inserting them all in one sweep. More # than about 1000 will probably not increase speed significantly on # most setups. @@ -16,7 +13,7 @@ $wgUseMemoryTables = false; function rebuildLinkTables() { error_reporting (E_ALL); - global $wgLang, $wgUseMemoryTables, $wgLinkCache, $rowbuf_size; + global $wgLang, $wgLinkCache, $rowbuf_size; print "This script may take several hours to complete. If you abort during that time,\n"; print "your wiki will be in an inconsistent state. If you are going to abort, this is\n"; @@ -123,7 +120,7 @@ function rebuildLinkTables() } else { $nt = Title::newFromText( $link ); if (! $nt) { - print "\nInvalid link in page '$ns:{$from_full_title}': '$link'\n"; + print "\nInvalid link in page '{$from_full_title}': '$link'\n"; continue; } @@ -148,7 +145,7 @@ function rebuildLinkTables() $nt->mArticleID = 0; // assume broken link until proven otherwise $pos = array_push($titles_needing_curdata, $nt) - 1; - $titles_needing_curdata_pos[$nt->getDBkey()] = $pos; + $titles_needing_curdata_pos[$nt->getDBkey() . $nt->getNamespace()] = $pos; $links_corresponding_to_titles[] = $link; unset( $link ); // useless outside this loop, but tempting } @@ -161,10 +158,10 @@ function rebuildLinkTables() $parts[] = " (cur_namespace = " . $nt->getNamespace() . " AND " . "cur_title='" . wfStrencode( $nt->getDBkey() ) . "')"; } - $sql = "SELECT cur_title, cur_id FROM cur WHERE " . implode(" OR ", $parts); + $sql = "SELECT cur_namespace, cur_title, cur_id FROM cur WHERE " . implode(" OR ", $parts); $res = wfQuery( $sql, DB_WRITE ); while($row = wfFetchObject( $res ) ){ - $pos = $titles_needing_curdata_pos[$row->cur_title]; + $pos = $titles_needing_curdata_pos[$row->cur_title . $row->cur_namespace]; $titles_needing_curdata[$pos]->mArticleID = intval($row->cur_id); } for( $k = 0; $k < count( $titles_needing_curdata ) ; $k++) { -- 2.20.1