From c3fe33524131d0fb672157cfb91c0d7bd085c469 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 3 Dec 2003 12:02:53 +0000 Subject: [PATCH] Quick hack to clear out brokenlinks to existing pages (doesn't yet add them to links) --- maintenance/remove-brokenlinks.php | 71 ++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 maintenance/remove-brokenlinks.php diff --git a/maintenance/remove-brokenlinks.php b/maintenance/remove-brokenlinks.php new file mode 100644 index 0000000000..2023318e97 --- /dev/null +++ b/maintenance/remove-brokenlinks.php @@ -0,0 +1,71 @@ +cur_namespace, $s->cur_title ); + if($title) { + $t = $title->getPrefixedDBKey(); + $tt = wfStrencode( $t ); + $any = false; + $sql2 = "SELECT bl_from,cur_id,cur_namespace,cur_title FROM brokenlinks,cur WHERE bl_to='$tt' AND cur_id=bl_from"; + $res2 = wfQuery( $sql2, DB_WRITE ); + while( $s = wfFetchObject( $res2 ) ) { + $from = Title::makeTitle( $s->cur_namespace, $s->cur_title ); + $xt = $from->getPrefixedText(); + echo "Found bad brokenlink to [[$tt]] from page #$s->cur_id [[$xt]]!\n"; + $any = true; + } + wfFreeResult( $res2 ); + if($any) { + echo "Removing brokenlinks to [[$t]]...\n"; + $sql3 = "DELETE FROM brokenlinks WHERE bl_to='$tt'"; + #$res3 = wfQuery( $sql3, DB_WRITE ); + echo "-- $sql3\n"; + } + } else { + echo "Illegal title?! Namespace $s->cur_namespace, title '$s->cur_title'\n"; + } +} +echo "Done at $n.\n\n"; + +echo "Clearing linkscc table...\n"; +$sql4 = "DELETE FROM linkscc"; +wfQuery( $sql4, DB_WRITE ); + +?> -- 2.20.1