r49492 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49491‎ | r49492 | r49493 >
Date:04:39, 15 April 2009
Author:demon
Status:resolved (Comments)
Tags:
Comment:
Make Whatlinkshere subclass SpecialPage.
Modified paths:
  • /trunk/phase3/includes/AutoLoader.php (modified) (history)
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialWhatlinkshere.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/AutoLoader.php
@@ -506,6 +506,7 @@
507507 'SpecialStatistics' => 'includes/specials/SpecialStatistics.php',
508508 'SpecialTags' => 'includes/specials/SpecialTags.php',
509509 'SpecialVersion' => 'includes/specials/SpecialVersion.php',
 510+ 'SpecialWhatlinkshere' => 'includes/specials/SpecialWhatlinkshere.php',
510511 'UncategorizedCategoriesPage' => 'includes/specials/SpecialUncategorizedcategories.php',
511512 'UncategorizedPagesPage' => 'includes/specials/SpecialUncategorizedpages.php',
512513 'UncategorizedTemplatesPage' => 'includes/specials/SpecialUncategorizedtemplates.php',
@@ -522,7 +523,6 @@
523524 'WantedFilesPage' => 'includes/specials/SpecialWantedfiles.php',
524525 'WantedPagesPage' => 'includes/specials/SpecialWantedpages.php',
525526 'WantedTemplatesPage' => 'includes/specials/SpecialWantedtemplates.php',
526 - 'WhatLinksHerePage' => 'includes/specials/SpecialWhatlinkshere.php',
527527 'WikiImporter' => 'includes/Import.php',
528528 'WikiRevision' => 'includes/Import.php',
529529 'WithoutInterwikiPage' => 'includes/specials/SpecialWithoutinterwiki.php',
Index: trunk/phase3/includes/specials/SpecialWhatlinkshere.php
@@ -7,40 +7,27 @@
88 */
99
1010 /**
11 - * Entry point
12 - * @param $par String: An article name ??
13 - */
14 -function wfSpecialWhatlinkshere($par = NULL) {
15 - global $wgRequest;
16 - $page = new WhatLinksHerePage( $wgRequest, $par );
17 - $page->execute();
18 -}
19 -
20 -/**
2111 * implements Special:Whatlinkshere
2212 * @ingroup SpecialPage
2313 */
24 -class WhatLinksHerePage {
25 - // Stored data
26 - protected $par;
 14+class SpecialWhatLinksHere extends SpecialPage {
2715
2816 // Stored objects
2917 protected $opts, $target, $selfTitle;
3018
3119 // Stored globals
32 - protected $skin, $request;
 20+ protected $skin;
3321
3422 protected $limits = array( 20, 50, 100, 250, 500 );
3523
36 - function WhatLinksHerePage( $request, $par = null ) {
 24+ public function __construct() {
 25+ parent::__construct( 'Whatlinkshere' );
3726 global $wgUser;
38 - $this->request = $request;
3927 $this->skin = $wgUser->getSkin();
40 - $this->par = $par;
4128 }
4229
43 - function execute() {
44 - global $wgOut;
 30+ function execute( $par ) {
 31+ global $wgOut, $wgRequest;
4532
4633 $opts = new FormOptions();
4734
@@ -54,12 +41,12 @@
5542 $opts->add( 'hidelinks', false );
5643 $opts->add( 'hideimages', false );
5744
58 - $opts->fetchValuesFromRequest( $this->request );
 45+ $opts->fetchValuesFromRequest( $wgRequest );
5946 $opts->validateIntBounds( 'limit', 0, 5000 );
6047
6148 // Give precedence to subpage syntax
62 - if ( isset($this->par) ) {
63 - $opts->setValue( 'target', $this->par );
 49+ if ( isset($par) ) {
 50+ $opts->setValue( 'target', $par );
6451 }
6552
6653 // Bind to member variable
Index: trunk/phase3/includes/SpecialPage.php
@@ -167,7 +167,7 @@
168168 'Export' => 'SpecialExport',
169169 'Import' => 'SpecialImport',
170170 'Undelete' => array( 'SpecialPage', 'Undelete', 'deletedhistory' ),
171 - 'Whatlinkshere' => array( 'SpecialPage', 'Whatlinkshere' ),
 171+ 'Whatlinkshere' => 'SpecialWhatlinkshere',
172172 'MergeHistory' => array( 'SpecialPage', 'MergeHistory', 'mergehistory' ),
173173
174174 # Other

Follow-up revisions

RevisionCommit summaryAuthorDate
r51584Follow-up to r49492: Add forgotten $this->setHeaders(); in execute().siebrand09:21, 8 June 2009

Comments

#Comment by Siebrand (talk | contribs)   20:14, 7 June 2009

Special:Whatlinkshere has no proper <title> tag on trunk (r51575). I think that may be related to this revision. Please check?

#Comment by Siebrand (talk | contribs)   09:23, 8 June 2009

Fix in r51584. Thanks to Tim for suggesting how to resolve this.

Status & tagging log