r78817 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78816‎ | r78817 | r78818 >
Date:18:32, 22 December 2010
Author:catrope
Status:deferred
Tags:
Comment:
Followup r7876: fix the rest of the extensions. Merge the QueryPage and SpecialPage classes, except for extensions with a strict back compat policy; in the latter case, use two dirty hacks to preserve back compat
Modified paths:
  • /trunk/extensions/PasswordReset/PasswordReset_Disabledusers.php (modified) (history)
  • /trunk/extensions/SemanticDrilldown/specials/SD_BrowseData.php (modified) (history)
  • /trunk/extensions/SemanticDrilldown/specials/SD_Filters.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_Forms.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_Templates.php (modified) (history)
  • /trunk/extensions/StalePages/StalePages_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PasswordReset/PasswordReset_Disabledusers.php
@@ -11,33 +11,11 @@
1212 * @ingroup Extensions
1313 * @author Tim Laqua <t.laqua@gmail.com>
1414 */
15 -
16 -class Disabledusers extends SpecialPage {
17 - ///StalePages Class Constructor
18 - public function __construct() {
19 - wfLoadExtensionMessages('PasswordReset');
20 - parent::__construct( 'Disabledusers', 'passwordreset' );
 15+class Disabledusers extends QueryPage {
 16+ public function __construct( $name = 'Disabledusers' ) {
 17+ parent::__construct( $name, 'passwordreset' );
2118 }
2219
23 - function getDescription() {
24 - return wfMsg( 'disabledusers' );
25 - }
26 -
27 - function execute( $parameters ) {
28 - $this->setHeaders();
29 - list( $limit, $offset ) = wfCheckLimits();
30 -
31 - $sp = new DisabledusersPage();
32 -
33 - $sp->doQuery( $offset, $limit );
34 - }
35 -}
36 -
37 -class DisabledusersPage extends QueryPage {
38 - function getName() {
39 - return "Disabledusers";
40 - }
41 -
4220 function isExpensive() {
4321 return true;
4422 }
Index: trunk/extensions/SemanticForms/specials/SF_Forms.php
@@ -7,15 +7,39 @@
88
99 if ( !defined( 'MEDIAWIKI' ) ) die();
1010
11 -class SFForms extends QueryPage {
 11+class SFForms extends SpecialPage {
 12+
1213 /**
1314 * Constructor
1415 */
15 - function __construct( $name = 'Forms' ) {
16 - parent::__construct( $name );
 16+ function __construct() {
 17+ parent::__construct( 'Forms' );
1718 SFUtils::loadMessages();
1819 }
1920
 21+ function execute( $query ) {
 22+ $this->setHeaders();
 23+ list( $limit, $offset ) = wfCheckLimits();
 24+ $rep = new FormsPage();
 25+ if ( method_exists( $rep, 'execute' ) ) {
 26+ return $rep->execute( $query );
 27+ } else {
 28+ return $rep->doQuery( $offset, $limit );
 29+ }
 30+ }
 31+}
 32+
 33+class FormsPage extends QueryPage {
 34+ public function __construct( $name = 'Forms' ) {
 35+ if ( $this instanceof SpecialPage ) {
 36+ parent::__construct( $name );
 37+ }
 38+ }
 39+
 40+ function getName() {
 41+ return "Forms";
 42+ }
 43+
2044 function isExpensive() { return false; }
2145
2246 function isSyndicated() { return false; }
@@ -49,7 +73,7 @@
5074 WHERE page_namespace = {$NSform}
5175 AND page_is_redirect = 0";
5276 }
53 -
 77+
5478 function getQueryInfo() {
5579 return array(
5680 'tables' => array( 'page' ),
Index: trunk/extensions/SemanticForms/specials/SF_Templates.php
@@ -21,11 +21,19 @@
2222 $this->setHeaders();
2323 list( $limit, $offset ) = wfCheckLimits();
2424 $rep = new TemplatesPage();
25 - return $rep->doQuery( $offset, $limit );
 25+ if ( method_exists( $rep, 'execute' ) ) {
 26+ $rep->execute( $query );
 27+ } else {
 28+ return $rep->doQuery( $offset, $limit );
 29+ }
2630 }
2731 }
2832
2933 class TemplatesPage extends QueryPage {
 34+ public function __construct( $name = 'Templates' ) {
 35+ parent::__construct( $name );
 36+ }
 37+
3038 function getName() {
3139 return "Templates";
3240 }
Index: trunk/extensions/StalePages/StalePages_body.php
@@ -11,36 +11,12 @@
1212 * @ingroup Extensions
1313 * @author Tim Laqua <t.laqua@gmail.com>
1414 */
15 -
16 -class Stalepages extends SpecialPage
 15+class Stalepages extends QueryPage
1716 {
18 - ///StalePages Class Constructor
19 - public function __construct() {
20 - parent::__construct( 'StalePages' );
 17+ public function __construct( $name = 'Stalepages' ) {
 18+ parent::__construct( $name );
2119 }
2220
23 - function getDescription() {
24 - return wfMsg( 'stalepages' );
25 - }
26 -
27 - function execute( $parameters ) {
28 - wfLoadExtensionMessages( 'Stalepages' );
29 -
30 - $this->setHeaders();
31 - list( $limit, $offset ) = wfCheckLimits();
32 -
33 - $sp = new StalepagesPage();
34 -
35 - $sp->doQuery( $offset, $limit );
36 - }
37 -}
38 -
39 -class StalepagesPage extends QueryPage
40 -{
41 - function getName() {
42 - return "Stalepages";
43 - }
44 -
4521 function isExpensive() {
4622 return true;
4723 }
Index: trunk/extensions/SemanticDrilldown/specials/SD_Filters.php
@@ -21,17 +21,25 @@
2222 $this->setHeaders();
2323 list( $limit, $offset ) = wfCheckLimits();
2424 $rep = new FiltersPage();
25 - return $rep->doQuery( $offset, $limit );
 25+ if ( method_exists( $rep, 'execute' ) ) {
 26+ return $rep->execute( $par );
 27+ } else {
 28+ return $rep->doQuery( $offset, $limit );
 29+ }
2630 }
2731 }
2832
2933 class FiltersPage extends QueryPage {
 34+ function __construct( $name = 'Filters' ) {
 35+ if ( $this instanceof SpecialPage ) {
 36+ parent::__construct( $name );
 37+ }
 38+ }
 39+
3040 function getName() {
3141 return "Filters";
3242 }
3343
34 - function isExpensive() { return false; }
35 -
3644 function isSyndicated() { return false; }
3745
3846 function getPageHeader() {
Index: trunk/extensions/SemanticDrilldown/specials/SD_BrowseData.php
@@ -142,7 +142,11 @@
143143
144144 $wgOut->addHTML( "\n <div class=\"drilldown-results\">\n" );
145145 $rep = new SDBrowseDataPage( $category, $subcategory, $applied_filters, $remaining_filters );
146 - $num = $rep->doQuery( $offset, $limit );
 146+ if ( method_exists( $rep, 'execute' ) ) {
 147+ $num = $rep->execute( $query );
 148+ } else {
 149+ $num = $rep->doQuery( $offset, $limit );
 150+ }
147151 $wgOut->addHTML( "\n </div> <!-- drilldown-results -->\n" );
148152 return $num;
149153 }
@@ -161,6 +165,9 @@
162166 * Initialize the variables of this page
163167 */
164168 function __construct( $category, $subcategory, $applied_filters, $remaining_filters ) {
 169+ if ( $this instanceof SpecialPage ) {
 170+ parent::__construct( 'BrowseData' );
 171+ }
165172 $this->category = $category;
166173 $this->subcategory = $subcategory;
167174 $this->applied_filters = $applied_filters;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r7876* (bug 1746) Make full subject line quoted-printable...vibber01:21, 26 March 2005

Status & tagging log