r65315 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65314‎ | r65315 | r65316 >
Date:14:07, 20 April 2010
Author:reedy
Status:deferred
Tags:
Comment:
querypage-work2: merge r49599 from querypage-work
Modified paths:
  • /branches/querypage-work2 (modified) (history)
  • /branches/querypage-work2/phase3 (modified) (history)
  • /branches/querypage-work2/phase3/includes (modified) (history)
  • /branches/querypage-work2/phase3/includes/ChangesList.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/ConfEditor.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/OutputPage.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/api (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialBrokenRedirects.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialDeadendpages.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialDisambiguations.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/cleanupTable.inc (modified) (history)
  • /branches/querypage-work2/phase3/skins/common/jquery.js (modified) (history)
  • /branches/querypage-work2/phase3/skins/common/jquery.min.js (modified) (history)

Diff [purge]

Property changes on: branches/querypage-work2/phase3/maintenance/cleanupTable.inc
___________________________________________________________________
Name: svn:mergeinfo
11 - /branches/REL1_15/phase3/maintenance/cleanupTable.inc:51646
/branches/querypage-work/phase3/maintenance/cleanupTable.inc:49084,49528
/branches/wmf-deployment/maintenance/cleanupTable.inc:56715
22 + /branches/REL1_15/phase3/maintenance/cleanupTable.inc:51646
/branches/querypage-work/phase3/maintenance/cleanupTable.inc:49084,49528,49599
/branches/wmf-deployment/maintenance/cleanupTable.inc:56715
Property changes on: branches/querypage-work2/phase3/skins/common/jquery.js
___________________________________________________________________
Name: svn:mergeinfo
33 - /branches/querypage-work/phase3/skins/common/jquery.js:49084,49528
44 + /branches/querypage-work/phase3/skins/common/jquery.js:49084,49528,49599
Property changes on: branches/querypage-work2/phase3/skins/common/jquery.min.js
___________________________________________________________________
Name: svn:mergeinfo
55 - /branches/querypage-work/phase3/skins/common/jquery.min.js:49084,49528
66 + /branches/querypage-work/phase3/skins/common/jquery.min.js:49084,49528,49599
Property changes on: branches/querypage-work2/phase3/includes/OutputPage.php
___________________________________________________________________
Name: svn:mergeinfo
77 - /branches/REL1_15/phase3/includes/OutputPage.php:51646
/branches/querypage-work/phase3/includes/OutputPage.php:49084,49528
/branches/wmf-deployment/includes/OutputPage.php:53381,57468
88 + /branches/REL1_15/phase3/includes/OutputPage.php:51646
/branches/querypage-work/phase3/includes/OutputPage.php:49084,49528,49599
/branches/wmf-deployment/includes/OutputPage.php:53381,57468
Property changes on: branches/querypage-work2/phase3/includes/api
___________________________________________________________________
Name: svn:mergeinfo
99 - /branches/REL1_15/phase3/includes/api:51646
/branches/REL1_16/phase3/includes/api:63621-63636
/branches/querypage-work/phase3/includes/api:49084,49528
/branches/sqlite/includes/api:58211-58321
/branches/wmf-deployment/includes/api:53381,59952
1010 + /branches/REL1_15/phase3/includes/api:51646
/branches/REL1_16/phase3/includes/api:63621-63636
/branches/querypage-work/phase3/includes/api:49084,49528,49599
/branches/sqlite/includes/api:58211-58321
/branches/wmf-deployment/includes/api:53381,59952
Property changes on: branches/querypage-work2/phase3/includes/ChangesList.php
___________________________________________________________________
Name: svn:mergeinfo
1111 - /branches/REL1_15/phase3/includes/ChangesList.php:51646
/branches/querypage-work/phase3/includes/ChangesList.php:49084,49528
/branches/wmf-deployment/includes/ChangesList.php:53381,57589
1212 + /branches/REL1_15/phase3/includes/ChangesList.php:51646
/branches/querypage-work/phase3/includes/ChangesList.php:49084,49528,49599
/branches/wmf-deployment/includes/ChangesList.php:53381,57589
Property changes on: branches/querypage-work2/phase3/includes/ConfEditor.php
___________________________________________________________________
Name: svn:mergeinfo
1313 - /branches/querypage-work/phase3/includes/ConfEditor.php:49084,49528
1414 + /branches/querypage-work/phase3/includes/ConfEditor.php:49084,49528,49599
Index: branches/querypage-work2/phase3/includes/specials/SpecialDisambiguations.php
@@ -13,11 +13,11 @@
1414 return 'Disambiguations';
1515 }
1616
17 - function isExpensive( ) { return true; }
 17+ function isExpensive() { return true; }
1818 function isSyndicated() { return false; }
1919
2020
21 - function getPageHeader( ) {
 21+ function getPageHeader() {
2222 return wfMsgExt( 'disambiguations-text', array( 'parse' ) );
2323 }
2424
@@ -85,11 +85,70 @@
8686
8787 return $sql;
8888 }
 89+
 90+ function getQueryInfo() {
 91+ $dbr = wfGetDB( DB_SLAVE );
 92+ $dMsgText = wfMsgForContent('disambiguationspage');
 93+ $linkBatch = new LinkBatch;
8994
90 - function getOrder() {
91 - return '';
 95+ # If the text can be treated as a title, use it verbatim.
 96+ # Otherwise, pull the titles from the links table
 97+ $dp = Title::newFromText($dMsgText);
 98+ if( $dp ) {
 99+ if($dp->getNamespace() != NS_TEMPLATE) {
 100+ # FIXME we assume the disambiguation message is a template but
 101+ # the page can potentially be from another namespace :/
 102+ wfDebug("Mediawiki:disambiguationspage message does not refer to a template!\n");
 103+ }
 104+ $linkBatch->addObj( $dp );
 105+ } else {
 106+ # Get all the templates linked from the Mediawiki:Disambiguationspage
 107+ $disPageObj = Title::makeTitleSafe( NS_MEDIAWIKI, 'disambiguationspage' );
 108+ $res = $dbr->select(
 109+ array('pagelinks', 'page'),
 110+ 'pl_title',
 111+ array('page_id = pl_from', 'pl_namespace' => NS_TEMPLATE,
 112+ 'page_namespace' => $disPageObj->getNamespace(), 'page_title' => $disPageObj->getDBkey()),
 113+ __METHOD__ );
 114+
 115+ while ( $row = $dbr->fetchObject( $res ) ) {
 116+ $linkBatch->addObj( Title::makeTitle( NS_TEMPLATE, $row->pl_title ));
 117+ }
 118+
 119+ $dbr->freeResult( $res );
 120+ }
 121+ $set = $linkBatch->constructSet( 'tl', $dbr );
 122+ if( $set === false ) {
 123+ # We must always return a valid SQL query, but this way
 124+ # the DB will always quickly return an empty result
 125+ $set = 'FALSE';
 126+ wfDebug("Mediawiki:disambiguationspage message does not link to any templates!\n");
 127+ }
 128+
 129+ // FIXME: What are pagelinks and p2 doing here?
 130+ return array (
 131+ 'tables' => array( 'templatelinks', 'page AS p1', 'pagelinks', 'page AS p2' ),
 132+ 'fields' => array( "'{$this->getName()}' AS type",
 133+ 'p1.page_namespace AS namespace',
 134+ 'p1.page_title AS title',
 135+ 'pl_from AS value' ),
 136+ 'conds' => array( $set,
 137+ 'p1.page_id = tl_from',
 138+ 'pl_namespace = p1.page_namespace',
 139+ 'pl_title = p1.page_title',
 140+ 'p2.page_id = pl_from',
 141+ 'p2.page_namespace' => NS_MAIN )
 142+ );
92143 }
93144
 145+ function getOrderFields() {
 146+ return array('tl_namespace', 'tl_title', 'value');
 147+ }
 148+
 149+ function sortDescending() {
 150+ return false;
 151+ }
 152+
94153 function formatResult( $skin, $result ) {
95154 global $wgContLang;
96155 $title = Title::newFromID( $result->value );
Index: branches/querypage-work2/phase3/includes/specials/SpecialBrokenRedirects.php
@@ -16,30 +16,13 @@
1717 return 'BrokenRedirects';
1818 }
1919
20 - function isExpensive( ) { return true; }
 20+ function isExpensive() { return true; }
2121 function isSyndicated() { return false; }
2222
23 - function getPageHeader( ) {
 23+ function getPageHeader() {
2424 return wfMsgExt( 'brokenredirectstext', array( 'parse' ) );
2525 }
2626
27 - function getSQL() {
28 - $dbr = wfGetDB( DB_SLAVE );
29 - list( $page, $redirect ) = $dbr->tableNamesN( 'page', 'redirect' );
30 -
31 - $sql = "SELECT 'BrokenRedirects' AS type,
32 - p1.page_namespace AS namespace,
33 - p1.page_title AS title,
34 - rd_namespace,
35 - rd_title
36 - FROM $redirect AS rd
37 - JOIN $page p1 ON (rd.rd_from=p1.page_id)
38 - LEFT JOIN $page AS p2 ON (rd_namespace=p2.page_namespace AND rd_title=p2.page_title )
39 - WHERE rd_namespace >= 0
40 - AND p2.page_namespace IS NULL";
41 - return $sql;
42 - }
43 -
4427 function getQueryInfo() {
4528 return array(
4629 'tables' => array( 'redirect', 'page AS p1', 'page AS p2' ),
@@ -64,12 +47,13 @@
6548 );
6649 }
6750
68 - function getOrder() {
 51+ function getOrderFields() {
 52+ // FIXME: really?
6953 return array ();
7054 }
7155
7256 function formatResult( $skin, $result ) {
73 - global $wgUser, $wgContLang, $wgLang;
 57+ global $wgUser, $wgContLang;
7458
7559 $fromObj = Title::makeTitle( $result->namespace, $result->title );
7660 if ( isset( $result->rd_title ) ) {
@@ -85,43 +69,21 @@
8670
8771 // $toObj may very easily be false if the $result list is cached
8872 if ( !is_object( $toObj ) ) {
89 - return '<s>' . $skin->link( $fromObj ) . '</s>';
 73+ return '<s>' . $skin->makeLinkObj( $fromObj ) . '</s>';
9074 }
9175
92 - $from = $skin->linkKnown(
93 - $fromObj,
94 - null,
95 - array(),
96 - array( 'redirect' => 'no' )
97 - );
98 - $links = array();
99 - $links[] = $skin->linkKnown(
100 - $fromObj,
101 - wfMsgHtml( 'brokenredirects-edit' ),
102 - array(),
103 - array( 'action' => 'edit' )
104 - );
105 - $to = $skin->link(
106 - $toObj,
107 - null,
108 - array(),
109 - array(),
110 - array( 'broken' )
111 - );
 76+ $from = $skin->makeKnownLinkObj( $fromObj ,'', 'redirect=no' );
 77+ $edit = $skin->makeKnownLinkObj( $fromObj, wfMsgHtml( 'brokenredirects-edit' ), 'action=edit' );
 78+ $to = $skin->makeBrokenLinkObj( $toObj );
11279 $arr = $wgContLang->getArrow();
11380
114 - $out = $from . wfMsg( 'word-separator' );
 81+ $out = "{$from} {$edit}";
11582
11683 if( $wgUser->isAllowed( 'delete' ) ) {
117 - $links[] = $skin->linkKnown(
118 - $fromObj,
119 - wfMsgHtml( 'brokenredirects-delete' ),
120 - array(),
121 - array( 'action' => 'delete' )
122 - );
 84+ $delete = $skin->makeKnownLinkObj( $fromObj, wfMsgHtml( 'brokenredirects-delete' ), 'action=delete' );
 85+ $out .= " {$delete}";
12386 }
12487
125 - $out .= wfMsg( 'parentheses', $wgLang->pipeList( $links ) );
12688 $out .= " {$arr} {$to}";
12789 return $out;
12890 }
Index: branches/querypage-work2/phase3/includes/specials/SpecialDeadendpages.php
@@ -9,7 +9,7 @@
1010 */
1111 class DeadendPagesPage extends PageQueryPage {
1212
13 - function getName( ) {
 13+ function getName() {
1414 return "Deadendpages";
1515 }
1616
@@ -22,7 +22,7 @@
2323 *
2424 * @return true
2525 */
26 - function isExpensive( ) {
 26+ function isExpensive() {
2727 return 1;
2828 }
2929
@@ -35,19 +35,6 @@
3636 return false;
3737 }
3838
39 - /**
40 - * @return string an sqlquery
41 - */
42 - function getSQL() {
43 - $dbr = wfGetDB( DB_SLAVE );
44 - list( $page, $pagelinks ) = $dbr->tableNamesN( 'page', 'pagelinks' );
45 - return "SELECT 'Deadendpages' as type, page_namespace AS namespace, page_title as title, page_title AS value " .
46 - "FROM $page LEFT JOIN $pagelinks ON page_id = pl_from " .
47 - "WHERE pl_from IS NULL " .
48 - "AND page_namespace = 0 " .
49 - "AND page_is_redirect = 0";
50 - }
51 -
5239 function getQueryInfo() {
5340 return array(
5441 'tables' => array( 'page', 'pagelinks' ),
Property changes on: branches/querypage-work2/phase3/includes/specials
___________________________________________________________________
Name: svn:mergeinfo
5542 - /branches/REL1_15/phase3/includes/specials:51646
/branches/querypage-work/phase3/includes/specials:49084,49528
/branches/sqlite/includes/specials:58211-58321
/branches/wmf-deployment/includes/specials:53381,56967
5643 + /branches/REL1_15/phase3/includes/specials:51646
/branches/querypage-work/phase3/includes/specials:49084,49528,49599
/branches/sqlite/includes/specials:58211-58321
/branches/wmf-deployment/includes/specials:53381,56967
Property changes on: branches/querypage-work2/phase3/includes
___________________________________________________________________
Name: svn:mergeinfo
5744 - /branches/REL1_15/phase3/includes:51646
/branches/querypage-work/phase3/includes:49084,49528
/branches/sqlite/includes:58211-58321
/branches/wmf-deployment/includes:53381
5845 + /branches/REL1_15/phase3/includes:51646
/branches/querypage-work/phase3/includes:49084,49528,49599
/branches/sqlite/includes:58211-58321
/branches/wmf-deployment/includes:53381
Property changes on: branches/querypage-work2/phase3
___________________________________________________________________
Name: svn:mergeinfo
5946 - /branches/REL1_15/phase3:51646
/branches/querypage-work/phase3:49084,49528
/branches/sqlite:58211-58321
6047 + /branches/REL1_15/phase3:51646
/branches/querypage-work/phase3:49084,49528,49599
/branches/sqlite:58211-58321
Property changes on: branches/querypage-work2
___________________________________________________________________
Name: svn:mergeinfo
6148 - /branches/querypage-work:49084,49528
6249 + /branches/querypage-work:49084,49528,49599

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r49599querypage-work: Convert SpecialDisambiguations.php, tweak coding style, remov...catrope14:47, 17 April 2009

Status & tagging log