http://www.mediawiki.org/wiki/Special:Code/MediaWiki/65473
Revision: 65473 Author: reedy Date: 2010-04-23 18:43:08 +0000 (Fri, 23 Apr 2010) Log Message: ----------- Nuke getSQL where we have getQueryInfo Modified Paths: -------------- branches/querypage-work2/phase3/includes/specials/SpecialBrokenRedirects.php branches/querypage-work2/phase3/includes/specials/SpecialDisambiguations.php branches/querypage-work2/phase3/includes/specials/SpecialWantedpages.php Modified: branches/querypage-work2/phase3/includes/specials/SpecialBrokenRedirects.php =================================================================== --- branches/querypage-work2/phase3/includes/specials/SpecialBrokenRedirects.php 2010-04-23 18:37:33 UTC (rev 65472) +++ branches/querypage-work2/phase3/includes/specials/SpecialBrokenRedirects.php 2010-04-23 18:43:08 UTC (rev 65473) @@ -10,7 +10,6 @@ * @ingroup SpecialPage */ class BrokenRedirectsPage extends PageQueryPage { - var $targets = array(); function __construct() { SpecialPage::__construct( 'BrokenRedirects' ); Modified: branches/querypage-work2/phase3/includes/specials/SpecialDisambiguations.php =================================================================== --- branches/querypage-work2/phase3/includes/specials/SpecialDisambiguations.php 2010-04-23 18:37:33 UTC (rev 65472) +++ branches/querypage-work2/phase3/includes/specials/SpecialDisambiguations.php 2010-04-23 18:43:08 UTC (rev 65473) @@ -21,71 +21,6 @@ return wfMsgExt( 'disambiguations-text', array( 'parse' ) ); } - function getSQL() { - global $wgContentNamespaces; - - $dbr = wfGetDB( DB_SLAVE ); - - $dMsgText = wfMsgForContent('disambiguationspage'); - - $linkBatch = new LinkBatch; - - # If the text can be treated as a title, use it verbatim. - # Otherwise, pull the titles from the links table - $dp = Title::newFromText($dMsgText); - if( $dp ) { - if($dp->getNamespace() != NS_TEMPLATE) { - # FIXME we assume the disambiguation message is a template but - # the page can potentially be from another namespace :/ - wfDebug("Mediawiki:disambiguationspage message does not refer to a template!\n"); - } - $linkBatch->addObj( $dp ); - } else { - # Get all the templates linked from the Mediawiki:Disambiguationspage - $disPageObj = Title::makeTitleSafe( NS_MEDIAWIKI, 'disambiguationspage' ); - $res = $dbr->select( - array('pagelinks', 'page'), - 'pl_title', - array('page_id = pl_from', 'pl_namespace' => NS_TEMPLATE, - 'page_namespace' => $disPageObj->getNamespace(), 'page_title' => $disPageObj->getDBkey()), - __METHOD__ ); - - while ( $row = $dbr->fetchObject( $res ) ) { - $linkBatch->addObj( Title::makeTitle( NS_TEMPLATE, $row->pl_title )); - } - - $dbr->freeResult( $res ); - } - - $set = $linkBatch->constructSet( 'lb.tl', $dbr ); - if( $set === false ) { - # We must always return a valid sql query, but this way DB will always quicly return an empty result - $set = 'FALSE'; - wfDebug("Mediawiki:disambiguationspage message does not link to any templates!\n"); - } - - list( $page, $pagelinks, $templatelinks) = $dbr->tableNamesN( 'page', 'pagelinks', 'templatelinks' ); - - if ( $wgContentNamespaces ) { - $nsclause = 'IN (' . $dbr->makeList( $wgContentNamespaces ) . ')'; - } else { - $nsclause = '= ' . NS_MAIN; - } - - $sql = "SELECT 'Disambiguations' AS \"type\", pb.page_namespace AS namespace," - ." pb.page_title AS title, la.pl_from AS value" - ." FROM {$templatelinks} AS lb, {$page} AS pb, {$pagelinks} AS la, {$page} AS pa" - ." WHERE $set" # disambiguation template(s) - .' AND pa.page_id = la.pl_from' - .' AND pa.page_namespace ' . $nsclause - .' AND pb.page_id = lb.tl_from' - .' AND pb.page_namespace = la.pl_namespace' - .' AND pb.page_title = la.pl_title' - .' ORDER BY lb.tl_namespace, lb.tl_title'; - - return $sql; - } - function getQueryInfo() { $dbr = wfGetDB( DB_SLAVE ); $dMsgText = wfMsgForContent('disambiguationspage'); Modified: branches/querypage-work2/phase3/includes/specials/SpecialWantedpages.php =================================================================== --- branches/querypage-work2/phase3/includes/specials/SpecialWantedpages.php 2010-04-23 18:37:33 UTC (rev 65472) +++ branches/querypage-work2/phase3/includes/specials/SpecialWantedpages.php 2010-04-23 18:43:08 UTC (rev 65473) @@ -32,31 +32,6 @@ parent::execute( $par ); } - function getSQL() { - global $wgWantedPagesThreshold; - $count = $wgWantedPagesThreshold - 1; - $dbr = wfGetDB( DB_SLAVE ); - $pagelinks = $dbr->tableName( 'pagelinks' ); - $page = $dbr->tableName( 'page' ); - $sql = "SELECT 'Wantedpages' AS type, - pl_namespace AS namespace, - pl_title AS title, - COUNT(*) AS value - FROM $pagelinks - LEFT JOIN $page AS pg1 - ON pl_namespace = pg1.page_namespace AND pl_title = pg1.page_title - LEFT JOIN $page AS pg2 - ON pl_from = pg2.page_id - WHERE pg1.page_namespace IS NULL - AND pl_namespace NOT IN ( " . NS_USER . ", ". NS_USER_TALK . ") - AND pg2.page_namespace != " . NS_MEDIAWIKI . " - GROUP BY pl_namespace, pl_title - HAVING COUNT(*) > $count"; - - wfRunHooks( 'WantedPages::getSQL', array( &$this, &$sql ) ); - return $sql; - } - function getQueryInfo() { global $wgWantedPagesThreshold; $count = $wgWantedPagesThreshold - 1; _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs