From eebe7e3ef58635e18d08bc6ee9b2c53d57370112 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sun, 15 Aug 2004 19:54:15 +0000 Subject: [PATCH] Migrate doubleredirect and brokenredirect subpages from SpecialMaintenance.php to their own SpecialXX.php scripts. TODO: do not die when a user access the old page but relocate instead --- includes/SpecialBrokenRedirects.php | 51 ++++++++++++++++ includes/SpecialDoubleRedirects.php | 55 +++++++++++++++++ includes/SpecialMaintenance.php | 92 ++++------------------------- includes/SpecialPage.php | 3 + 4 files changed, 120 insertions(+), 81 deletions(-) create mode 100644 includes/SpecialBrokenRedirects.php create mode 100644 includes/SpecialDoubleRedirects.php diff --git a/includes/SpecialBrokenRedirects.php b/includes/SpecialBrokenRedirects.php new file mode 100644 index 0000000000..42bba16900 --- /dev/null +++ b/includes/SpecialBrokenRedirects.php @@ -0,0 +1,51 @@ +'.wfMsg('brokenredirectstext')."


\n"; + } + + function getSQL() { + $dbr =& wfGetDB( DB_SLAVE ); + extract( $dbr->tableNames( 'cur', 'brokenlinks' ) ); + + $sql = "SELECT bl_to,cur_title FROM $brokenlinks,$cur " . + "WHERE cur_is_redirect=1 AND cur_namespace=0 AND bl_from=cur_id "; + return $sql; + } + + function getOrder() { + return ''; + } + + function formatResult( $skin, $result ) { + global $wgLang ; + + $ns = $wgLang->getNamespaces() ; + $from = $skin->makeKnownLink( $result->cur_title ,'', 'redirect=no' ); + $edit = $skin->makeBrokenLink( $result->cur_title , "(".wfMsg("qbedit").")" , 'redirect=no'); + $to = $skin->makeBrokenLink( $result->bl_to ); + + return "$from $edit => $to"; + } +} + +function wfSpecialBrokenRedirects() { + list( $limit, $offset ) = wfCheckLimits(); + + $sbr = new BrokenRedirectsPage(); + + return $sbr->doQuery( $offset, $limit ); + +} +?> diff --git a/includes/SpecialDoubleRedirects.php b/includes/SpecialDoubleRedirects.php new file mode 100644 index 0000000000..1c98a05b60 --- /dev/null +++ b/includes/SpecialDoubleRedirects.php @@ -0,0 +1,55 @@ +'.wfMsg("doubleredirectstext")."


\n"; + } + + function getSQL() { + $dbr =& wfGetDB( DB_SLAVE ); + extract( $dbr->tableNames( 'cur', 'links' ) ); + + $sql = "SELECT ca.cur_namespace as ns_a, ca.cur_title as title_a," . + " cb.cur_namespace as ns_b, cb.cur_title as title_b," . + " cb.cur_text AS rt " . + "FROM $links,$cur AS ca,$cur AS cb ". + "WHERE ca.cur_is_redirect=1 AND cb.cur_is_redirect=1 AND l_to=cb.cur_id " . + " AND l_from=ca.cur_id " ; + return $sql; + } + + function getOrder() { + return ''; + } + + function formatResult( $skin, $result ) { + global $wgLang ; + $ns = $wgLang->getNamespaces() ; + $from = $skin->makeKnownLink( $ns[$result->ns_a].':'.$result->title_a ,'', 'redirect=no' ); + $edit = $skin->makeBrokenLink( $ns[$result->ns_a].':'.$result->title_a , "(".wfMsg("qbedit").")" , 'redirect=no'); + $to = $skin->makeKnownLink( $ns[$result->ns_b].':'.$result->title_b ,''); + $content = $result->rt; + + return "$from $edit => $to ($content)"; + } +} + +function wfSpecialDoubleRedirects() { + list( $limit, $offset ) = wfCheckLimits(); + + $sdr = new DoubleRedirectsPage(); + + return $sdr->doQuery( $offset, $limit ); + +} +?> diff --git a/includes/SpecialMaintenance.php b/includes/SpecialMaintenance.php index 44d24cbed9..a9a5cc16db 100644 --- a/includes/SpecialMaintenance.php +++ b/includes/SpecialMaintenance.php @@ -31,8 +31,11 @@ function wfSpecialMaintenance( $par=NULL ) { # Call the subfunction requested by the user switch( $subfunction ) { case 'disambiguations': return wfSpecialDisambiguations() ; break; + + # doubleredirects & brokenredirects are old maintenance subpages. case 'doubleredirects': return wfSpecialDoubleRedirects() ; break; case 'brokenredirects': return wfSpecialBrokenRedirects() ; break; + case 'selflinks': return wfSpecialSelfLinks() ; break; case 'mispeelings': return wfSpecialMispeelings() ; break; case 'missinglanguagelinks': return wfSpecialMissingLanguageLinks() ; break; @@ -50,8 +53,8 @@ function wfSpecialMaintenance( $par=NULL ) { # Links to subfunctions $r .= "