http://www.mediawiki.org/wiki/Special:Code/MediaWiki/65315
Revision: 65315
Author: reedy
Date: 2010-04-20 14:07:35 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
querypage-work2: merge r49599 from querypage-work
Modified Paths:
--------------
branches/querypage-work2/phase3/includes/specials/SpecialBrokenRedirects.php
branches/querypage-work2/phase3/includes/specials/SpecialDeadendpages.php
branches/querypage-work2/phase3/includes/specials/SpecialDisambiguations.php
Property Changed:
----------------
branches/querypage-work2/
branches/querypage-work2/phase3/
branches/querypage-work2/phase3/includes/
branches/querypage-work2/phase3/includes/ChangesList.php
branches/querypage-work2/phase3/includes/ConfEditor.php
branches/querypage-work2/phase3/includes/OutputPage.php
branches/querypage-work2/phase3/includes/api/
branches/querypage-work2/phase3/includes/specials/
branches/querypage-work2/phase3/maintenance/cleanupTable.inc
branches/querypage-work2/phase3/skins/common/jquery.js
branches/querypage-work2/phase3/skins/common/jquery.min.js
Property changes on: branches/querypage-work2
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/querypage-work:49084,49528
+ /branches/querypage-work:49084,49528,49599
Property changes on: branches/querypage-work2/phase3
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/REL1_15/phase3:51646
/branches/querypage-work/phase3:49084,49528
/branches/sqlite:58211-58321
+ /branches/REL1_15/phase3:51646
/branches/querypage-work/phase3:49084,49528,49599
/branches/sqlite:58211-58321
Property changes on: branches/querypage-work2/phase3/includes
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/REL1_15/phase3/includes:51646
/branches/querypage-work/phase3/includes:49084,49528
/branches/sqlite/includes:58211-58321
/branches/wmf-deployment/includes:53381
+ /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/includes/ChangesList.php
___________________________________________________________________
Modified: svn:mergeinfo
- /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
+ /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
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/querypage-work/phase3/includes/ConfEditor.php:49084,49528
+ /branches/querypage-work/phase3/includes/ConfEditor.php:49084,49528,49599
Property changes on: branches/querypage-work2/phase3/includes/OutputPage.php
___________________________________________________________________
Modified: svn:mergeinfo
- /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
+ /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
___________________________________________________________________
Modified: svn:mergeinfo
- /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
+ /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/specials
___________________________________________________________________
Modified: svn:mergeinfo
- /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
+ /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
Modified:
branches/querypage-work2/phase3/includes/specials/SpecialBrokenRedirects.php
===================================================================
---
branches/querypage-work2/phase3/includes/specials/SpecialBrokenRedirects.php
2010-04-20 14:06:00 UTC (rev 65314)
+++
branches/querypage-work2/phase3/includes/specials/SpecialBrokenRedirects.php
2010-04-20 14:07:35 UTC (rev 65315)
@@ -16,30 +16,13 @@
return 'BrokenRedirects';
}
- function isExpensive( ) { return true; }
+ function isExpensive() { return true; }
function isSyndicated() { return false; }
- function getPageHeader( ) {
+ function getPageHeader() {
return wfMsgExt( 'brokenredirectstext', array( 'parse' ) );
}
- function getSQL() {
- $dbr = wfGetDB( DB_SLAVE );
- list( $page, $redirect ) = $dbr->tableNamesN( 'page',
'redirect' );
-
- $sql = "SELECT 'BrokenRedirects' AS type,
- p1.page_namespace AS namespace,
- p1.page_title AS title,
- rd_namespace,
- rd_title
- FROM $redirect AS rd
- JOIN $page p1 ON (rd.rd_from=p1.page_id)
- LEFT JOIN $page AS p2 ON (rd_namespace=p2.page_namespace
AND rd_title=p2.page_title )
- WHERE rd_namespace >= 0
- AND p2.page_namespace IS NULL";
- return $sql;
- }
-
function getQueryInfo() {
return array(
'tables' => array( 'redirect', 'page AS p1', 'page AS
p2' ),
@@ -64,12 +47,13 @@
);
}
- function getOrder() {
+ function getOrderFields() {
+ // FIXME: really?
return array ();
}
function formatResult( $skin, $result ) {
- global $wgUser, $wgContLang, $wgLang;
+ global $wgUser, $wgContLang;
$fromObj = Title::makeTitle( $result->namespace, $result->title
);
if ( isset( $result->rd_title ) ) {
@@ -85,43 +69,21 @@
// $toObj may very easily be false if the $result list is cached
if ( !is_object( $toObj ) ) {
- return '<s>' . $skin->link( $fromObj ) . '</s>';
+ return '<s>' . $skin->makeLinkObj( $fromObj ) . '</s>';
}
- $from = $skin->linkKnown(
- $fromObj,
- null,
- array(),
- array( 'redirect' => 'no' )
- );
- $links = array();
- $links[] = $skin->linkKnown(
- $fromObj,
- wfMsgHtml( 'brokenredirects-edit' ),
- array(),
- array( 'action' => 'edit' )
- );
- $to = $skin->link(
- $toObj,
- null,
- array(),
- array(),
- array( 'broken' )
- );
+ $from = $skin->makeKnownLinkObj( $fromObj ,'', 'redirect=no' );
+ $edit = $skin->makeKnownLinkObj( $fromObj, wfMsgHtml(
'brokenredirects-edit' ), 'action=edit' );
+ $to = $skin->makeBrokenLinkObj( $toObj );
$arr = $wgContLang->getArrow();
- $out = $from . wfMsg( 'word-separator' );
+ $out = "{$from} {$edit}";
if( $wgUser->isAllowed( 'delete' ) ) {
- $links[] = $skin->linkKnown(
- $fromObj,
- wfMsgHtml( 'brokenredirects-delete' ),
- array(),
- array( 'action' => 'delete' )
- );
+ $delete = $skin->makeKnownLinkObj( $fromObj, wfMsgHtml(
'brokenredirects-delete' ), 'action=delete' );
+ $out .= " {$delete}";
}
- $out .= wfMsg( 'parentheses', $wgLang->pipeList( $links ) );
$out .= " {$arr} {$to}";
return $out;
}
Modified:
branches/querypage-work2/phase3/includes/specials/SpecialDeadendpages.php
===================================================================
--- branches/querypage-work2/phase3/includes/specials/SpecialDeadendpages.php
2010-04-20 14:06:00 UTC (rev 65314)
+++ branches/querypage-work2/phase3/includes/specials/SpecialDeadendpages.php
2010-04-20 14:07:35 UTC (rev 65315)
@@ -9,7 +9,7 @@
*/
class DeadendPagesPage extends PageQueryPage {
- function getName( ) {
+ function getName() {
return "Deadendpages";
}
@@ -22,7 +22,7 @@
*
* @return true
*/
- function isExpensive( ) {
+ function isExpensive() {
return 1;
}
@@ -35,19 +35,6 @@
return false;
}
- /**
- * @return string an sqlquery
- */
- function getSQL() {
- $dbr = wfGetDB( DB_SLAVE );
- list( $page, $pagelinks ) = $dbr->tableNamesN( 'page',
'pagelinks' );
- return "SELECT 'Deadendpages' as type, page_namespace AS
namespace, page_title as title, page_title AS value " .
- "FROM $page LEFT JOIN $pagelinks ON page_id = pl_from " .
- "WHERE pl_from IS NULL " .
- "AND page_namespace = 0 " .
- "AND page_is_redirect = 0";
- }
-
function getQueryInfo() {
return array(
'tables' => array( 'page', 'pagelinks' ),
Modified:
branches/querypage-work2/phase3/includes/specials/SpecialDisambiguations.php
===================================================================
---
branches/querypage-work2/phase3/includes/specials/SpecialDisambiguations.php
2010-04-20 14:06:00 UTC (rev 65314)
+++
branches/querypage-work2/phase3/includes/specials/SpecialDisambiguations.php
2010-04-20 14:07:35 UTC (rev 65315)
@@ -13,11 +13,11 @@
return 'Disambiguations';
}
- function isExpensive( ) { return true; }
+ function isExpensive() { return true; }
function isSyndicated() { return false; }
- function getPageHeader( ) {
+ function getPageHeader() {
return wfMsgExt( 'disambiguations-text', array( 'parse' ) );
}
@@ -85,11 +85,70 @@
return $sql;
}
+
+ function getQueryInfo() {
+ $dbr = wfGetDB( DB_SLAVE );
+ $dMsgText = wfMsgForContent('disambiguationspage');
+ $linkBatch = new LinkBatch;
- function getOrder() {
- return '';
+ # 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( 'tl', $dbr );
+ if( $set === false ) {
+ # We must always return a valid SQL query, but this way
+ # the DB will always quickly return an empty result
+ $set = 'FALSE';
+ wfDebug("Mediawiki:disambiguationspage message does not
link to any templates!\n");
+ }
+
+ // FIXME: What are pagelinks and p2 doing here?
+ return array (
+ 'tables' => array( 'templatelinks', 'page AS p1',
'pagelinks', 'page AS p2' ),
+ 'fields' => array( "'{$this->getName()}' AS type",
+ 'p1.page_namespace AS namespace',
+ 'p1.page_title AS title',
+ 'pl_from AS value' ),
+ 'conds' => array( $set,
+ 'p1.page_id = tl_from',
+ 'pl_namespace = p1.page_namespace',
+ 'pl_title = p1.page_title',
+ 'p2.page_id = pl_from',
+ 'p2.page_namespace' => NS_MAIN )
+ );
}
+ function getOrderFields() {
+ return array('tl_namespace', 'tl_title', 'value');
+ }
+
+ function sortDescending() {
+ return false;
+ }
+
function formatResult( $skin, $result ) {
global $wgContLang;
$title = Title::newFromID( $result->value );
Property changes on:
branches/querypage-work2/phase3/maintenance/cleanupTable.inc
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/REL1_15/phase3/maintenance/cleanupTable.inc:51646
/branches/querypage-work/phase3/maintenance/cleanupTable.inc:49084,49528
/branches/wmf-deployment/maintenance/cleanupTable.inc:56715
+ /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
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/querypage-work/phase3/skins/common/jquery.js:49084,49528
+ /branches/querypage-work/phase3/skins/common/jquery.js:49084,49528,49599
Property changes on: branches/querypage-work2/phase3/skins/common/jquery.min.js
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/querypage-work/phase3/skins/common/jquery.min.js:49084,49528
+
/branches/querypage-work/phase3/skins/common/jquery.min.js:49084,49528,49599
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs