r65326 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65325‎ | r65326 | r65327 >
Date:14:32, 20 April 2010
Author:reedy
Status:deferred
Tags:
Comment:
querypage-work2: Merge r51597
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/AutoLoader.php (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/OutputPage.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/QueryPage.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/SpecialPage.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/SpecialBrokenRedirects.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/SpecialDoubleRedirects.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialFewestrevisions.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialLinkSearch.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialListredirects.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialLonelypages.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialLongpages.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialMostcategories.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialMostimages.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialMostlinked.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialMostlinkedcategories.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialMostrevisions.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/SpecialUncategorizedcategories.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialUncategorizedimages.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialUncategorizedpages.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialUncategorizedtemplates.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialUnusedcategories.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialUnusedimages.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialUnusedtemplates.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialUnwatchedpages.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialWantedcategories.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialWantedfiles.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialWantedpages.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialWantedtemplates.php (modified) (history)
  • /branches/querypage-work2/phase3/includes/specials/SpecialWithoutinterwiki.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]

Index: branches/querypage-work2/phase3/includes/specials/SpecialUncategorizedimages.php
@@ -13,8 +13,8 @@
1414 // FIXME: Use an instance of UncategorizedPagesPage or something
1515 class UncategorizedImagesPage extends ImageQueryPage {
1616
17 - function getName() {
18 - return 'Uncategorizedimages';
 17+ function __construct() {
 18+ SpecialPage::__construct( 'Uncategorizedimages' );
1919 }
2020
2121 function sortDescending() {
@@ -45,9 +45,3 @@
4646 }
4747
4848 }
49 -
50 -function wfSpecialUncategorizedimages() {
51 - $uip = new UncategorizedImagesPage();
52 - list( $limit, $offset ) = wfCheckLimits();
53 - return $uip->doQuery( $offset, $limit );
54 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialWantedpages.php
@@ -11,13 +11,25 @@
1212 class WantedPagesPage extends WantedQueryPage {
1313 var $nlinks;
1414
15 - function WantedPagesPage( $inc = false, $nlinks = true ) {
16 - $this->setListoutput( $inc );
17 - $this->nlinks = $nlinks;
 15+ function __construct() {
 16+ SpecialPage::__construct( 'Wantedpages' );
1817 }
 18+
 19+ function execute( $par ) {
 20+ $inc = $this->including();
1921
20 - function getName() {
21 - return 'Wantedpages';
 22+ if ( $inc ) {
 23+ @list( $limit, $nlinks ) = explode( '/', $par, 2 );
 24+ $this->limit = (int)$limit;
 25+ // FIXME: nlinks is ignored
 26+ $nlinks = $nlinks === 'nlinks';
 27+ $this->offset = 0;
 28+ } else {
 29+ $nlinks = true;
 30+ }
 31+ $this->setListOutput( $inc );
 32+ $this->shownavigation = !$inc;
 33+ parent::execute( $par );
2234 }
2335
2436 function getSQL() {
@@ -74,24 +86,3 @@
7587 return $query;
7688 }
7789 }
78 -
79 -/**
80 - * constructor
81 - */
82 -function wfSpecialWantedpages( $par = null, $specialPage ) {
83 - $inc = $specialPage->including();
84 -
85 - if ( $inc ) {
86 - @list( $limit, $nlinks ) = explode( '/', $par, 2 );
87 - $limit = (int)$limit;
88 - $nlinks = $nlinks === 'nlinks';
89 - $offset = 0;
90 - } else {
91 - list( $limit, $offset ) = wfCheckLimits();
92 - $nlinks = true;
93 - }
94 -
95 - $wpp = new WantedPagesPage( $inc, $nlinks );
96 -
97 - $wpp->doQuery( $offset, $limit, !$inc );
98 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialUnusedcategories.php
@@ -12,8 +12,8 @@
1313 // inexpensive?
1414 function isExpensive() { return true; }
1515
16 - function getName() {
17 - return 'Unusedcategories';
 16+ function __construct() {
 17+ SpecialPage::__construct( 'Unusedcategories' );
1818 }
1919
2020 function getPageHeader() {
@@ -39,10 +39,3 @@
4040 return $skin->makeKnownLinkObj( $title, $title->getText() );
4141 }
4242 }
43 -
44 -/** constructor */
45 -function wfSpecialUnusedCategories() {
46 - list( $limit, $offset ) = wfCheckLimits();
47 - $uc = new UnusedCategoriesPage();
48 - return $uc->doQuery( $offset, $limit );
49 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialDoubleRedirects.php
@@ -11,10 +11,10 @@
1212 */
1313 class DoubleRedirectsPage extends PageQueryPage {
1414
15 - function getName() {
16 - return 'DoubleRedirects';
 15+ function __construct() {
 16+ SpecialPage::__construct( 'DoubleRedirects' );
1717 }
18 -
 18+
1919 // inexpensive?
2020 function isExpensive() { return true; }
2121 function isSyndicated() { return false; }
@@ -108,15 +108,3 @@
109109 return( "{$linkA} {$edit} {$arr} {$linkB} {$arr} {$linkC}" );
110110 }
111111 }
112 -
113 -/**
114 - * constructor
115 - */
116 -function wfSpecialDoubleRedirects() {
117 - list( $limit, $offset ) = wfCheckLimits();
118 -
119 - $sdr = new DoubleRedirectsPage();
120 -
121 - return $sdr->doQuery( $offset, $limit );
122 -
123 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialLongpages.php
@@ -10,22 +10,11 @@
1111 */
1212 class LongPagesPage extends ShortPagesPage {
1313
14 - function getName() {
15 - return "Longpages";
 14+ function __construct() {
 15+ SpecialPage::__construct( 'Longpages' );
1616 }
1717
1818 function sortDescending() {
1919 return true;
2020 }
2121 }
22 -
23 -/**
24 - * constructor
25 - */
26 -function wfSpecialLongpages() {
27 - list( $limit, $offset ) = wfCheckLimits();
28 -
29 - $lpp = new LongPagesPage();
30 -
31 - $lpp->doQuery( $offset, $limit );
32 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialMostcategories.php
@@ -14,7 +14,10 @@
1515 */
1616 class MostcategoriesPage extends QueryPage {
1717
18 - function getName() { return 'Mostcategories'; }
 18+ function __construct() {
 19+ SpecialPage::__construct( 'Mostcategories' );
 20+ }
 21+
1922 function isExpensive() { return true; }
2023 function isSyndicated() { return false; }
2124
@@ -41,14 +44,3 @@
4245 return wfSpecialList( $link, $count );
4346 }
4447 }
45 -
46 -/**
47 - * constructor
48 - */
49 -function wfSpecialMostcategories() {
50 - list( $limit, $offset ) = wfCheckLimits();
51 -
52 - $wpp = new MostcategoriesPage();
53 -
54 - $wpp->doQuery( $offset, $limit );
55 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialWantedcategories.php
@@ -15,8 +15,8 @@
1616 */
1717 class WantedCategoriesPage extends WantedQueryPage {
1818
19 - function getName() {
20 - return 'Wantedcategories';
 19+ function __construct() {
 20+ SpecialPage::__construct( 'Wantedcategories' );
2121 }
2222
2323 function getQueryInfo() {
@@ -54,14 +54,3 @@
5555 return wfSpecialList($plink, $nlinks);
5656 }
5757 }
58 -
59 -/**
60 - * constructor
61 - */
62 -function wfSpecialWantedCategories() {
63 - list( $limit, $offset ) = wfCheckLimits();
64 -
65 - $wpp = new WantedCategoriesPage();
66 -
67 - $wpp->doQuery( $offset, $limit );
68 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialUnusedimages.php
@@ -13,10 +13,10 @@
1414 // inexpensive?
1515 function isExpensive() { return true; }
1616
17 - function getName() {
18 - return 'Unusedimages';
 17+ function __construct() {
 18+ SpecialPage::__construct( 'Unusedimages' );
1919 }
20 -
 20+
2121 function sortDescending() {
2222 return false;
2323 }
@@ -62,13 +62,3 @@
6363 }
6464
6565 }
66 -
67 -/**
68 - * Entry point
69 - */
70 -function wfSpecialUnusedimages() {
71 - list( $limit, $offset ) = wfCheckLimits();
72 - $uip = new UnusedimagesPage();
73 -
74 - return $uip->doQuery( $offset, $limit );
75 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialWithoutinterwiki.php
@@ -13,9 +13,19 @@
1414 class WithoutInterwikiPage extends PageQueryPage {
1515 private $prefix = '';
1616
17 - function getName() {
18 - return 'Withoutinterwiki';
 17+ function __construct() {
 18+ SpecialPage::__construct( 'Withoutinterwiki' );
1919 }
 20+
 21+ function execute( $par ) {
 22+ global $wgRequest, $wgContLang, $wgCapitalLinks;
 23+ $prefix = $wgRequest->getVal( 'prefix', $par );
 24+ if( $wgCapitalLinks ) {
 25+ $prefix = $wgContLang->ucfirst( $prefix );
 26+ }
 27+ $this->prefix = $prefix;
 28+ parent::execute( $par );
 29+ }
2030
2131 function getPageHeader() {
2232 global $wgScript, $wgMiserMode;
@@ -85,7 +95,4 @@
8696 list( $limit, $offset ) = wfCheckLimits();
8797 // Only searching the mainspace anyway
8898 $prefix = Title::capitalize( $wgRequest->getVal( 'prefix' ), NS_MAIN );
89 - $wip = new WithoutInterwikiPage();
90 - $wip->setPrefix( $prefix );
91 - $wip->doQuery( $offset, $limit );
9299 }
Index: branches/querypage-work2/phase3/includes/specials/SpecialFewestrevisions.php
@@ -12,10 +12,10 @@
1313 */
1414 class FewestrevisionsPage extends QueryPage {
1515
16 - function getName() {
17 - return 'Fewestrevisions';
 16+ function __construct() {
 17+ SpecialPage::__construct( 'Fewestrevisions' );
1818 }
19 -
 19+
2020 function isExpensive() {
2121 return true;
2222 }
@@ -77,9 +77,3 @@
7878 return wfSpecialList( $plink, $nlink );
7979 }
8080 }
81 -
82 -function wfSpecialFewestrevisions() {
83 - list( $limit, $offset ) = wfCheckLimits();
84 - $frp = new FewestrevisionsPage();
85 - $frp->doQuery( $offset, $limit );
86 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialWantedtemplates.php
@@ -16,8 +16,8 @@
1717 */
1818 class WantedTemplatesPage extends WantedQueryPage {
1919
20 - function getName() {
21 - return 'Wantedtemplates';
 20+ function __construct() {
 21+ SpecialPage::__construct( 'Wantedtemplates' );
2222 }
2323
2424 function getQueryInfo() {
@@ -36,14 +36,3 @@
3737 );
3838 }
3939 }
40 -
41 -/**
42 - * constructor
43 - */
44 -function wfSpecialWantedTemplates() {
45 - list( $limit, $offset ) = wfCheckLimits();
46 -
47 - $wpp = new WantedTemplatesPage();
48 -
49 - $wpp->doQuery( $offset, $limit );
50 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialAncientpages.php
@@ -10,8 +10,8 @@
1111 */
1212 class AncientPagesPage extends QueryPage {
1313
14 - function getName() {
15 - return "Ancientpages";
 14+ function __construct() {
 15+ SpecialPage::__construct( 'Ancientpages' );
1616 }
1717
1818 function isExpensive() {
@@ -52,11 +52,3 @@
5353 return wfSpecialList($link, htmlspecialchars($d) );
5454 }
5555 }
56 -
57 -function wfSpecialAncientpages() {
58 - list( $limit, $offset ) = wfCheckLimits();
59 -
60 - $app = new AncientPagesPage();
61 -
62 - $app->doQuery( $offset, $limit );
63 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialUnwatchedpages.php
@@ -15,7 +15,10 @@
1616 */
1717 class UnwatchedpagesPage extends QueryPage {
1818
19 - function getName() { return 'Unwatchedpages'; }
 19+ function __construct() {
 20+ SpecialPage::__construct( 'Unwatchedpages' );
 21+ }
 22+
2023 // inexpensive?
2124 function isExpensive() { return true; }
2225 function isSyndicated() { return false; }
@@ -40,6 +43,7 @@
4144
4245 function getOrderFields() {
4346 return array( 'page_namespace', 'page_title' );
 47+ }
4448
4549 function formatResult( $skin, $result ) {
4650 global $wgContLang;
@@ -60,20 +64,4 @@
6165
6266 return wfSpecialList( $plink, $wlink );
6367 }
64 -}
65 -
66 -/**
67 - * constructor
68 - */
69 -function wfSpecialUnwatchedpages() {
70 - global $wgUser, $wgOut;
71 -
72 - if ( ! $wgUser->isAllowed( 'unwatchedpages' ) )
73 - return $wgOut->permissionRequired( 'unwatchedpages' );
74 -
75 - list( $limit, $offset ) = wfCheckLimits();
76 -
77 - $wpp = new UnwatchedpagesPage();
78 -
79 - $wpp->doQuery( $offset, $limit );
80 -}
 68+}
\ No newline at end of file
Index: branches/querypage-work2/phase3/includes/specials/SpecialDeadendpages.php
@@ -9,8 +9,8 @@
1010 */
1111 class DeadendPagesPage extends PageQueryPage {
1212
13 - function getName() {
14 - return "Deadendpages";
 13+ function __construct() {
 14+ SpecialPage::__construct( 'Deadendpages' );
1515 }
1616
1717 function getPageHeader() {
@@ -62,15 +62,3 @@
6363 return array( 'page_title' );
6464 }
6565 }
66 -
67 -/**
68 - * Constructor
69 - */
70 -function wfSpecialDeadendpages() {
71 -
72 - list( $limit, $offset ) = wfCheckLimits();
73 -
74 - $depp = new DeadendPagesPage();
75 -
76 - return $depp->doQuery( $offset, $limit );
77 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialMostimages.php
@@ -14,7 +14,10 @@
1515 */
1616 class MostimagesPage extends ImageQueryPage {
1717
18 - function getName() { return 'Mostimages'; }
 18+ function __construct() {
 19+ SpecialPage::__construct( 'Mostimages' );
 20+ }
 21+
1922 function isExpensive() { return true; }
2023 function isSyndicated() { return false; }
2124
@@ -36,14 +39,3 @@
3740 }
3841
3942 }
40 -
41 -/**
42 - * Constructor
43 - */
44 -function wfSpecialMostimages() {
45 - list( $limit, $offset ) = wfCheckLimits();
46 -
47 - $wpp = new MostimagesPage();
48 -
49 - $wpp->doQuery( $offset, $limit );
50 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialMostlinkedcategories.php
@@ -15,7 +15,10 @@
1616 */
1717 class MostlinkedCategoriesPage extends QueryPage {
1818
19 - function getName() { return 'Mostlinkedcategories'; }
 19+ function __construct() {
 20+ SpecialPage::__construct( 'Mostlinkedcategories' );
 21+ }
 22+
2023 function isExpensive() { return true; }
2124 function isSyndicated() { return false; }
2225
@@ -59,14 +62,3 @@
6063 return wfSpecialList($plink, $nlinks);
6164 }
6265 }
63 -
64 -/**
65 - * constructor
66 - */
67 -function wfSpecialMostlinkedCategories() {
68 - list( $limit, $offset ) = wfCheckLimits();
69 -
70 - $wpp = new MostlinkedCategoriesPage();
71 -
72 - $wpp->doQuery( $offset, $limit );
73 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialDisambiguations.php
@@ -9,8 +9,8 @@
1010 */
1111 class DisambiguationsPage extends PageQueryPage {
1212
13 - function getName() {
14 - return 'Disambiguations';
 13+ function __construct() {
 14+ SpecialPage::__construct( 'Disambiguations' );
1515 }
1616
1717 function isExpensive() { return true; }
@@ -141,7 +141,7 @@
142142 }
143143
144144 function getOrderFields() {
145 - return array('tl_namespace', 'tl_title', 'value');
 145+ return array( 'tl_namespace', 'tl_title', 'value' );
146146 }
147147
148148 function sortDescending() {
@@ -177,14 +177,3 @@
178178 return "$from $edit $arr $to";
179179 }
180180 }
181 -
182 -/**
183 - * Constructor
184 - */
185 -function wfSpecialDisambiguations() {
186 - list( $limit, $offset ) = wfCheckLimits();
187 -
188 - $sd = new DisambiguationsPage();
189 -
190 - return $sd->doQuery( $offset, $limit );
191 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialUncategorizedpages.php
@@ -12,8 +12,8 @@
1313 class UncategorizedPagesPage extends PageQueryPage {
1414 var $requestedNamespace = false;
1515
16 - function getName() {
17 - return "Uncategorizedpages";
 16+ function __construct() {
 17+ SpecialPage::__construct( 'Uncategorizedpages' );
1818 }
1919
2020 function sortDescending() {
@@ -50,14 +50,3 @@
5151 return array( 'page_title' );
5252 }
5353 }
54 -
55 -/**
56 - * constructor
57 - */
58 -function wfSpecialUncategorizedpages() {
59 - list( $limit, $offset ) = wfCheckLimits();
60 -
61 - $lpp = new UncategorizedPagesPage();
62 -
63 - return $lpp->doQuery( $offset, $limit );
64 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialBrokenRedirects.php
@@ -12,10 +12,10 @@
1313 class BrokenRedirectsPage extends PageQueryPage {
1414 var $targets = array();
1515
16 - function getName() {
17 - return 'BrokenRedirects';
 16+ function __construct() {
 17+ SpecialPage::__construct( 'BrokenRedirects' );
1818 }
19 -
 19+
2020 // inexpensive?
2121 function isExpensive() { return true; }
2222 function isSyndicated() { return false; }
@@ -87,14 +87,3 @@
8888 return $out;
8989 }
9090 }
91 -
92 -/**
93 - * constructor
94 - */
95 -function wfSpecialBrokenRedirects() {
96 - list( $limit, $offset ) = wfCheckLimits();
97 -
98 - $sbr = new BrokenRedirectsPage();
99 -
100 - return $sbr->doQuery( $offset, $limit );
101 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialWantedfiles.php
@@ -15,8 +15,8 @@
1616 */
1717 class WantedFilesPage extends WantedQueryPage {
1818
19 - function getName() {
20 - return 'Wantedfiles';
 19+ function __construct() {
 20+ SpecialPage::__construct( 'Wantedfiles' );
2121 }
2222
2323 function getQueryInfo() {
@@ -33,14 +33,3 @@
3434 );
3535 }
3636 }
37 -
38 -/**
39 - * constructor
40 - */
41 -function wfSpecialWantedFiles() {
42 - list( $limit, $offset ) = wfCheckLimits();
43 -
44 - $wpp = new WantedFilesPage();
45 -
46 - $wpp->doQuery( $offset, $limit );
47 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialShortpages.php
@@ -11,8 +11,8 @@
1212 */
1313 class ShortPagesPage extends QueryPage {
1414
15 - function getName() {
16 - return 'Shortpages';
 15+ function __construct() {
 16+ SpecialPage::__construct( 'Shortpages' );
1717 }
1818
1919 // inexpensive?
@@ -40,12 +40,7 @@
4141 }
4242
4343 function getOrderFields() {
44 - // For some crazy reason ordering by a constant
45 - // causes a filesort
46 - if( count( MWNamespace::getContentNamespaces() ) > 1 )
47 - return array( 'page_namespace', 'page_title' );
48 - else
49 - return array( 'page_title' );
 44+ return array( 'page_len' );
5045 }
5146
5247 function preprocessResults( $db, $res ) {
@@ -89,14 +84,3 @@
9085 : "({$hlink}) {$dm}{$plink} {$dm}[{$size}]";
9186 }
9287 }
93 -
94 -/**
95 - * constructor
96 - */
97 -function wfSpecialShortpages() {
98 - list( $limit, $offset ) = wfCheckLimits();
99 -
100 - $spp = new ShortPagesPage();
101 -
102 - return $spp->doQuery( $offset, $limit );
103 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialListredirects.php
@@ -14,7 +14,10 @@
1515 */
1616 class ListredirectsPage extends QueryPage {
1717
18 - function getName() { return 'Listredirects'; }
 18+ function __construct() {
 19+ SpecialPage::__construct( 'Listredirects' );
 20+ }
 21+
1922 // inexpensive?
2023 function isExpensive() { return true; }
2124 function isSyndicated() { return false; }
@@ -78,9 +81,3 @@
7982 }
8083 }
8184 }
82 -
83 -function wfSpecialListredirects() {
84 - list( $limit, $offset ) = wfCheckLimits();
85 - $lrp = new ListredirectsPage();
86 - $lrp->doQuery( $offset, $limit );
87 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialUncategorizedtemplates.php
@@ -14,11 +14,10 @@
1515 class UncategorizedTemplatesPage extends UncategorizedPagesPage {
1616
1717 var $requestedNamespace = NS_TEMPLATE;
18 -
19 - public function getName() {
20 - return 'Uncategorizedtemplates';
 18+
 19+ public function __construct() {
 20+ SpecialPage::__construct( 'Uncategorizedtemplates' );
2121 }
22 -
2322 }
2423
2524 /**
Index: branches/querypage-work2/phase3/includes/specials/SpecialLonelypages.php
@@ -11,9 +11,10 @@
1212 */
1313 class LonelyPagesPage extends PageQueryPage {
1414
15 - function getName() {
16 - return "Lonelypages";
 15+ function __construct() {
 16+ SpecialPage::__construct( 'Lonelypages' );
1717 }
 18+
1819 function getPageHeader() {
1920 return wfMsgExt( 'lonelypagestext', array( 'parse' ) );
2021 }
@@ -60,14 +61,3 @@
6162 return array( 'page_title' );
6263 }
6364 }
64 -
65 -/**
66 - * Constructor
67 - */
68 -function wfSpecialLonelypages() {
69 - list( $limit, $offset ) = wfCheckLimits();
70 -
71 - $lpp = new LonelyPagesPage();
72 -
73 - return $lpp->doQuery( $offset, $limit );
74 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialPopularpages.php
@@ -1,17 +1,12 @@
22 <?php
33 /**
4 - * @file
5 - * @ingroup SpecialPage
6 - */
7 -
8 -/**
94 * implements Special:Popularpages
105 * @ingroup SpecialPage
116 */
127 class PopularPagesPage extends QueryPage {
138
14 - function getName() {
15 - return "Popularpages";
 9+ function __construct() {
 10+ SpecialPage::__construct( 'Popularpages' );
1611 }
1712
1813 function isExpensive() {
@@ -45,14 +40,3 @@
4641 return wfSpecialList($link, $nv);
4742 }
4843 }
49 -
50 -/**
51 - * Constructor
52 - */
53 -function wfSpecialPopularpages() {
54 - list( $limit, $offset ) = wfCheckLimits();
55 -
56 - $ppp = new PopularPagesPage();
57 -
58 - return $ppp->doQuery( $offset, $limit );
59 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialUncategorizedcategories.php
@@ -9,22 +9,9 @@
1010 * @ingroup SpecialPage
1111 */
1212 class UncategorizedCategoriesPage extends UncategorizedPagesPage {
13 - function UncategorizedCategoriesPage() {
14 - $this->requestedNamespace = NS_CATEGORY;
 13+ var $requestedNamespace = NS_CATEGORY;
 14+
 15+ function __construct() {
 16+ SpecialPage::__construct( 'Uncategorizedcategories' );
1517 }
16 -
17 - function getName() {
18 - return "Uncategorizedcategories";
19 - }
2018 }
21 -
22 -/**
23 - * constructor
24 - */
25 -function wfSpecialUncategorizedcategories() {
26 - list( $limit, $offset ) = wfCheckLimits();
27 -
28 - $lpp = new UncategorizedCategoriesPage();
29 -
30 - return $lpp->doQuery( $offset, $limit );
31 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialMostlinked.php
@@ -18,7 +18,10 @@
1919 */
2020 class MostlinkedPage extends QueryPage {
2121
22 - function getName() { return 'Mostlinked'; }
 22+ function __construct() {
 23+ SpecialPage::__construct( 'Mostlinked' );
 24+ }
 25+
2326 function isExpensive() { return true; }
2427 function isSyndicated() { return false; }
2528
@@ -84,14 +87,3 @@
8588 return wfSpecialList( $link, $wlh );
8689 }
8790 }
88 -
89 -/**
90 - * constructor
91 - */
92 -function wfSpecialMostlinked() {
93 - list( $limit, $offset ) = wfCheckLimits();
94 -
95 - $wpp = new MostlinkedPage();
96 -
97 - $wpp->doQuery( $offset, $limit );
98 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialUnusedtemplates.php
@@ -13,7 +13,10 @@
1414 */
1515 class UnusedtemplatesPage extends QueryPage {
1616
17 - function getName() { return( 'Unusedtemplates' ); }
 17+ function __construct() {
 18+ SpecialPage::__construct( 'Unusedtemplates' );
 19+ }
 20+
1821 // inexpensive?
1922 function isExpensive() { return true; }
2023 function isSyndicated() { return false; }
@@ -57,8 +60,3 @@
5861
5962 }
6063
61 -function wfSpecialUnusedtemplates() {
62 - list( $limit, $offset ) = wfCheckLimits();
63 - $utp = new UnusedtemplatesPage();
64 - $utp->doQuery( $offset, $limit );
65 -}
Index: branches/querypage-work2/phase3/includes/specials/SpecialLinkSearch.php
@@ -11,79 +11,77 @@
1212 * Special:LinkSearch to search the external-links table.
1313 * @ingroup SpecialPage
1414 */
15 -
16 -function wfSpecialLinkSearch( $par ) {
17 -
18 - list( $limit, $offset ) = wfCheckLimits();
19 - global $wgOut, $wgRequest, $wgUrlProtocols, $wgMiserMode, $wgLang;
20 - $target = $GLOBALS['wgRequest']->getVal( 'target', $par );
21 - $namespace = $GLOBALS['wgRequest']->getIntorNull( 'namespace', null );
22 -
23 - $protocols_list[] = '';
24 - foreach( $wgUrlProtocols as $prot ) {
25 - $protocols_list[] = $prot;
 15+class LinkSearchPage extends QueryPage {
 16+ function setParams( $params ) {
 17+ $this->mQuery = $params['query'];
 18+ $this->mNs = $params['namespace'];
 19+ $this->mProt = $params['protocol'];
2620 }
2721
28 - $target2 = $target;
29 - $protocol = '';
30 - $pr_sl = strpos($target2, '//' );
31 - $pr_cl = strpos($target2, ':' );
32 - if ( $pr_sl ) {
33 - // For protocols with '//'
34 - $protocol = substr( $target2, 0 , $pr_sl+2 );
35 - $target2 = substr( $target2, $pr_sl+2 );
36 - } elseif ( !$pr_sl && $pr_cl ) {
37 - // For protocols without '//' like 'mailto:'
38 - $protocol = substr( $target2, 0 , $pr_cl+1 );
39 - $target2 = substr( $target2, $pr_cl+1 );
40 - } elseif ( $protocol == '' && $target2 != '' ) {
41 - // default
42 - $protocol = 'http://';
 22+ function __construct() {
 23+ SpecialPage::__construct( 'LinkSearch' );
4324 }
44 - if ( !in_array( $protocol, $protocols_list ) ) {
45 - // unsupported protocol, show original search request
 25+
 26+ function execute( $par ) {
 27+ global $wgOut, $wgRequest, $wgUrlProtocols, $wgMiserMode, $wgLang, $wgScript;
 28+ $target = $wgRequest->getVal( 'target', $par );
 29+ $namespace = $wgRequest->getIntorNull( 'namespace', null );
 30+
 31+ $protocols_list[] = '';
 32+ foreach( $wgUrlProtocols as $prot ) {
 33+ $protocols_list[] = $prot;
 34+ }
 35+
4636 $target2 = $target;
4737 $protocol = '';
48 - }
 38+ $pr_sl = strpos($target2, '//' );
 39+ $pr_cl = strpos($target2, ':' );
 40+ if ( $pr_sl ) {
 41+ // For protocols with '//'
 42+ $protocol = substr( $target2, 0 , $pr_sl+2 );
 43+ $target2 = substr( $target2, $pr_sl+2 );
 44+ } elseif ( !$pr_sl && $pr_cl ) {
 45+ // For protocols without '//' like 'mailto:'
 46+ $protocol = substr( $target2, 0 , $pr_cl+1 );
 47+ $target2 = substr( $target2, $pr_cl+1 );
 48+ } elseif ( $protocol == '' && $target2 != '' ) {
 49+ // default
 50+ $protocol = 'http://';
 51+ }
 52+ if ( !in_array( $protocol, $protocols_list ) ) {
 53+ // unsupported protocol, show original search request
 54+ $target2 = $target;
 55+ $protocol = '';
 56+ }
4957
50 - $self = Title::makeTitle( NS_SPECIAL, 'Linksearch' );
 58+ $self = $this->getTitle();
5159
52 - $wgOut->addWikiText( wfMsg( 'linksearch-text', '<nowiki>' . $wgLang->commaList( $wgUrlProtocols) . '</nowiki>' ) );
53 - $s = Xml::openElement( 'form', array( 'id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $GLOBALS['wgScript'] ) ) .
54 - Xml::hidden( 'title', $self->getPrefixedDbKey() ) .
55 - '<fieldset>' .
56 - Xml::element( 'legend', array(), wfMsg( 'linksearch' ) ) .
57 - Xml::inputLabel( wfMsg( 'linksearch-pat' ), 'target', 'target', 50, $target ) . ' ';
58 - if ( !$wgMiserMode ) {
59 - $s .= Xml::label( wfMsg( 'linksearch-ns' ), 'namespace' ) . ' ' .
60 - XML::namespaceSelector( $namespace, '' );
61 - }
62 - $s .= Xml::submitButton( wfMsg( 'linksearch-ok' ) ) .
63 - '</fieldset>' .
64 - Xml::closeElement( 'form' );
65 - $wgOut->addHTML( $s );
 60+ $wgOut->addWikiText( wfMsg( 'linksearch-text', '<nowiki>' . $wgLang->commaList( $wgUrlProtocols ) . '</nowiki>' ) );
 61+ $s = Xml::openElement( 'form', array( 'id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $wgScript ) ) .
 62+ Xml::hidden( 'title', $self->getPrefixedDbKey() ) .
 63+ '<fieldset>' .
 64+ Xml::element( 'legend', array(), wfMsg( 'linksearch' ) ) .
 65+ Xml::inputLabel( wfMsg( 'linksearch-pat' ), 'target', 'target', 50, $target ) . ' ';
 66+ if ( !$wgMiserMode ) {
 67+ $s .= Xml::label( wfMsg( 'linksearch-ns' ), 'namespace' ) . ' ' .
 68+ Xml::namespaceSelector( $namespace, '' );
 69+ }
 70+ $s .= Xml::submitButton( wfMsg( 'linksearch-ok' ) ) .
 71+ '</fieldset>' .
 72+ Xml::closeElement( 'form' );
 73+ $wgOut->addHTML( $s );
6674
67 - if( $target != '' ) {
68 - $searcher = new LinkSearchPage;
69 - $searcher->setParams( array(
70 - 'query' => $target2,
71 - 'namespace' => $namespace,
72 - 'protocol' => $protocol ) );
73 - $searcher->doQuery( $offset, $limit );
 75+ if( $target != '' ) {
 76+ $this->setParams( array(
 77+ 'query' => $target2,
 78+ 'namespace' => $namespace,
 79+ 'protocol' => $protocol ) );
 80+ parent::execute( $par );
 81+ if( $this->mMungedQuery === false )
 82+ $wgOut->addWikiText( wfMsg( 'linksearch-error' ) );
 83+ }
7484 }
75 -}
7685
77 -class LinkSearchPage extends QueryPage {
78 - function setParams( $params ) {
79 - $this->mQuery = $params['query'];
80 - $this->mNs = $params['namespace'];
81 - $this->mProt = $params['protocol'];
82 - }
83 -
84 - function getName() {
85 - return 'LinkSearch';
86 - }
87 -
8886 /**
8987 * Disable RSS/Atom feeds
9088 */
@@ -122,9 +120,13 @@
123121 $dbr = wfGetDB( DB_SLAVE );
124122 // strip everything past first wildcard, so that
125123 // index-based-only lookup would be done
126 - list( $munged, $clause ) = self::mungeQuery( $this->mQuery,
127 - $this->mProt );
128 - $stripped = substr( $munged, 0, strpos( $munged, '%' ) + 1 );
 124+ list( $this->mMungedQuery, $clause ) = self::mungeQuery(
 125+ $this->mQuery, $this->mProt );
 126+ if( $this->mMungedQuery === false )
 127+ // Invalid query; return no results
 128+ return array( 'tables' => 'page', 'fields' => 'page_id', 'conds' => '0=1' );
 129+
 130+ $stripped = substr( $this->mMungedQuery, 0, strpos( $this->mMungedQuery, '%' ) + 1 );
129131 $encSearch = $dbr->addQuotes( $stripped );
130132 $retval = array (
131133 'tables' => array ( 'page', 'externallinks' ),
@@ -151,28 +153,12 @@
152154 }
153155
154156 /**
155 - * Override to check query validity.
156 - */
157 - function doQuery( $offset, $limit, $shownavigation=true ) {
158 - global $wgOut;
159 - list( $this->mMungedQuery, $clause ) = LinkSearchPage::mungeQuery( $this->mQuery, $this->mProt );
160 - if( $this->mMungedQuery === false ) {
161 - $wgOut->addWikiText( wfMsg( 'linksearch-error' ) );
162 - } else {
163 - // For debugging
164 - // Generates invalid xhtml with patterns that contain --
165 - //$wgOut->addHTML( "\n<!-- " . htmlspecialchars( $this->mMungedQuery ) . " -->\n" );
166 - parent::doQuery( $offset, $limit, $shownavigation );
167 - }
168 - }
169 -
170 - /**
171157 * Override to squash the ORDER BY.
172158 * We do a truncated index search, so the optimizer won't trust
173159 * it as good enough for optimizing sort. The implicit ordering
174160 * from the scan will usually do well enough for our needs.
175161 */
176 - function getOrder() {
177 - return '';
 162+ function getOrderFields() {
 163+ return array();
178164 }
179165 }
Index: branches/querypage-work2/phase3/includes/specials/SpecialMostrevisions.php
@@ -8,23 +8,12 @@
99 * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
1010 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1111 */
12 -
13 -/**
14 - * @ingroup SpecialPage
15 - */
1612 class MostrevisionsPage extends FewestrevisionsPage {
 13+ function __construct() {
 14+ SpecialPage::__construct( 'Mostrevisions' );
 15+ }
 16+
1717 function sortDescending() {
1818 return true;
1919 }
2020 }
21 -
22 -/**
23 - * constructor
24 - */
25 -function wfSpecialMostrevisions() {
26 - list( $limit, $offset ) = wfCheckLimits();
27 -
28 - $wpp = new MostrevisionsPage();
29 -
30 - $wpp->doQuery( $offset, $limit );
31 -}
Property changes on: branches/querypage-work2/phase3/includes/specials
___________________________________________________________________
Modified: svn:mergeinfo
3221 Merged /branches/querypage-work/phase3/includes/specials:r51597
Property changes on: branches/querypage-work2/phase3/includes/api
___________________________________________________________________
Modified: svn:mergeinfo
3322 Merged /branches/querypage-work/phase3/includes/api:r51597
Property changes on: branches/querypage-work2/phase3/includes/ChangesList.php
___________________________________________________________________
Modified: svn:mergeinfo
3423 Merged /branches/querypage-work/phase3/includes/ChangesList.php:r51597
Property changes on: branches/querypage-work2/phase3/includes/OutputPage.php
___________________________________________________________________
Modified: svn:mergeinfo
3524 Merged /branches/querypage-work/phase3/includes/OutputPage.php:r51597
Index: branches/querypage-work2/phase3/includes/AutoLoader.php
@@ -533,6 +533,7 @@
534534 'MostimagesPage' => 'includes/specials/SpecialMostimages.php',
535535 'MostlinkedCategoriesPage' => 'includes/specials/SpecialMostlinkedcategories.php',
536536 'MostlinkedPage' => 'includes/specials/SpecialMostlinked.php',
 537+ 'MostlinkedTemplatesPage' => 'includes/specials/SpecialMostlinkedtemplates.php',
537538 'MostrevisionsPage' => 'includes/specials/SpecialMostrevisions.php',
538539 'MovePageForm' => 'includes/specials/SpecialMovepage.php',
539540 'SpecialNewpages' => 'includes/specials/SpecialNewpages.php',
@@ -577,6 +578,7 @@
578579 'SpecialVersion' => 'includes/specials/SpecialVersion.php',
579580 'SpecialWhatlinkshere' => 'includes/specials/SpecialWhatlinkshere.php',
580581 'UncategorizedCategoriesPage' => 'includes/specials/SpecialUncategorizedcategories.php',
 582+ 'UncategorizedImagesPage' => 'includes/specials/SpecialUncategorizedimages.php',
581583 'UncategorizedPagesPage' => 'includes/specials/SpecialUncategorizedpages.php',
582584 'UncategorizedTemplatesPage' => 'includes/specials/SpecialUncategorizedtemplates.php',
583585 'UndeleteForm' => 'includes/specials/SpecialUndelete.php',
Index: branches/querypage-work2/phase3/includes/SpecialPage.php
@@ -84,14 +84,14 @@
8585 */
8686 static public $mList = array(
8787 # Maintenance Reports
88 - 'BrokenRedirects' => array( 'SpecialPage', 'BrokenRedirects' ),
89 - 'Deadendpages' => array( 'SpecialPage', 'Deadendpages' ),
90 - 'DoubleRedirects' => array( 'SpecialPage', 'DoubleRedirects' ),
91 - 'Longpages' => array( 'SpecialPage', 'Longpages' ),
92 - 'Ancientpages' => array( 'SpecialPage', 'Ancientpages' ),
93 - 'Lonelypages' => array( 'SpecialPage', 'Lonelypages' ),
94 - 'Fewestrevisions' => array( 'SpecialPage', 'Fewestrevisions' ),
95 - 'Withoutinterwiki' => array( 'SpecialPage', 'Withoutinterwiki' ),
 88+ 'BrokenRedirects' => array( 'BrokenRedirectsPage' ),
 89+ 'Deadendpages' => array( 'DeadendpagesPage' ),
 90+ 'DoubleRedirects' => array( 'DoubleRedirectsPage' ),
 91+ 'Longpages' => array( 'LongpagesPage' ),
 92+ 'Ancientpages' => array( 'AncientpagesPage' ),
 93+ 'Lonelypages' => array( 'LonelypagesPage' ),
 94+ 'Fewestrevisions' => array( 'FewestrevisionsPage' ),
 95+ 'Withoutinterwiki' => array( 'WithoutinterwikiPage' ),
9696 'Protectedpages' => array( 'SpecialPage', 'Protectedpages' ),
9797 'Protectedtitles' => array( 'SpecialPage', 'Protectedtitles' ),
9898 'Shortpages' => array( 'SpecialPage', 'Shortpages' ),
@@ -161,12 +161,12 @@
162162 'Randomredirect' => 'SpecialRandomredirect',
163163
164164 # High use pages
165 - 'Mostlinkedcategories' => array( 'SpecialPage', 'Mostlinkedcategories' ),
166 - 'Mostimages' => array( 'SpecialPage', 'Mostimages' ),
167 - 'Mostlinked' => array( 'SpecialPage', 'Mostlinked' ),
168 - 'Mostlinkedtemplates' => array( 'SpecialPage', 'Mostlinkedtemplates' ),
169 - 'Mostcategories' => array( 'SpecialPage', 'Mostcategories' ),
170 - 'Mostrevisions' => array( 'SpecialPage', 'Mostrevisions' ),
 165+ 'Mostlinkedcategories' => array( 'MostlinkedCategoriesPage' ),
 166+ 'Mostimages' => array( 'MostimagesPage' ),
 167+ 'Mostlinked' => array( 'MostlinkedPage' ),
 168+ 'Mostlinkedtemplates' => array( 'MostlinkedTemplatesPage' ),
 169+ 'Mostcategories' => array( 'MostcategoriesPage' ),
 170+ 'Mostrevisions' => array( 'MostrevisionsPage' ),
171171
172172 # Page tools
173173 'Export' => 'SpecialExport',
@@ -215,7 +215,7 @@
216216 self::$mListInitialised = true;
217217
218218 if( !$wgDisableCounters ) {
219 - self::$mList['Popularpages'] = array( 'SpecialPage', 'Popularpages' );
 219+ self::$mList['Popularpages'] = array( 'PopularpagesPage' );
220220 }
221221
222222 if( !$wgDisableInternalSearch ) {
Property changes on: branches/querypage-work2/phase3/includes/ConfEditor.php
___________________________________________________________________
Modified: svn:mergeinfo
223223 Merged /branches/querypage-work/phase3/includes/ConfEditor.php:r51597
Index: branches/querypage-work2/phase3/includes/QueryPage.php
@@ -389,7 +389,8 @@
390390 function execute( $par ) {
391391 global $wgUser, $wgOut, $wgLang;
392392
393 - list( $this->limit, $this->offset ) = wfCheckLimits();
 393+ if( $this->limit == 0 && $this->offset == 0 )
 394+ list( $this->limit, $this->offset ) = wfCheckLimits();
394395 $sname = $this->getName();
395396 $fname = get_class( $this ) . '::doQuery';
396397 $dbr = wfGetDB( DB_SLAVE );
Property changes on: branches/querypage-work2/phase3/includes
___________________________________________________________________
Modified: svn:mergeinfo
397398 Merged /branches/querypage-work/phase3/includes:r51597
Property changes on: branches/querypage-work2/phase3/maintenance/cleanupTable.inc
___________________________________________________________________
Modified: svn:mergeinfo
398399 Merged /branches/querypage-work/phase3/maintenance/cleanupTable.inc:r51597
Property changes on: branches/querypage-work2/phase3/skins/common/jquery.min.js
___________________________________________________________________
Modified: svn:mergeinfo
399400 Merged /branches/querypage-work/phase3/skins/common/jquery.min.js:r51597
Property changes on: branches/querypage-work2/phase3/skins/common/jquery.js
___________________________________________________________________
Modified: svn:mergeinfo
400401 Merged /branches/querypage-work/phase3/skins/common/jquery.js:r51597
Property changes on: branches/querypage-work2/phase3
___________________________________________________________________
Modified: svn:mergeinfo
401402 Merged /branches/querypage-work/phase3:r51597
Property changes on: branches/querypage-work2
___________________________________________________________________
Modified: svn:mergeinfo
402403 Merged /branches/querypage-work:r51597

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r51597querypage-work: Replacing wfSpecialWhatever() functions with real constructor...catrope17:30, 8 June 2009

Status & tagging log