http://www.mediawiki.org/wiki/Special:Code/MediaWiki/65318
Revision: 65318
Author: reedy
Date: 2010-04-20 14:19:05 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
querypage-work2: Merge r49951
Modified Paths:
--------------
branches/querypage-work2/phase3/includes/Namespace.php
branches/querypage-work2/phase3/includes/PageQueryPage.php
branches/querypage-work2/phase3/includes/specials/SpecialAncientpages.php
branches/querypage-work2/phase3/includes/specials/SpecialDeadendpages.php
branches/querypage-work2/phase3/includes/specials/SpecialDisambiguations.php
branches/querypage-work2/phase3/includes/specials/SpecialFewestrevisions.php
branches/querypage-work2/phase3/includes/specials/SpecialLonelypages.php
branches/querypage-work2/phase3/includes/specials/SpecialMostcategories.php
branches/querypage-work2/phase3/includes/specials/SpecialPopularpages.php
branches/querypage-work2/phase3/includes/specials/SpecialShortpages.php
branches/querypage-work2/phase3/includes/specials/SpecialUncategorizedpages.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,49599,49631
+ /branches/querypage-work:49084,49599,49631,49951
Property changes on: branches/querypage-work2/phase3
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/REL1_15/phase3:51646
/branches/querypage-work/phase3:49084,49599,49631
/branches/sqlite:58211-58321
+ /branches/REL1_15/phase3:51646
/branches/querypage-work/phase3:49084,49599,49631,49951
/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,49599,49631
/branches/sqlite/includes:58211-58321
/branches/wmf-deployment/includes:53381
+ /branches/REL1_15/phase3/includes:51646
/branches/querypage-work/phase3/includes:49084,49599,49631,49951
/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,49599,49631
/branches/wmf-deployment/includes/ChangesList.php:53381,57589
+ /branches/REL1_15/phase3/includes/ChangesList.php:51646
/branches/querypage-work/phase3/includes/ChangesList.php:49084,49599,49631,49951
/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,49599,49631
+
/branches/querypage-work/phase3/includes/ConfEditor.php:49084,49599,49631,49951
Modified: branches/querypage-work2/phase3/includes/Namespace.php
===================================================================
--- branches/querypage-work2/phase3/includes/Namespace.php 2010-04-20
14:17:19 UTC (rev 65317)
+++ branches/querypage-work2/phase3/includes/Namespace.php 2010-04-20
14:19:05 UTC (rev 65318)
@@ -199,6 +199,25 @@
}
/**
+ * Get a list of all namespace indices which are considered to contain
content
+ *
+ * If only one content namespace exists, returns that single index (Int)
+ * If multiple content namespaces exist, it returns an array of indices
+ *
+ * @return mixed
+ */
+ public static function getContentNamespaces() {
+ global $wgContentNamespaces;
+ if( empty( $wgContentNamespaces ) )
+ return NS_MAIN;
+ // always force NS_MAIN to be part of array (to match the
algorithm used by isContent)
+ elseif ( !in_array( NS_MAIN, $wgContentNamespaces ) )
+ return array( NS_MAIN ) + $wgContentNamespaces;
+ else
+ return $wgContentNamespaces;
+
+ }
+ /**
* Is the namespace first-letter capitalized?
*
* @param $index int Index to check
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,49599,49631
/branches/wmf-deployment/includes/OutputPage.php:53381,57468
+ /branches/REL1_15/phase3/includes/OutputPage.php:51646
/branches/querypage-work/phase3/includes/OutputPage.php:49084,49599,49631,49951
/branches/wmf-deployment/includes/OutputPage.php:53381,57468
Modified: branches/querypage-work2/phase3/includes/PageQueryPage.php
===================================================================
--- branches/querypage-work2/phase3/includes/PageQueryPage.php 2010-04-20
14:17:19 UTC (rev 65317)
+++ branches/querypage-work2/phase3/includes/PageQueryPage.php 2010-04-20
14:19:05 UTC (rev 65318)
@@ -5,7 +5,7 @@
*
* @ingroup SpecialPage
*/
-class PageQueryPage extends QueryPage {
+abstract class PageQueryPage extends QueryPage {
/**
* Format the result as a simple link to the page
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,49599,49631
/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,49599,49631,49951
/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,49599,49631
/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,49599,49631,49951
/branches/sqlite/includes/specials:58211-58321
/branches/wmf-deployment/includes/specials:53381,56967
Modified:
branches/querypage-work2/phase3/includes/specials/SpecialAncientpages.php
===================================================================
--- branches/querypage-work2/phase3/includes/specials/SpecialAncientpages.php
2010-04-20 14:17:19 UTC (rev 65317)
+++ branches/querypage-work2/phase3/includes/specials/SpecialAncientpages.php
2010-04-20 14:19:05 UTC (rev 65318)
@@ -28,7 +28,7 @@
'page_namespace AS namespace',
'page_title AS title',
'rev_timestamp AS value' ),
- 'conds' => array( 'page_namespace' => NS_MAIN,
+ 'conds' => array( 'page_namespace' =>
MWNamespace::getContentNamespaces(),
'page_is_redirect' => 0,
'page_latest=rev_id' )
);
Modified:
branches/querypage-work2/phase3/includes/specials/SpecialDeadendpages.php
===================================================================
--- branches/querypage-work2/phase3/includes/specials/SpecialDeadendpages.php
2010-04-20 14:17:19 UTC (rev 65317)
+++ branches/querypage-work2/phase3/includes/specials/SpecialDeadendpages.php
2010-04-20 14:19:05 UTC (rev 65318)
@@ -38,13 +38,13 @@
function getQueryInfo() {
return array(
'tables' => array( 'page', 'pagelinks' ),
- 'fields' => array( "'{$this->getName()} AS type",
+ 'fields' => array( "'{$this->getName()}' AS type",
'page_namespace AS namespace',
'page_title AS title',
'page_title AS value'
),
'conds' => array( 'pl_from IS NULL',
- 'page_namespace' => NS_MAIN,
+ 'page_namespace' =>
MWNamespace::getContentNamespaces(),
'page_is_redirect' => 0
),
'join_conds' => array( 'pagelinks' => array( 'LEFT
JOIN', array(
Modified:
branches/querypage-work2/phase3/includes/specials/SpecialDisambiguations.php
===================================================================
---
branches/querypage-work2/phase3/includes/specials/SpecialDisambiguations.php
2010-04-20 14:17:19 UTC (rev 65317)
+++
branches/querypage-work2/phase3/includes/specials/SpecialDisambiguations.php
2010-04-20 14:19:05 UTC (rev 65318)
@@ -137,7 +137,7 @@
'pl_namespace = p1.page_namespace',
'pl_title = p1.page_title',
'p2.page_id = pl_from',
- 'p2.page_namespace' => NS_MAIN )
+ 'p2.page_namespace' =>
MWNamespace::getContentNamespaces() )
);
}
Modified:
branches/querypage-work2/phase3/includes/specials/SpecialFewestrevisions.php
===================================================================
---
branches/querypage-work2/phase3/includes/specials/SpecialFewestrevisions.php
2010-04-20 14:17:19 UTC (rev 65317)
+++
branches/querypage-work2/phase3/includes/specials/SpecialFewestrevisions.php
2010-04-20 14:19:05 UTC (rev 65318)
@@ -32,7 +32,7 @@
'page_title AS title',
'COUNT(*) AS value',
'page_is_redirect AS redirect' ),
- 'conds' => array ( 'page_namespace' => NS_MAIN,
+ 'conds' => array ( 'page_namespace' =>
MWNamespace::getContentNamespaces(),
'page_id = rev_page' ),
'options' => array ( 'HAVING' => 'COUNT(*) > 1',
// ^^^ This was probably here to weed out redirects.
Modified:
branches/querypage-work2/phase3/includes/specials/SpecialLonelypages.php
===================================================================
--- branches/querypage-work2/phase3/includes/specials/SpecialLonelypages.php
2010-04-20 14:17:19 UTC (rev 65317)
+++ branches/querypage-work2/phase3/includes/specials/SpecialLonelypages.php
2010-04-20 14:19:05 UTC (rev 65318)
@@ -36,7 +36,7 @@
'page_title AS title',
'page_title AS value' ),
'conds' => array ( 'pl_namespace IS NULL',
- 'page_namespace' => NS_MAIN,
+ 'page_namespace' =>
MWNamespace::getContentNamespaces(),
'page_is_redirect' => 0,
'tl_namespace IS NULL' ),
// TODO: test this JOIN
Modified:
branches/querypage-work2/phase3/includes/specials/SpecialMostcategories.php
===================================================================
--- branches/querypage-work2/phase3/includes/specials/SpecialMostcategories.php
2010-04-20 14:17:19 UTC (rev 65317)
+++ branches/querypage-work2/phase3/includes/specials/SpecialMostcategories.php
2010-04-20 14:19:05 UTC (rev 65318)
@@ -25,7 +25,7 @@
'page_namespace AS namespace',
'page_title AS title',
'COUNT(*) AS value' ),
- 'conds' => array ( 'page_namespace' => NS_MAIN ),
+ 'conds' => array ( 'page_namespace' =>
MWNamespace::getContentNamespaces() ),
'options' => array ( 'HAVING' => 'COUNT(*) > 1',
'GROUP BY' => 'page_namespace, page_title' ),
// TODO: test this JOIN
Modified:
branches/querypage-work2/phase3/includes/specials/SpecialPopularpages.php
===================================================================
--- branches/querypage-work2/phase3/includes/specials/SpecialPopularpages.php
2010-04-20 14:17:19 UTC (rev 65317)
+++ branches/querypage-work2/phase3/includes/specials/SpecialPopularpages.php
2010-04-20 14:19:05 UTC (rev 65318)
@@ -20,29 +20,15 @@
}
function isSyndicated() { return false; }
- function getSQL() {
- $dbr = wfGetDB( DB_SLAVE );
- $page = $dbr->tableName( 'page' );
-
- $query =
- "SELECT 'Popularpages' as type,
- page_namespace as namespace,
- page_title as title,
- page_counter as value
- FROM $page ";
- $where =
- "WHERE page_is_redirect=0 AND page_namespace";
-
- global $wgContentNamespaces;
- if( empty( $wgContentNamespaces ) ) {
- $where .= '='.NS_MAIN;
- } else if( count( $wgContentNamespaces ) > 1 ) {
- $where .= ' in (' . implode( ', ', $wgContentNamespaces
) . ')';
- } else {
- $where .= '='.$wgContentNamespaces[0];
- }
-
- return $query . $where;
+ function getQueryInfo() {
+ return array (
+ 'tables' => array( 'page' ),
+ 'fields' => array( "'{$this->getName()}' AS type",
+ 'page_namespace AS namespace',
+ 'page_title AS title',
+ 'page_counter AS value'),
+ 'conds' => array( 'page_is_redirect' => 0,
+ 'page_namespace' =>
MWNamespace::getContentNamespaces() ) );
}
function formatResult( $skin, $result ) {
Modified:
branches/querypage-work2/phase3/includes/specials/SpecialShortpages.php
===================================================================
--- branches/querypage-work2/phase3/includes/specials/SpecialShortpages.php
2010-04-20 14:17:19 UTC (rev 65317)
+++ branches/querypage-work2/phase3/includes/specials/SpecialShortpages.php
2010-04-20 14:19:05 UTC (rev 65318)
@@ -28,15 +28,13 @@
}
function getQueryInfo() {
- global $wgContentNamespaces;
- $ns = ( $wgContentNamespaces ? $wgContentNamespaces : NS_MAIN );
return array (
'tables' => array ( 'page' ),
'fields' => array ( "'{$this->getName()}' AS type",
'page_namespace AS namespace',
'page_title AS title',
'page_len AS value' ),
- 'conds' => array ( 'page_namespace' => $ns,
+ 'conds' => array ( 'page_namespace' =>
MWNamespace::getContentNamespaces(),
'page_is_redirect' => 0 ),
'options' => array ( 'USE INDEX' => 'page_len' )
);
Modified:
branches/querypage-work2/phase3/includes/specials/SpecialUncategorizedpages.php
===================================================================
---
branches/querypage-work2/phase3/includes/specials/SpecialUncategorizedpages.php
2010-04-20 14:17:19 UTC (rev 65317)
+++
branches/querypage-work2/phase3/includes/specials/SpecialUncategorizedpages.php
2010-04-20 14:19:05 UTC (rev 65318)
@@ -10,7 +10,7 @@
*/
// FIXME: Make $requestedNamespace selectable, unify all subclasses into one
class UncategorizedPagesPage extends PageQueryPage {
- var $requestedNamespace = NS_MAIN;
+ var $requestedNamespace = false;
function getName() {
return "Uncategorizedpages";
@@ -32,8 +32,10 @@
'page_namespace AS namespace',
'page_title AS title',
'page_title AS value' ),
+ // default for page_namespace is all content namespaces
(if requestedNamespace is false)
+ // otherwise, page_namespace is requestedNamespace
'conds' => array ( 'cl_from IS NULL',
- 'page_namespace' =>
$this->requestedNamespace,
+ 'page_namespace' => (
$this->requestedNamespace!==false ? $this->requestedNamespace :
MWNamespace::getContentNamespaces() ),
'page_is_redirect' => 0 ),
'join_conds' => array ( 'categorylinks' => array (
'LEFT JOIN', 'cl_from = page_id' ) )
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,49599,49631
/branches/wmf-deployment/maintenance/cleanupTable.inc:56715
+ /branches/REL1_15/phase3/maintenance/cleanupTable.inc:51646
/branches/querypage-work/phase3/maintenance/cleanupTable.inc:49084,49599,49631,49951
/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,49599,49631
+
/branches/querypage-work/phase3/skins/common/jquery.js:49084,49599,49631,49951
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,49599,49631
+
/branches/querypage-work/phase3/skins/common/jquery.min.js:49084,49599,49631,49951
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs