r65473 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65472‎ | r65473 | r65474 >
Date:18:43, 23 April 2010
Author:reedy
Status:deferred
Tags:
Comment:
Nuke getSQL where we have getQueryInfo
Modified paths:
  • /branches/querypage-work2/phase3/includes/specials/SpecialBrokenRedirects.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialDisambiguations.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialWantedpages.php (modified) (history)

Diff [purge]

Index: branches/querypage-work2/phase3/includes/specials/SpecialDisambiguations.php
@@ -21,71 +21,6 @@
2222 return wfMsgExt( 'disambiguations-text', array( 'parse' ) );
2323 }
2424
25 - function getSQL() {
26 - global $wgContentNamespaces;
27 -
28 - $dbr = wfGetDB( DB_SLAVE );
29 -
30 - $dMsgText = wfMsgForContent('disambiguationspage');
31 -
32 - $linkBatch = new LinkBatch;
33 -
34 - # If the text can be treated as a title, use it verbatim.
35 - # Otherwise, pull the titles from the links table
36 - $dp = Title::newFromText($dMsgText);
37 - if( $dp ) {
38 - if($dp->getNamespace() != NS_TEMPLATE) {
39 - # FIXME we assume the disambiguation message is a template but
40 - # the page can potentially be from another namespace :/
41 - wfDebug("Mediawiki:disambiguationspage message does not refer to a template!\n");
42 - }
43 - $linkBatch->addObj( $dp );
44 - } else {
45 - # Get all the templates linked from the Mediawiki:Disambiguationspage
46 - $disPageObj = Title::makeTitleSafe( NS_MEDIAWIKI, 'disambiguationspage' );
47 - $res = $dbr->select(
48 - array('pagelinks', 'page'),
49 - 'pl_title',
50 - array('page_id = pl_from', 'pl_namespace' => NS_TEMPLATE,
51 - 'page_namespace' => $disPageObj->getNamespace(), 'page_title' => $disPageObj->getDBkey()),
52 - __METHOD__ );
53 -
54 - while ( $row = $dbr->fetchObject( $res ) ) {
55 - $linkBatch->addObj( Title::makeTitle( NS_TEMPLATE, $row->pl_title ));
56 - }
57 -
58 - $dbr->freeResult( $res );
59 - }
60 -
61 - $set = $linkBatch->constructSet( 'lb.tl', $dbr );
62 - if( $set === false ) {
63 - # We must always return a valid sql query, but this way DB will always quicly return an empty result
64 - $set = 'FALSE';
65 - wfDebug("Mediawiki:disambiguationspage message does not link to any templates!\n");
66 - }
67 -
68 - list( $page, $pagelinks, $templatelinks) = $dbr->tableNamesN( 'page', 'pagelinks', 'templatelinks' );
69 -
70 - if ( $wgContentNamespaces ) {
71 - $nsclause = 'IN (' . $dbr->makeList( $wgContentNamespaces ) . ')';
72 - } else {
73 - $nsclause = '= ' . NS_MAIN;
74 - }
75 -
76 - $sql = "SELECT 'Disambiguations' AS \"type\", pb.page_namespace AS namespace,"
77 - ." pb.page_title AS title, la.pl_from AS value"
78 - ." FROM {$templatelinks} AS lb, {$page} AS pb, {$pagelinks} AS la, {$page} AS pa"
79 - ." WHERE $set" # disambiguation template(s)
80 - .' AND pa.page_id = la.pl_from'
81 - .' AND pa.page_namespace ' . $nsclause
82 - .' AND pb.page_id = lb.tl_from'
83 - .' AND pb.page_namespace = la.pl_namespace'
84 - .' AND pb.page_title = la.pl_title'
85 - .' ORDER BY lb.tl_namespace, lb.tl_title';
86 -
87 - return $sql;
88 - }
89 -
9025 function getQueryInfo() {
9126 $dbr = wfGetDB( DB_SLAVE );
9227 $dMsgText = wfMsgForContent('disambiguationspage');
Index: branches/querypage-work2/phase3/includes/specials/SpecialBrokenRedirects.php
@@ -10,7 +10,6 @@
1111 * @ingroup SpecialPage
1212 */
1313 class BrokenRedirectsPage extends PageQueryPage {
14 - var $targets = array();
1514
1615 function __construct() {
1716 SpecialPage::__construct( 'BrokenRedirects' );
Index: branches/querypage-work2/phase3/includes/specials/SpecialWantedpages.php
@@ -32,31 +32,6 @@
3333 parent::execute( $par );
3434 }
3535
36 - function getSQL() {
37 - global $wgWantedPagesThreshold;
38 - $count = $wgWantedPagesThreshold - 1;
39 - $dbr = wfGetDB( DB_SLAVE );
40 - $pagelinks = $dbr->tableName( 'pagelinks' );
41 - $page = $dbr->tableName( 'page' );
42 - $sql = "SELECT 'Wantedpages' AS type,
43 - pl_namespace AS namespace,
44 - pl_title AS title,
45 - COUNT(*) AS value
46 - FROM $pagelinks
47 - LEFT JOIN $page AS pg1
48 - ON pl_namespace = pg1.page_namespace AND pl_title = pg1.page_title
49 - LEFT JOIN $page AS pg2
50 - ON pl_from = pg2.page_id
51 - WHERE pg1.page_namespace IS NULL
52 - AND pl_namespace NOT IN ( " . NS_USER . ", ". NS_USER_TALK . ")
53 - AND pg2.page_namespace != " . NS_MEDIAWIKI . "
54 - GROUP BY pl_namespace, pl_title
55 - HAVING COUNT(*) > $count";
56 -
57 - wfRunHooks( 'WantedPages::getSQL', array( &$this, &$sql ) );
58 - return $sql;
59 - }
60 -
6136 function getQueryInfo() {
6237 global $wgWantedPagesThreshold;
6338 $count = $wgWantedPagesThreshold - 1;

Status & tagging log