r25075 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25074‎ | r25075 | r25076 >
Date:21:52, 22 August 2007
Author:brion
Status:old
Tags:
Comment:
Revert r25037 -- just removes functionality from Special:DoubleRedirects instead of fixing the paging problem
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/SpecialDoubleRedirects.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialDoubleRedirects.php
@@ -22,29 +22,37 @@
2323 return wfMsgExt( 'doubleredirectstext', array( 'parse' ) );
2424 }
2525
26 - function getSql() {
27 - $dbr = wfGetDB( DB_SLAVE );
 26+ function getSQLText( &$dbr, $namespace = null, $title = null ) {
 27+
2828 list( $page, $redirect ) = $dbr->tableNamesN( 'page', 'redirect' );
29 - return "
30 - SELECT
31 - 'DoubleRedirects' as type,
32 - pa.page_namespace as namespace, pa.page_title as title,
33 - pb.page_namespace as nsb, pb.page_title as tb,
34 - pc.page_namespace as nsc, pc.page_title as tc
35 - FROM
36 - $redirect AS ra,
37 - $redirect AS rb,
38 - $page AS pa,
39 - $page AS pb,
40 - $page AS pc
41 - WHERE
42 - ra.rd_from = pa.page_id
43 - AND ra.rd_namespace = pb.page_namespace
44 - AND ra.rd_title = pb.page_title
45 - AND rb.rd_from = pb.page_id
46 - AND rb.rd_namespace = pc.page_namespace
47 - AND rb.rd_title = pc.page_title";
 29+
 30+ $limitToTitle = !( $namespace === null && $title === null );
 31+ $sql = $limitToTitle ? "SELECT" : "SELECT 'DoubleRedirects' as type," ;
 32+ $sql .=
 33+ " pa.page_namespace as namespace, pa.page_title as title," .
 34+ " pb.page_namespace as nsb, pb.page_title as tb," .
 35+ " pc.page_namespace as nsc, pc.page_title as tc" .
 36+ " FROM $redirect AS ra, $redirect AS rb, $page AS pa, $page AS pb, $page AS pc" .
 37+ " WHERE ra.rd_from=pa.page_id" .
 38+ " AND ra.rd_namespace=pb.page_namespace" .
 39+ " AND ra.rd_title=pb.page_title" .
 40+ " AND rb.rd_from=pb.page_id" .
 41+ " AND rb.rd_namespace=pc.page_namespace" .
 42+ " AND rb.rd_title=pc.page_title";
 43+
 44+ if( $limitToTitle ) {
 45+ $encTitle = $dbr->addQuotes( $title );
 46+ $sql .= " AND pa.page_namespace=$namespace" .
 47+ " AND pa.page_title=$encTitle";
 48+ }
 49+
 50+ return $sql;
4851 }
 52+
 53+ function getSQL() {
 54+ $dbr = wfGetDB( DB_SLAVE );
 55+ return $this->getSQLText( $dbr );
 56+ }
4957
5058 function getOrder() {
5159 return '';
@@ -52,30 +60,33 @@
5361
5462 function formatResult( $skin, $result ) {
5563 global $wgContLang;
56 - $parts = array();
5764
 65+ $fname = 'DoubleRedirectsPage::formatResult';
5866 $titleA = Title::makeTitle( $result->namespace, $result->title );
59 - $parts[] = $skin->makeKnownLinkObj( $titleA, '', 'redirect=no' );
60 - $parts[] = '(' . $skin->makeKnownLinkObj(
61 - $titleA,
62 - wfMsgHtml( 'qbedit' ),
63 - 'action=edit&redirect=no'
64 - ) . ')';
65 -
66 - // If the report isn't cached, generate some useful additional
67 - // links to the target page, and *that* page's redirect target
68 - if( isset( $result->nsb ) ) {
69 - $parts[] = $wgContLang->getArrow() . $wgContLang->getDirMark();
70 - $parts[] = $skin->makeKnownLinkObj(
71 - Title::makeTitle( $result->nsb, $result->tb ),
72 - '',
73 - 'redirect=no'
74 - );
75 - $parts[] = $wgContLang->getArrow() . $wgContLang->getDirMark();
76 - $parts[] = $skin->makeKnownLinkObj( Title::makeTitle( $result->nsc, $result->tc ) );
 67+
 68+ if ( $result && !isset( $result->nsb ) ) {
 69+ $dbr = wfGetDB( DB_SLAVE );
 70+ $sql = $this->getSQLText( $dbr, $result->namespace, $result->title );
 71+ $res = $dbr->query( $sql, $fname );
 72+ if ( $res ) {
 73+ $result = $dbr->fetchObject( $res );
 74+ $dbr->freeResult( $res );
 75+ }
7776 }
 77+ if ( !$result ) {
 78+ return '';
 79+ }
7880
79 - return implode( ' ', $parts );
 81+ $titleB = Title::makeTitle( $result->nsb, $result->tb );
 82+ $titleC = Title::makeTitle( $result->nsc, $result->tc );
 83+
 84+ $linkA = $skin->makeKnownLinkObj( $titleA,'', 'redirect=no' );
 85+ $edit = $skin->makeBrokenLinkObj( $titleA, "(".wfMsg("qbedit").")" , 'redirect=no');
 86+ $linkB = $skin->makeKnownLinkObj( $titleB, '', 'redirect=no' );
 87+ $linkC = $skin->makeKnownLinkObj( $titleC );
 88+ $arr = $wgContLang->getArrow() . $wgContLang->getDirMark();
 89+
 90+ return( "{$linkA} {$edit} {$arr} {$linkB} {$arr} {$linkC}" );
8091 }
8192 }
8293
@@ -84,6 +95,10 @@
8596 */
8697 function wfSpecialDoubleRedirects() {
8798 list( $limit, $offset ) = wfCheckLimits();
 99+
88100 $sdr = new DoubleRedirectsPage();
 101+
89102 return $sdr->doQuery( $offset, $limit );
90 -}
\ No newline at end of file
 103+
 104+}
 105+
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1572,7 +1572,7 @@
15731573
15741574 'doubleredirects' => 'Double redirects',
15751575 'doubleredirects-summary' => '', # only translate this message to other languages if you have to change it
1576 -'doubleredirectstext' => 'The following redirects link to other redirect pages:',
 1576+'doubleredirectstext' => 'Each row contains links to the first and second redirect, as well as the target of the second redirect, which is usually "real" target page, which the first redirect should point to.',
15771577
15781578 'brokenredirects' => 'Broken redirects',
15791579 'brokenredirects-summary' => '', # only translate this message to other languages if you have to change it
Index: trunk/phase3/RELEASE-NOTES
@@ -400,8 +400,6 @@
401401 lost and transparent pixels to be turned black
402402 * (bug 9339) General error pages were transforming messages and their parameters
403403 in the wrong order
404 -* (bug 10985) Special:DoubleRedirects was omitting "fixed" results when cached,
405 - leading to inconsistent paging behaviour
406404 * (bug 9026) Incorrect heading numbering when viewing Special:Statistics with
407405 "auto-numbered headings" enabled
408406 * Fixed invalid XHTML in Special:Upload

Follow-up revisions

RevisionCommit summaryAuthorDate
r25109Merged revisions 25016-25108 via svnmerge from...david07:30, 24 August 2007

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r25037(bug 10985) Special:DoubleRedirects was omitting "fixed" results when cached,...robchurch07:08, 22 August 2007

Status & tagging log