r50105 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50104‎ | r50105 | r50106 >
Date:13:31, 1 May 2009
Author:catrope
Status:deferred
Tags:
Comment:
querypage-work: Removing SELECT 'blah' AS name from SQL queries
Modified paths:
  • /branches/querypage-work/TODO (modified) (history)
  • /branches/querypage-work/phase3/includes/QueryPage.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialAncientpages.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialBrokenRedirects.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialDeadendpages.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialDisambiguations.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialDoubleRedirects.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialFewestrevisions.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialListredirects.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialLonelypages.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialMostcategories.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialMostimages.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialMostlinked.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialMostlinkedcategories.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialMostlinkedtemplates.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialShortpages.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialUncategorizedpages.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialUnusedcategories.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialUnusedimages.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialUnusedtemplates.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialUnwatchedpages.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialWantedcategories.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialWantedfiles.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialWantedpages.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialWantedtemplates.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialWithoutinterwiki.php (modified) (history)

Diff [purge]

Index: branches/querypage-work/phase3/includes/QueryPage.php
@@ -112,8 +112,8 @@
113113 * options => options
114114 * join_conds => JOIN conditions
115115 *
116 - * Note that the query itself should return the following four columns:
117 - * 'type' (your special page's name), 'namespace', 'title', and 'value'
 116+ * Note that the query itself should return the following three columns:
 117+ * 'namespace', 'title', and 'value'
118118 * *in that order*. 'value' is used for sorting.
119119 *
120120 * These may be stored in the querycache table for expensive queries,
@@ -265,7 +265,7 @@
266266 $value = 0;
267267 }
268268
269 - $vals[] = array('qc_type' => $row->type,
 269+ $vals[] = array('qc_type' => $this->getName(),
270270 'qc_namespace' => $row->namespace,
271271 'qc_title' => $row->title,
272272 'qc_value' => $value);
@@ -386,7 +386,7 @@
387387 if( !$this->listoutput ) {
388388
389389 # Fetch the timestamp of this update
390 - $tRes = $dbr->select( 'querycache_info', array( 'qci_timestamp' ), array( 'qci_type' => $type ), $fname );
 390+ $tRes = $dbr->select( 'querycache_info', array( 'qci_timestamp' ), array( 'qci_type' => $sname ), $fname );
391391 $tRow = $dbr->fetchObject( $tRes );
392392
393393 if( $tRow ) {
Index: branches/querypage-work/phase3/includes/specials/SpecialFewestrevisions.php
@@ -27,8 +27,7 @@
2828 function getQueryInfo() {
2929 return array (
3030 'tables' => array ( 'revision', 'page' ),
31 - 'fields' => array ( "'{$this->getName()}' AS type",
32 - 'page_namespace AS namespace',
 31+ 'fields' => array ( 'page_namespace AS namespace',
3332 'page_title AS title',
3433 'COUNT(*) AS value',
3534 'page_is_redirect AS redirect' ),
Index: branches/querypage-work/phase3/includes/specials/SpecialWantedtemplates.php
@@ -23,8 +23,7 @@
2424 function getQueryInfo() {
2525 return array (
2626 'tables' => array ( 'templatelinks', 'page' ),
27 - 'fields' => array ( "'{$this->getName()}' AS type",
28 - 'tl_namespace AS namespace',
 27+ 'fields' => array ( 'tl_namespace AS namespace',
2928 'tl_title AS title',
3029 'COUNT(*) AS value' ),
3130 'conds' => array ( 'page_title IS NULL',
Index: branches/querypage-work/phase3/includes/specials/SpecialMostlinked.php
@@ -28,8 +28,7 @@
2929 function getQueryInfo() {
3030 return array (
3131 'tables' => array ( 'pagelinks', 'page' ),
32 - 'fields' => array ( "'{$this->getName()}' AS type",
33 - 'pl_namespace AS namespace',
 32+ 'fields' => array ( 'pl_namespace AS namespace',
3433 'pl_title AS title',
3534 'COUNT(*) AS value',
3635 'page_namespace' ),
Index: branches/querypage-work/phase3/includes/specials/SpecialDisambiguations.php
@@ -120,8 +120,7 @@
121121 // FIXME: What are pagelinks and p2 doing here?
122122 return array (
123123 'tables' => array( 'templatelinks', 'page AS p1', 'pagelinks', 'page AS p2' ),
124 - 'fields' => array( "'{$this->getName()}' AS type",
125 - 'p1.page_namespace AS namespace',
 124+ 'fields' => array( 'p1.page_namespace AS namespace',
126125 'p1.page_title AS title',
127126 'pl_from AS value' ),
128127 'conds' => array( $set,
Index: branches/querypage-work/phase3/includes/specials/SpecialBrokenRedirects.php
@@ -26,8 +26,7 @@
2727 function getQueryInfo() {
2828 return array(
2929 'tables' => array( 'redirect', 'page AS p1', 'page AS p2' ),
30 - 'fields' => array( "'{$this->getName()}' AS type",
31 - 'p1.page_namespace AS namespace',
 30+ 'fields' => array( 'p1.page_namespace AS namespace',
3231 'p1.page_title AS title',
3332 'rd_namespace',
3433 'rd_title'
Index: branches/querypage-work/phase3/includes/specials/SpecialWantedfiles.php
@@ -22,8 +22,7 @@
2323 function getQueryInfo() {
2424 return array (
2525 'tables' => array ( 'imagelinks', 'page' ),
26 - 'fields' => array ( "'{$this->getName()}' AS type",
27 - "'" . NS_FILE . "' AS namespace",
 26+ 'fields' => array ( "'" . NS_FILE . "' AS namespace",
2827 'il_to AS title',
2928 'COUNT(*) AS value' ),
3029 'conds' => array ( 'page_title IS NULL' ),
Index: branches/querypage-work/phase3/includes/specials/SpecialUnusedcategories.php
@@ -22,8 +22,7 @@
2323 function getQueryInfo() {
2424 return array (
2525 'tables' => array ( 'page', 'categorylinks' ),
26 - 'fields' => array ( "'{$this->getName()}' AS type",
27 - 'page_namespace AS namespace',
 26+ 'fields' => array ( 'page_namespace AS namespace',
2827 'page_title AS title',
2928 'page_title AS value' ),
3029 'conds' => array ( 'cl_from IS NULL',
Index: branches/querypage-work/phase3/includes/specials/SpecialListredirects.php
@@ -22,8 +22,7 @@
2323 function getQueryInfo() {
2424 return array (
2525 'tables' => array ( 'page' ),
26 - 'fields' => array ( "'{$this->getName()}' AS type",
27 - 'page_namespace AS namespace',
 26+ 'fields' => array ( 'page_namespace AS namespace',
2827 'page_title AS title' ),
2928 'conds' => array ( 'page_is_redirect' => 1 )
3029 );
Index: branches/querypage-work/phase3/includes/specials/SpecialLonelypages.php
@@ -31,8 +31,7 @@
3232 return array (
3333 'tables' => array ( 'page', 'pagelinks',
3434 'templatelinks' ),
35 - 'fields' => array ( "'{$this->getName()}' AS type",
36 - 'page_namespace AS namespace',
 35+ 'fields' => array ( 'page_namespace AS namespace',
3736 'page_title AS title',
3837 'page_title AS value' ),
3938 'conds' => array ( 'pl_namespace IS NULL',
Index: branches/querypage-work/phase3/includes/specials/SpecialMostlinkedtemplates.php
@@ -52,8 +52,7 @@
5353 public function getQueryInfo() {
5454 return array (
5555 'tables' => array ( 'templatelinks' ),
56 - 'fields' => array ( "'{$this->getName()}' AS type",
57 - 'tl_namespace AS namespace',
 56+ 'fields' => array ( 'tl_namespace AS namespace',
5857 'tl_title AS title',
5958 'COUNT(*) AS value' ),
6059 'conds' => array ( 'tl_namespace' => NS_TEMPLATE' ),
Index: branches/querypage-work/phase3/includes/specials/SpecialMostcategories.php
@@ -21,8 +21,7 @@
2222 function getQueryInfo() {
2323 return array (
2424 'tables' => array ( 'categorylinks', 'page' ),
25 - 'fields' => array ( "'{$this->getName()}' AS name",
26 - 'page_namespace AS namespace',
 25+ 'fields' => array ( 'page_namespace AS namespace',
2726 'page_title AS title',
2827 'COUNT(*) AS value' ),
2928 'conds' => array ( 'page_namespace' => MWNamespace::getContentNamespaces() ),
Index: branches/querypage-work/phase3/includes/specials/SpecialWantedcategories.php
@@ -22,8 +22,7 @@
2323 function getQueryInfo() {
2424 return array (
2525 'tables' => array ( 'categorylinks', 'page' ),
26 - 'fields' => array ( "'{$this->getName()}' AS type",
27 - "'" . NS_CATEGORY . "' AS namespace",
 26+ 'fields' => array ( "'" . NS_CATEGORY . "' AS namespace",
2827 'cl_to AS title',
2928 'COUNT(*) AS value' ),
3029 'conds' => array ( 'page_title IS NULL' ),
Index: branches/querypage-work/phase3/includes/specials/SpecialUnusedimages.php
@@ -25,8 +25,7 @@
2626 global $wgCountCategorizedImagesAsUsed;
2727 $retval = array (
2828 'tables' => array ( 'image', 'imagelinks' ),
29 - 'fields' => array ( "'{$this->getName()}' AS type",
30 - "'" . NS_FILE . "' AS namespace",
 29+ 'fields' => array ( "'" . NS_FILE . "' AS namespace",
3130 'img_name AS title',
3231 'img_timestamp AS value',
3332 'img_user', 'img_user_text',
Index: branches/querypage-work/phase3/includes/specials/SpecialWithoutinterwiki.php
@@ -53,8 +53,7 @@
5454 function getQueryInfo() {
5555 $query = array (
5656 'tables' => array ( 'page', 'langlinks' ),
57 - 'fields' => array ( "'{$this->getName()}' AS type",
58 - 'page_namespace AS namespace',
 57+ 'fields' => array ( 'page_namespace AS namespace',
5958 'page_title AS title',
6059 'page_title AS value' ),
6160 'conds' => array ( 'll_title IS NULL' ),
Index: branches/querypage-work/phase3/includes/specials/SpecialAncientpages.php
@@ -21,11 +21,9 @@
2222 function isSyndicated() { return false; }
2323
2424 function getQueryInfo() {
25 - // FIXME standardize 'name' AS type ?
2625 return array(
2726 'tables' => array( 'page', 'revision' ),
28 - 'fields' => array( "'{$this->getName()}' AS type",
29 - 'page_namespace AS namespace',
 27+ 'fields' => array( 'page_namespace AS namespace',
3028 'page_title AS title',
3129 'rev_timestamp AS value' ),
3230 'conds' => array( 'page_namespace' => MWNamespace::getContentNamespaces(),
Index: branches/querypage-work/phase3/includes/specials/SpecialUnwatchedpages.php
@@ -22,8 +22,7 @@
2323 function getQueryInfo() {
2424 return array (
2525 'tables' => array ( 'page', 'watchlist' ),
26 - 'fields' => array ( "'{$this->getName()}' AS type",
27 - 'page_namespace AS namespace',
 26+ 'fields' => array ( 'page_namespace AS namespace',
2827 'page_title AS title',
2928 'page_namespace AS value' ),
3029 'conds' => array ( 'wl_title IS NULL',
Index: branches/querypage-work/phase3/includes/specials/SpecialDeadendpages.php
@@ -38,8 +38,7 @@
3939 function getQueryInfo() {
4040 return array(
4141 'tables' => array( 'page', 'pagelinks' ),
42 - 'fields' => array( "'{$this->getName()}' AS type",
43 - 'page_namespace AS namespace',
 42+ 'fields' => array( 'page_namespace AS namespace',
4443 'page_title AS title',
4544 'page_title AS value'
4645 ),
Index: branches/querypage-work/phase3/includes/specials/SpecialMostimages.php
@@ -21,8 +21,7 @@
2222 function getQueryInfo() {
2323 return array (
2424 'tables' => array ( 'imagelinks' ),
25 - 'fields' => array ( "'{$this->getName()}' AS type",
26 - "'" . NS_FILE . "' AS namespace",
 25+ 'fields' => array ( "'" . NS_FILE . "' AS namespace",
2726 'il_to AS title',
2827 'COUNT(*) AS value' ),
2928 'options' => array ( 'GROUP BY' => 'il_to',
Index: branches/querypage-work/phase3/includes/specials/SpecialMostlinkedcategories.php
@@ -22,8 +22,7 @@
2323 function getQueryInfo() {
2424 return array (
2525 'tables' => array ( 'categorylinks' ),
26 - 'fields' => array ( "'{$this->getName()}' AS type",
27 - "'" . NS_CATEGORY . "' AS namespace",
 26+ 'fields' => array ( "'" . NS_CATEGORY . "' AS namespace",
2827 'cl_to AS title',
2928 'COUNT(*) AS value' ),
3029 'options' => array ( 'GROUP BY' => 'cl_to' )
Index: branches/querypage-work/phase3/includes/specials/SpecialUnusedtemplates.php
@@ -21,8 +21,7 @@
2222 function getQueryInfo() {
2323 return array (
2424 'tables' => array ( 'page', 'templatelinks' ),
25 - 'fields' => array ( "'{$this->getName()}' AS type",
26 - 'page_namespace AS namespace',
 25+ 'fields' => array ( 'page_namespace AS namespace',
2726 'page_title AS title',
2827 '0 AS value' ),
2928 'conds' => array ( 'page_namespace' => NS_TEMPLATE,
Index: branches/querypage-work/phase3/includes/specials/SpecialUncategorizedpages.php
@@ -28,8 +28,7 @@
2929 function getQueryInfo() {
3030 return array (
3131 'tables' => array ( 'page', 'categorylinks' ),
32 - 'fields' => array ( "'{$this->getName()}' AS type",
33 - 'page_namespace AS namespace',
 32+ 'fields' => array ( 'page_namespace AS namespace',
3433 'page_title AS title',
3534 'page_title AS value' ),
3635 // default for page_namespace is all content namespaces (if requestedNamespace is false)
Index: branches/querypage-work/phase3/includes/specials/SpecialWantedpages.php
@@ -51,8 +51,7 @@
5252 $query = array (
5353 'tables' => array ( 'pagelinks', 'page AS pg1',
5454 'page AS pg2' ),
55 - 'fields' => array ( "'{$this->getName()}' AS type",
56 - 'pl_namespace AS namespace',
 55+ 'fields' => array ( 'pl_namespace AS namespace',
5756 'pl_title AS title',
5857 'COUNT(*) AS value' ),
5958 'conds' => array ( 'pg1.page_namespace IS NULL',
Index: branches/querypage-work/phase3/includes/specials/SpecialShortpages.php
@@ -30,8 +30,7 @@
3131 function getQueryInfo() {
3232 return array (
3333 'tables' => array ( 'page' ),
34 - 'fields' => array ( "'{$this->getName()}' AS type",
35 - 'page_namespace AS namespace',
 34+ 'fields' => array ( 'page_namespace AS namespace',
3635 'page_title AS title',
3736 'page_len AS value' ),
3837 'conds' => array ( 'page_namespace' => MWNamespace::getContentNamespaces(),
Index: branches/querypage-work/phase3/includes/specials/SpecialDoubleRedirects.php
@@ -28,8 +28,7 @@
2929 'tables' => array ( 'redirect AS ra', 'redirect AS rb',
3030 'page AS pa', 'page AS pb',
3131 'page AS pc' ),
32 - 'fields' => array ( '"{$this->getName()}" AS type',
33 - 'pa.page_namespace AS namespace',
 32+ 'fields' => array ( 'pa.page_namespace AS namespace',
3433 'pa.page_title AS title',
3534 'pb.page_namespace AS nsb',
3635 'pb.page_title AS tb',
Index: branches/querypage-work/TODO
@@ -5,8 +5,8 @@
66 ** Check whether sorts are efficient and page right
77 ** Check whether sorting by nothing is really what we want
88 ** Check whether selecting title or ns AS value is really what we want
9 -* Replace $result->type with getName(), remove type from queries
109 * Mark ShortPages as inexpensive
1110 * Reuse UncategorizedPages code in UncategorizedImages somehow
1211 * Make UncategorizedPages parameterized by namespace
1312
 13+* Convert UncategorizedImages

Follow-up revisions

RevisionCommit summaryAuthorDate
r65320querypage-work2: Merge r50105reedy14:19, 20 April 2010

Status & tagging log