r65318 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65317‎ | r65318 | r65319 >
Date:14:19, 20 April 2010
Author:reedy
Status:deferred
Tags:
Comment:
querypage-work2: Merge r49951
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/Namespace.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/OutputPage.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/PageQueryPage.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/SpecialAncientpages.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/includes/specials/SpecialFewestrevisions.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialLonelypages.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialMostcategories.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialPopularpages.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialShortpages.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialUncategorizedpages.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,49599,49631
/branches/wmf-deployment/maintenance/cleanupTable.inc:56715
22 + /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
___________________________________________________________________
Name: svn:mergeinfo
33 - /branches/querypage-work/phase3/skins/common/jquery.js:49084,49599,49631
44 + /branches/querypage-work/phase3/skins/common/jquery.js:49084,49599,49631,49951
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,49599,49631
66 + /branches/querypage-work/phase3/skins/common/jquery.min.js:49084,49599,49631,49951
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,49599,49631
/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,49599,49631,49951
/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,49599,49631
/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,49599,49631,49951
/branches/sqlite/includes/api:58211-58321
/branches/wmf-deployment/includes/api:53381,59952
Index: branches/querypage-work2/phase3/includes/PageQueryPage.php
@@ -5,7 +5,7 @@
66 *
77 * @ingroup SpecialPage
88 */
9 -class PageQueryPage extends QueryPage {
 9+abstract class PageQueryPage extends QueryPage {
1010
1111 /**
1212 * Format the result as a simple link to the page
Property changes on: branches/querypage-work2/phase3/includes/ChangesList.php
___________________________________________________________________
Name: svn:mergeinfo
1313 - /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
1414 + /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
___________________________________________________________________
Name: svn:mergeinfo
1515 - /branches/querypage-work/phase3/includes/ConfEditor.php:49084,49599,49631
1616 + /branches/querypage-work/phase3/includes/ConfEditor.php:49084,49599,49631,49951
Index: branches/querypage-work2/phase3/includes/Namespace.php
@@ -199,6 +199,25 @@
200200 }
201201
202202 /**
 203+ * Get a list of all namespace indices which are considered to contain content
 204+ *
 205+ * If only one content namespace exists, returns that single index (Int)
 206+ * If multiple content namespaces exist, it returns an array of indices
 207+ *
 208+ * @return mixed
 209+ */
 210+ public static function getContentNamespaces() {
 211+ global $wgContentNamespaces;
 212+ if( empty( $wgContentNamespaces ) )
 213+ return NS_MAIN;
 214+ // always force NS_MAIN to be part of array (to match the algorithm used by isContent)
 215+ elseif ( !in_array( NS_MAIN, $wgContentNamespaces ) )
 216+ return array( NS_MAIN ) + $wgContentNamespaces;
 217+ else
 218+ return $wgContentNamespaces;
 219+
 220+ }
 221+ /**
203222 * Is the namespace first-letter capitalized?
204223 *
205224 * @param $index int Index to check
Index: branches/querypage-work2/phase3/includes/specials/SpecialFewestrevisions.php
@@ -32,7 +32,7 @@
3333 'page_title AS title',
3434 'COUNT(*) AS value',
3535 'page_is_redirect AS redirect' ),
36 - 'conds' => array ( 'page_namespace' => NS_MAIN,
 36+ 'conds' => array ( 'page_namespace' => MWNamespace::getContentNamespaces(),
3737 'page_id = rev_page' ),
3838 'options' => array ( 'HAVING' => 'COUNT(*) > 1',
3939 // ^^^ This was probably here to weed out redirects.
Index: branches/querypage-work2/phase3/includes/specials/SpecialDisambiguations.php
@@ -137,7 +137,7 @@
138138 'pl_namespace = p1.page_namespace',
139139 'pl_title = p1.page_title',
140140 'p2.page_id = pl_from',
141 - 'p2.page_namespace' => NS_MAIN )
 141+ 'p2.page_namespace' => MWNamespace::getContentNamespaces() )
142142 );
143143 }
144144
Index: branches/querypage-work2/phase3/includes/specials/SpecialMostcategories.php
@@ -25,7 +25,7 @@
2626 'page_namespace AS namespace',
2727 'page_title AS title',
2828 'COUNT(*) AS value' ),
29 - 'conds' => array ( 'page_namespace' => NS_MAIN ),
 29+ 'conds' => array ( 'page_namespace' => MWNamespace::getContentNamespaces() ),
3030 'options' => array ( 'HAVING' => 'COUNT(*) > 1',
3131 'GROUP BY' => 'page_namespace, page_title' ),
3232 // TODO: test this JOIN
Index: branches/querypage-work2/phase3/includes/specials/SpecialPopularpages.php
@@ -20,29 +20,15 @@
2121 }
2222 function isSyndicated() { return false; }
2323
24 - function getSQL() {
25 - $dbr = wfGetDB( DB_SLAVE );
26 - $page = $dbr->tableName( 'page' );
27 -
28 - $query =
29 - "SELECT 'Popularpages' as type,
30 - page_namespace as namespace,
31 - page_title as title,
32 - page_counter as value
33 - FROM $page ";
34 - $where =
35 - "WHERE page_is_redirect=0 AND page_namespace";
36 -
37 - global $wgContentNamespaces;
38 - if( empty( $wgContentNamespaces ) ) {
39 - $where .= '='.NS_MAIN;
40 - } else if( count( $wgContentNamespaces ) > 1 ) {
41 - $where .= ' in (' . implode( ', ', $wgContentNamespaces ) . ')';
42 - } else {
43 - $where .= '='.$wgContentNamespaces[0];
44 - }
45 -
46 - return $query . $where;
 24+ function getQueryInfo() {
 25+ return array (
 26+ 'tables' => array( 'page' ),
 27+ 'fields' => array( "'{$this->getName()}' AS type",
 28+ 'page_namespace AS namespace',
 29+ 'page_title AS title',
 30+ 'page_counter AS value'),
 31+ 'conds' => array( 'page_is_redirect' => 0,
 32+ 'page_namespace' => MWNamespace::getContentNamespaces() ) );
4733 }
4834
4935 function formatResult( $skin, $result ) {
Index: branches/querypage-work2/phase3/includes/specials/SpecialLonelypages.php
@@ -36,7 +36,7 @@
3737 'page_title AS title',
3838 'page_title AS value' ),
3939 'conds' => array ( 'pl_namespace IS NULL',
40 - 'page_namespace' => NS_MAIN,
 40+ 'page_namespace' => MWNamespace::getContentNamespaces(),
4141 'page_is_redirect' => 0,
4242 'tl_namespace IS NULL' ),
4343 // TODO: test this JOIN
Index: branches/querypage-work2/phase3/includes/specials/SpecialUncategorizedpages.php
@@ -10,7 +10,7 @@
1111 */
1212 // FIXME: Make $requestedNamespace selectable, unify all subclasses into one
1313 class UncategorizedPagesPage extends PageQueryPage {
14 - var $requestedNamespace = NS_MAIN;
 14+ var $requestedNamespace = false;
1515
1616 function getName() {
1717 return "Uncategorizedpages";
@@ -32,8 +32,10 @@
3333 'page_namespace AS namespace',
3434 'page_title AS title',
3535 'page_title AS value' ),
 36+ // default for page_namespace is all content namespaces (if requestedNamespace is false)
 37+ // otherwise, page_namespace is requestedNamespace
3638 'conds' => array ( 'cl_from IS NULL',
37 - 'page_namespace' => $this->requestedNamespace,
 39+ 'page_namespace' => ( $this->requestedNamespace!==false ? $this->requestedNamespace : MWNamespace::getContentNamespaces() ),
3840 'page_is_redirect' => 0 ),
3941 'join_conds' => array ( 'categorylinks' => array (
4042 'LEFT JOIN', 'cl_from = page_id' ) )
Index: branches/querypage-work2/phase3/includes/specials/SpecialShortpages.php
@@ -28,15 +28,13 @@
2929 }
3030
3131 function getQueryInfo() {
32 - global $wgContentNamespaces;
33 - $ns = ( $wgContentNamespaces ? $wgContentNamespaces : NS_MAIN );
3432 return array (
3533 'tables' => array ( 'page' ),
3634 'fields' => array ( "'{$this->getName()}' AS type",
3735 'page_namespace AS namespace',
3836 'page_title AS title',
3937 'page_len AS value' ),
40 - 'conds' => array ( 'page_namespace' => $ns,
 38+ 'conds' => array ( 'page_namespace' => MWNamespace::getContentNamespaces(),
4139 'page_is_redirect' => 0 ),
4240 'options' => array ( 'USE INDEX' => 'page_len' )
4341 );
Index: branches/querypage-work2/phase3/includes/specials/SpecialAncientpages.php
@@ -28,7 +28,7 @@
2929 'page_namespace AS namespace',
3030 'page_title AS title',
3131 'rev_timestamp AS value' ),
32 - 'conds' => array( 'page_namespace' => NS_MAIN,
 32+ 'conds' => array( 'page_namespace' => MWNamespace::getContentNamespaces(),
3333 'page_is_redirect' => 0,
3434 'page_latest=rev_id' )
3535 );
Index: branches/querypage-work2/phase3/includes/specials/SpecialDeadendpages.php
@@ -38,13 +38,13 @@
3939 function getQueryInfo() {
4040 return array(
4141 'tables' => array( 'page', 'pagelinks' ),
42 - 'fields' => array( "'{$this->getName()} AS type",
 42+ 'fields' => array( "'{$this->getName()}' AS type",
4343 'page_namespace AS namespace',
4444 'page_title AS title',
4545 'page_title AS value'
4646 ),
4747 'conds' => array( 'pl_from IS NULL',
48 - 'page_namespace' => NS_MAIN,
 48+ 'page_namespace' => MWNamespace::getContentNamespaces(),
4949 'page_is_redirect' => 0
5050 ),
5151 'join_conds' => array( 'pagelinks' => array( 'LEFT JOIN', array(
Property changes on: branches/querypage-work2/phase3/includes/specials
___________________________________________________________________
Name: svn:mergeinfo
5252 - /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
5353 + /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
Property changes on: branches/querypage-work2/phase3/includes
___________________________________________________________________
Name: svn:mergeinfo
5454 - /branches/REL1_15/phase3/includes:51646
/branches/querypage-work/phase3/includes:49084,49599,49631
/branches/sqlite/includes:58211-58321
/branches/wmf-deployment/includes:53381
5555 + /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
___________________________________________________________________
Name: svn:mergeinfo
5656 - /branches/REL1_15/phase3:51646
/branches/querypage-work/phase3:49084,49599,49631
/branches/sqlite:58211-58321
5757 + /branches/REL1_15/phase3:51646
/branches/querypage-work/phase3:49084,49599,49631,49951
/branches/sqlite:58211-58321
Property changes on: branches/querypage-work2
___________________________________________________________________
Name: svn:mergeinfo
5858 - /branches/querypage-work:49084,49599,49631
5959 + /branches/querypage-work:49084,49599,49631,49951

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r49951querypage-work: (bug 8130) Query pages should limit to $wgContentNamespaces r...catrope13:29, 27 April 2009

Status & tagging log