Thiemo Mättig (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/371106 )

Change subject: Remove a bunch of dead code from RefreshSpecial.body.php
......................................................................

Remove a bunch of dead code from RefreshSpecial.body.php

All this code is either never executed, or the result is never used.

Note that SpecialPage::getFile does not exist any more since 2014, see
Id75661a. This "fuggly" code was never executed, otherwise it would
have flooded error logs already.

Change-Id: Ia1c5ef63022eb1644ee2e6896d2a90b01282b988
---
M RefreshSpecial.body.php
1 file changed, 8 insertions(+), 36 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/RefreshSpecial 
refs/changes/06/371106/1

diff --git a/RefreshSpecial.body.php b/RefreshSpecial.body.php
index 24e9407..7274ce0 100644
--- a/RefreshSpecial.body.php
+++ b/RefreshSpecial.body.php
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * A special page providing means to manually refresh special pages
  *
@@ -106,11 +107,6 @@
 
                $out->addWikiMsg( 'refreshspecial-help' );
 
-               $scLink = '';
-               if ( $this->getRequest()->getVal( 'action' ) == 'submit' ) {
-                       $scLink = htmlspecialchars( $this->mLink );
-               }
-
                // Add the JavaScript via ResourceLoader
                $out->addModules( 'ext.refreshspecial' );
 
@@ -128,30 +124,17 @@
                 */
                foreach ( QueryPage::getPages() as $page ) {
                        list( $class, $special ) = $page;
-                       $limit = isset( $page[2] ) ? $page[2] : null;
 
+                       /** @var QueryPage $specialObj */
                        $specialObj = SpecialPageFactory::getPage( $special );
                        if ( !$specialObj ) {
                                $out->addWikiText( $this->msg( 
'refreshspecial-no-page' )->plain() . " $special\n" );
                                exit;
                        }
 
-                       if ( $specialObj instanceof QueryPage ) {
-                               $queryPage = $specialObj;
-                       } else {
-                               if ( !class_exists( $class ) ) {
-                                       $file = $specialObj->getFile();
-                                       // @todo FIXME: I have *no* clue why 
this fugly hack is needed,
-                                       // but without it MW constructs an 
invalid include path and due
-                                       // to the very nature of 
require_once(), we get lovely fatals.
-                                       $file = str_replace( 'specialpage/', 
'', $file );
-                                       require_once $file;
-                               }
-                               $queryPage = new $class;
-                       }
-
+                       /** @var QueryPage $queryPage */
                        $queryPage = new $class;
-                       $checked = '';
+
                        if ( $queryPage->isExpensive() ) {
                                $checked = 'checked="checked"';
                                $specialEsc = htmlspecialchars( $special );
@@ -217,7 +200,6 @@
        function refreshSpecial() {
                $out = $this->getOutput();
 
-               $dbw = wfGetDB( DB_MASTER );
                $to_refresh = $this->getRequest()->getArray( 'wpSpecial' );
                $total = array(
                        'pages' => 0,
@@ -233,27 +215,16 @@
                                continue;
                        }
 
+                       /** @var QueryPage $specialObj */
                        $specialObj = SpecialPageFactory::getPage( $special );
                        if ( !$specialObj ) {
                                $out->addWikiText( $this->msg( 
'refreshspecial-no-page' )->plain() . ": $special\n" );
                                exit;
                        }
-                       if ( $specialObj instanceof QueryPage ) {
-                               $queryPage = $specialObj;
-                       } else {
-                               if ( !class_exists( $class ) ) {
-                                       $file = $specialObj->getFile();
-                                       // @todo FIXME: I have *no* clue why 
this fugly hack is needed,
-                                       // but without it MW constructs an 
invalid include path and due
-                                       // to the very nature of 
require_once(), we get lovely fatals.
-                                       $file = str_replace( 'specialpage/', 
'', $file );
-                                       require_once $file;
-                               }
-                               $queryPage = new $class;
-                       }
+
+                       /** @var QueryPage $queryPage */
                        $queryPage = new $class;
 
-                       $message = '';
                        if( !( isset( $options['only'] ) ) || ( 
$options['only'] == $queryPage->getName() ) ) {
                                $out->addHTML( "<b>$special</b>: " );
 
@@ -350,4 +321,5 @@
                $link_back = Linker::linkKnown( $titleObj, $this->msg( 
'refreshspecial-link-back' )->plain() );
                $this->getOutput()->addHTML( '<br /><b>' . $link_back . '</b>' 
);
        }
+
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/371106
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia1c5ef63022eb1644ee2e6896d2a90b01282b988
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/RefreshSpecial
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to