From 311abeb720ed7661c67bd7bd7da0624af298d220 Mon Sep 17 00:00:00 2001 From: Rotem Liss Date: Fri, 14 Sep 2007 04:21:36 +0000 Subject: [PATCH] * (bug 7890) Special:BrokenRedirects links deleted redirects to a non-existent page ** See explanation in the bug report. * Adding some TODO notes: current implementation of Special:BrokenRedirects caching can be improved. --- RELEASE-NOTES | 1 + includes/SpecialBrokenRedirects.php | 2 +- includes/Title.php | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index bf66d9c6c7..295cf7ad8c 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -49,6 +49,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 4021) Fix for MySQL wildcard search * (bug 10699) Fix for MySQL phrase search * (bug 11321) Fix width of gallerybox when option "width=xxx" is used +* (bug 7890) Special:BrokenRedirects links deleted redirects to a non-existent page === API changes in 1.12 === diff --git a/includes/SpecialBrokenRedirects.php b/includes/SpecialBrokenRedirects.php index 1fb48350c6..f68877411c 100644 --- a/includes/SpecialBrokenRedirects.php +++ b/includes/SpecialBrokenRedirects.php @@ -51,7 +51,7 @@ class BrokenRedirectsPage extends PageQueryPage { if ( isset( $result->rd_title ) ) { $toObj = Title::makeTitle( $result->rd_namespace, $result->rd_title ); } else { - $blinks = $fromObj->getBrokenLinksFrom(); + $blinks = $fromObj->getBrokenLinksFrom(); # TODO: check for redirect, not for links if ( $blinks ) { $toObj = $blinks[0]; } else { diff --git a/includes/Title.php b/includes/Title.php index 7fc3e944a6..dc4a763cf3 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2034,10 +2034,16 @@ class Title { /** * Get an array of Title objects referring to non-existent articles linked from this page * + * @todo check if needed (used only in SpecialBrokenRedirects.php, and should use redirect table in this case) * @param string $options may be FOR UPDATE * @return array the Title objects */ public function getBrokenLinksFrom( $options = '' ) { + if ( $this->getArticleId() == 0 ) { + # All links from article ID 0 are false positives + return array(); + } + if ( $options ) { $db = wfGetDB( DB_MASTER ); } else { -- 2.20.1