r50378 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50377‎ | r50378 | r50379 >
Date:18:54, 9 May 2009
Author:catrope
Status:deferred
Tags:
Comment:
querypage-work: Various fixes; mostly working now, but needs some more improvements (see TODO file)
Modified paths:
  • /branches/querypage-work/TODO (modified) (history)
  • /branches/querypage-work/phase3/includes/AutoLoader.php (modified) (history)
  • /branches/querypage-work/phase3/includes/ImageQueryPage.php (modified) (history)
  • /branches/querypage-work/phase3/includes/QueryPage.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialBrokenRedirects.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialFewestrevisions.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/SpecialMostlinkedtemplates.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialUncategorizedimages.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialUnusedtemplates.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialWantedpages.php (modified) (history)
  • /branches/querypage-work/phase3/includes/specials/SpecialWantedtemplates.php (modified) (history)

Diff [purge]

Index: branches/querypage-work/phase3/includes/ImageQueryPage.php
@@ -7,7 +7,7 @@
88 * @ingroup SpecialPage
99 * @author Rob Church <robchur@gmail.com>
1010 */
11 -class ImageQueryPage extends QueryPage {
 11+abstract class ImageQueryPage extends QueryPage {
1212
1313 /**
1414 * Format and output report results using the given information plus
@@ -37,6 +37,9 @@
3838 $out->addHTML( $gallery->toHtml() );
3939 }
4040 }
 41+
 42+ // Gotta override this since it's abstract
 43+ function formatResult( $skin, $result ) { }
4144
4245 /**
4346 * Prepare an image object given a result row
Index: branches/querypage-work/phase3/includes/AutoLoader.php
@@ -89,6 +89,7 @@
9090 'HTMLCacheUpdate' => 'includes/HTMLCacheUpdate.php',
9191 'HTMLCacheUpdateJob' => 'includes/HTMLCacheUpdate.php',
9292 'HTMLFileCache' => 'includes/HTMLFileCache.php',
 93+ 'HTMLForm' => 'includes/HTMLForm.php',
9394 'Http' => 'includes/HttpFunctions.php',
9495 'IEContentAnalyzer' => 'includes/IEContentAnalyzer.php',
9596 'ImageGallery' => 'includes/ImageGallery.php',
@@ -140,6 +141,7 @@
141142 'PatrolLog' => 'includes/PatrolLog.php',
142143 'PostgresSearchResult' => 'includes/SearchPostgres.php',
143144 'PostgresSearchResultSet' => 'includes/SearchPostgres.php',
 145+ 'Preferences' => 'includes/Preferences.php',
144146 'PrefixSearch' => 'includes/PrefixSearch.php',
145147 'Profiler' => 'includes/Profiler.php',
146148 'ProfilerSimple' => 'includes/ProfilerSimple.php',
@@ -202,6 +204,7 @@
203205 'UserArrayFromResult' => 'includes/UserArray.php',
204206 'UserMailer' => 'includes/UserMailer.php',
205207 'UserRightsProxy' => 'includes/UserRightsProxy.php',
 208+ 'WantedQueryPage' => 'includes/QueryPage.php',
206209 'WatchedItem' => 'includes/WatchedItem.php',
207210 'WatchlistEditor' => 'includes/WatchlistEditor.php',
208211 'WebRequest' => 'includes/WebRequest.php',
@@ -485,7 +488,7 @@
486489 'PageArchive' => 'includes/specials/SpecialUndelete.php',
487490 'SpecialResetpass' => 'includes/specials/SpecialResetpass.php',
488491 'PopularPagesPage' => 'includes/specials/SpecialPopularpages.php',
489 - 'PreferencesForm' => 'includes/specials/SpecialPreferences.php',
 492+ 'PreferencesForm' => 'includes/Preferences.php',
490493 'RandomPage' => 'includes/specials/SpecialRandompage.php',
491494 'SpecialRevisionDelete' => 'includes/specials/SpecialRevisiondelete.php',
492495 'RevisionDeleter' => 'includes/specials/SpecialRevisiondelete.php',
@@ -496,6 +499,7 @@
497500 'SpecialImport' => 'includes/specials/SpecialImport.php',
498501 'SpecialListGroupRights' => 'includes/specials/SpecialListgrouprights.php',
499502 'SpecialMostlinkedtemplates' => 'includes/specials/SpecialMostlinkedtemplates.php',
 503+ 'SpecialPreferences' => 'includes/specials/SpecialPreferences.php',
500504 'SpecialPrefixindex' => 'includes/specials/SpecialPrefixindex.php',
501505 'SpecialRandomredirect' => 'includes/specials/SpecialRandomredirect.php',
502506 'SpecialRecentchanges' => 'includes/specials/SpecialRecentchanges.php',
@@ -505,6 +509,7 @@
506510 'SpecialStatistics' => 'includes/specials/SpecialStatistics.php',
507511 'SpecialTags' => 'includes/specials/SpecialTags.php',
508512 'SpecialVersion' => 'includes/specials/SpecialVersion.php',
 513+ 'SpecialWhatlinkshere' => 'includes/specials/SpecialWhatlinkshere.php',
509514 'UncategorizedCategoriesPage' => 'includes/specials/SpecialUncategorizedcategories.php',
510515 'UncategorizedPagesPage' => 'includes/specials/SpecialUncategorizedpages.php',
511516 'UncategorizedTemplatesPage' => 'includes/specials/SpecialUncategorizedtemplates.php',
@@ -521,7 +526,6 @@
522527 'WantedFilesPage' => 'includes/specials/SpecialWantedfiles.php',
523528 'WantedPagesPage' => 'includes/specials/SpecialWantedpages.php',
524529 'WantedTemplatesPage' => 'includes/specials/SpecialWantedtemplates.php',
525 - 'WhatLinksHerePage' => 'includes/specials/SpecialWhatlinkshere.php',
526530 'WikiImporter' => 'includes/Import.php',
527531 'WikiRevision' => 'includes/Import.php',
528532 'WithoutInterwikiPage' => 'includes/specials/SpecialWithoutinterwiki.php',
Property changes on: branches/querypage-work/phase3/includes/AutoLoader.php
___________________________________________________________________
Name: svn:mergeinfo
529533 + /trunk/phase3/includes/AutoLoader.php:49082-50377
Index: branches/querypage-work/phase3/includes/specials/SpecialFewestrevisions.php
@@ -39,7 +39,7 @@
4040 // useful to remove this. People _do_ create pages
4141 // and never revise them, they aren't necessarily
4242 // redirects.
43 - 'GROUP BY' => 'page_namespace, page_title' .
 43+ 'GROUP BY' => 'page_namespace, page_title, ' .
4444 'page_is_redirect' )
4545 );
4646 }
Index: branches/querypage-work/phase3/includes/specials/SpecialWantedtemplates.php
@@ -33,7 +33,8 @@
3434 'join_conds' => array ( 'page' => array ( 'LEFT JOIN',
3535 array ( 'page_namespace = tl_namespace',
3636 'page_title = tl_title' ) ) )
37 - );
 37+ );
 38+ }
3839 }
3940
4041 /**
Index: branches/querypage-work/phase3/includes/specials/SpecialBrokenRedirects.php
@@ -34,7 +34,6 @@
3535 'conds' => array( 'rd_namespace >= 0',
3636 'p2.page_namespace IS NULL'
3737 ),
38 - // TODO test this join
3938 'join_conds' => array( 'page AS p1' => array( 'LEFT JOIN', array(
4039 'rd_from=p1.page_id',
4140 ) ),
Index: branches/querypage-work/phase3/includes/specials/SpecialMostcategories.php
@@ -27,7 +27,6 @@
2828 'conds' => array ( 'page_namespace' => MWNamespace::getContentNamespaces() ),
2929 'options' => array ( 'HAVING' => 'COUNT(*) > 1',
3030 'GROUP BY' => 'page_namespace, page_title' ),
31 - // TODO: test this JOIN
3231 'join_conds' => array ( 'page' => array ( 'LEFT JOIN',
3332 'page_id = cl_from' ) )
3433 );
Index: branches/querypage-work/phase3/includes/specials/SpecialLonelypages.php
@@ -38,7 +38,6 @@
3939 'page_namespace' => MWNamespace::getContentNamespaces(),
4040 'page_is_redirect' => 0,
4141 'tl_namespace IS NULL' ),
42 - // TODO: test this JOIN
4342 'join_conds' => array (
4443 'pagelinks' => array (
4544 'LEFT JOIN', array (
Index: branches/querypage-work/phase3/includes/specials/SpecialMostlinkedtemplates.php
@@ -55,7 +55,7 @@
5656 'fields' => array ( 'tl_namespace AS namespace',
5757 'tl_title AS title',
5858 'COUNT(*) AS value' ),
59 - 'conds' => array ( 'tl_namespace' => NS_TEMPLATE' ),
 59+ 'conds' => array ( 'tl_namespace' => NS_TEMPLATE ),
6060 'options' => array( 'GROUP BY' => 'tl_title' )
6161 );
6262 }
Index: branches/querypage-work/phase3/includes/specials/SpecialUnusedtemplates.php
@@ -26,7 +26,7 @@
2727 '0 AS value' ),
2828 'conds' => array ( 'page_namespace' => NS_TEMPLATE,
2929 'tl_from IS NULL',
30 - 'page_redirect' => 0 ),
 30+ 'page_is_redirect' => 0 ),
3131 'join_conds' => array ( 'templatelinks' => array (
3232 'LEFT JOIN', array ( 'tl_title = page_title',
3333 'tl_namespace = page_namespace' ) ) )
Index: branches/querypage-work/phase3/includes/specials/SpecialUncategorizedimages.php
@@ -39,6 +39,20 @@
4040 FROM {$page} LEFT JOIN {$categorylinks} ON page_id = cl_from
4141 WHERE cl_from IS NULL AND page_namespace = {$ns} AND page_is_redirect = 0";
4242 }
 43+
 44+ function getQueryInfo() {
 45+ return array (
 46+ 'tables' => array( 'page', 'categorylinks' ),
 47+ 'fields' => array( 'page_namespace AS namespace',
 48+ 'page_title AS title',
 49+ 'page_title AS value' ),
 50+ 'conds' => array( 'cl_from IS NULL',
 51+ 'page_namespace' => NS_FILE,
 52+ 'page_is_redirect' => 0 ),
 53+ 'join_conds' => array( 'categorylinks' => array(
 54+ 'LEFT JOIN', 'cl_from=page_id' ) )
 55+ );
 56+ }
4357
4458 }
4559
Index: branches/querypage-work/phase3/includes/specials/SpecialWantedpages.php
@@ -61,11 +61,10 @@
6262 NS_MEDIAWIKI . "'" ),
6363 'options' => array ( 'HAVING' => "COUNT(*) > $count",
6464 'GROUP BY' => 'pl_namespace, pl_title' ),
65 - // TODO: test this join
6665 'join_conds' => array ( 'page AS pg1' => array (
6766 'LEFT JOIN', array (
6867 'pg1.page_namespace = pl_namespace',
69 - 'pg2.page_title = pl_title' ) ),
 68+ 'pg1.page_title = pl_title' ) ),
7069 'page AS pg2' => array ( 'LEFT JOIN',
7170 'pg2.page_id = pl_from' ) )
7271 );
Index: branches/querypage-work/phase3/includes/QueryPage.php
@@ -310,7 +310,7 @@
311311 $field .= ' DESC';
312312 }
313313 }
314 - if( !is_array( $query['options'] ) ) {
 314+ if( !is_array( @$query['options'] ) ) {
315315 $options = array ();
316316 }
317317 if( count( $order ) ) {
@@ -324,10 +324,10 @@
325325 }
326326
327327 $dbr = wfGetDB( DB_SLAVE );
328 - $res = $dbr->select( (array)$query['tables'],
329 - (array)$query['fields'],
330 - (array)$query['conds'], $fname,
331 - $query['options'], (array)$query['join_conds']
 328+ $res = $dbr->select( (array)@$query['tables'],
 329+ (array)@$query['fields'],
 330+ (array)@$query['conds'], $fname,
 331+ $query['options'], (array)@$query['join_conds']
332332 );
333333 return $dbr->resultObject( $res );
334334 }
Index: branches/querypage-work/TODO
@@ -1,12 +1,10 @@
2 -* Test JOINs using table aliases
32 * Make INNER JOIN implicit in Unusedimages?
43 * Find and migrate code using WantedPages::getSQL hook
54 * Check sorting sanity
65 ** Check whether sorts are efficient and page right
76 ** Check whether sorting by nothing is really what we want
87 ** Check whether selecting title or ns AS value is really what we want
 8+* Track down and fix pages querying page info one title at a time
99 * Mark ShortPages as inexpensive
1010 * Reuse UncategorizedPages code in UncategorizedImages somehow
1111 * Make UncategorizedPages parameterized by namespace
12 -
13 -* Convert UncategorizedImages

Follow-up revisions

RevisionCommit summaryAuthorDate
r65321querypage-work2: Merge r50378reedy14:22, 20 April 2010

Status & tagging log