From e6818e6c649a82f8b54518c671cd32b54cf92968 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Fri, 29 Mar 2019 16:52:48 -0700 Subject: [PATCH] Fix unused vars/pointless assignments Change-Id: If475c738b4af7208024c866594d4c0048af053dd --- includes/api/ApiImageRotate.php | 2 -- includes/api/ApiLogin.php | 1 - includes/api/ApiQuerySearch.php | 1 - includes/api/ApiQueryWatchlist.php | 1 - includes/htmlform/HTMLForm.php | 1 - includes/installer/PostgresInstaller.php | 2 +- includes/preferences/DefaultPreferencesFactory.php | 1 - includes/resourceloader/ResourceLoaderSkinModule.php | 1 - includes/skins/Skin.php | 2 -- includes/specials/SpecialDeletedContributions.php | 2 -- includes/specials/SpecialEditTags.php | 2 -- includes/specials/SpecialUndelete.php | 1 - includes/specials/pagers/ActiveUsersPager.php | 1 - includes/specials/pagers/ContribsPager.php | 1 - includes/tidy/RemexCompatMunger.php | 1 - includes/widget/ExpiryInputWidget.php | 2 -- includes/widget/search/InterwikiSearchResultWidget.php | 1 - 17 files changed, 1 insertion(+), 22 deletions(-) diff --git a/includes/api/ApiImageRotate.php b/includes/api/ApiImageRotate.php index 21e2694905..704513822f 100644 --- a/includes/api/ApiImageRotate.php +++ b/includes/api/ApiImageRotate.php @@ -33,8 +33,6 @@ class ApiImageRotate extends ApiBase { $pageSet = $this->getPageSet(); $pageSet->execute(); - $result = []; - $result = $pageSet->getInvalidTitlesAndRevisions( [ 'invalidTitles', 'special', 'missingIds', 'missingRevIds', 'interwikiTitles', ] ); diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php index 133f0ce556..d7b3332c1f 100644 --- a/includes/api/ApiLogin.php +++ b/includes/api/ApiLogin.php @@ -107,7 +107,6 @@ class ApiLogin extends ApiBase { } $authRes = false; - $context = new DerivativeContext( $this->getContext() ); $loginType = 'N/A'; // Check login token diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php index b90dd5d6af..e6403f3d2f 100644 --- a/includes/api/ApiQuerySearch.php +++ b/includes/api/ApiQuerySearch.php @@ -157,7 +157,6 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { convertForSearchResult( $matches->termMatches() ); $titles = []; $count = 0; - $limit = $params['limit']; if ( $matches->hasMoreResults() ) { $this->setContinueEnumParameter( 'offset', $params['offset'] + $params['limit'] ); diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index 236f6e0908..cb49622588 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -180,7 +180,6 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { ] ); $ids = []; - $count = 0; $watchedItemQuery = MediaWikiServices::getInstance()->getWatchedItemQueryService(); $items = $watchedItemQuery->getWatchedItemsWithRecentChangeInfo( $wlowner, $options, $startFrom ); diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php index 3c9b23c8e5..e5330b6674 100644 --- a/includes/htmlform/HTMLForm.php +++ b/includes/htmlform/HTMLForm.php @@ -527,7 +527,6 @@ class HTMLForm extends ContextSource { public function tryAuthorizedSubmit() { $result = false; - $identOkay = false; if ( $this->mFormIdentifier === null ) { $identOkay = true; } else { diff --git a/includes/installer/PostgresInstaller.php b/includes/installer/PostgresInstaller.php index 16b47e2869..f3cbbc4e98 100644 --- a/includes/installer/PostgresInstaller.php +++ b/includes/installer/PostgresInstaller.php @@ -125,7 +125,7 @@ class PostgresInstaller extends DatabaseInstaller { // Check version $version = $conn->getServerVersion(); - $status = static::meetsMinimumRequirement( $conn->getServerVersion() ); + $status = static::meetsMinimumRequirement( $version ); if ( !$status->isOK() ) { return $status; } diff --git a/includes/preferences/DefaultPreferencesFactory.php b/includes/preferences/DefaultPreferencesFactory.php index a42726f7b4..c45ab4c825 100644 --- a/includes/preferences/DefaultPreferencesFactory.php +++ b/includes/preferences/DefaultPreferencesFactory.php @@ -1052,7 +1052,6 @@ class DefaultPreferencesFactory implements PreferencesFactory { # # Watchlist ##################################### if ( $user->isAllowed( 'editmywatchlist' ) ) { $editWatchlistLinks = ''; - $editWatchlistLinksOld = []; $editWatchlistModes = [ 'edit' => [ 'subpage' => false, 'flags' => [] ], 'raw' => [ 'subpage' => 'raw', 'flags' => [] ], diff --git a/includes/resourceloader/ResourceLoaderSkinModule.php b/includes/resourceloader/ResourceLoaderSkinModule.php index e0fbeeed20..6393803df9 100644 --- a/includes/resourceloader/ResourceLoaderSkinModule.php +++ b/includes/resourceloader/ResourceLoaderSkinModule.php @@ -91,7 +91,6 @@ class ResourceLoaderSkinModule extends ResourceLoaderFileModule { private function getLogoPreloadlinks() { $logo = $this->getLogoData( $this->getConfig() ); - $tags = []; $logosPerDppx = []; $logos = []; diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php index 7ac2927666..ac41c466cd 100644 --- a/includes/skins/Skin.php +++ b/includes/skins/Skin.php @@ -175,7 +175,6 @@ abstract class Skin extends ContextSource { */ public function getDefaultModules() { $out = $this->getOutput(); - $config = $this->getConfig(); $user = $this->getUser(); // Modules declared in the $modules literal are loaded @@ -1525,7 +1524,6 @@ abstract class Skin extends ContextSource { * should fall back to the next notice in its sequence */ private function getCachedNotice( $name ) { - $needParse = false; $config = $this->getConfig(); if ( $name === 'default' ) { diff --git a/includes/specials/SpecialDeletedContributions.php b/includes/specials/SpecialDeletedContributions.php index d405be7416..65cf79ef56 100644 --- a/includes/specials/SpecialDeletedContributions.php +++ b/includes/specials/SpecialDeletedContributions.php @@ -44,8 +44,6 @@ class DeletedContributionsPage extends SpecialPage { $this->outputHeader(); $this->checkPermissions(); - $user = $this->getUser(); - $out = $this->getOutput(); $out->setPageTitle( $this->msg( 'deletedcontributions-title' ) ); diff --git a/includes/specials/SpecialEditTags.php b/includes/specials/SpecialEditTags.php index 6807ed31da..520380763f 100644 --- a/includes/specials/SpecialEditTags.php +++ b/includes/specials/SpecialEditTags.php @@ -209,8 +209,6 @@ class SpecialEditTags extends UnlistedSpecialPage { * the user to modify the tags applied to those items. */ protected function showForm() { - $userAllowed = true; - $out = $this->getOutput(); // Messages: tags-edit-revision-selected, tags-edit-logentry-selected $out->wrapWikiMsg( "$1", [ diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index 3fabfd214c..bfa39d1c5e 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -503,7 +503,6 @@ class SpecialUndelete extends SpecialPage { ] ); } else { $sourceView = ''; - $previewButton = ''; } $buttonFields[] = new OOUI\ButtonInputWidget( [ diff --git a/includes/specials/pagers/ActiveUsersPager.php b/includes/specials/pagers/ActiveUsersPager.php index 5dbdba08f1..39da07676f 100644 --- a/includes/specials/pagers/ActiveUsersPager.php +++ b/includes/specials/pagers/ActiveUsersPager.php @@ -230,7 +230,6 @@ class ActiveUsersPager extends UsersPager { $lang = $this->getLanguage(); $list = []; - $user = User::newFromId( $row->user_id ); $ugms = self::getGroupMemberships( intval( $row->user_id ), $this->userGroupCache ); foreach ( $ugms as $ugm ) { diff --git a/includes/specials/pagers/ContribsPager.php b/includes/specials/pagers/ContribsPager.php index 3ffbde5e0a..10fcfc6e8a 100644 --- a/includes/specials/pagers/ContribsPager.php +++ b/includes/specials/pagers/ContribsPager.php @@ -646,7 +646,6 @@ class ContribsPager extends RangeChronologicalPager { $lang = $this->getLanguage(); $comment = $lang->getDirMark() . Linker::revComment( $rev, false, true, false ); - $date = $lang->userTimeAndDate( $row->rev_timestamp, $user ); $d = ChangesList::revDateLink( $rev, $user, $lang, $page ); # Show user names for /newbies as there may be different users. diff --git a/includes/tidy/RemexCompatMunger.php b/includes/tidy/RemexCompatMunger.php index df9bb96743..0cc9905823 100644 --- a/includes/tidy/RemexCompatMunger.php +++ b/includes/tidy/RemexCompatMunger.php @@ -287,7 +287,6 @@ class RemexCompatMunger implements TreeHandler { $newParent = $this->serializer->getParentNode( $parent ); $parent = $newParent; $parentData = $parent->snData; - $pElement = $parentData->childPElement; $parentData->childPElement = null; $newRef = $refElement->userData; } elseif ( $under && $parentData->isSplittable diff --git a/includes/widget/ExpiryInputWidget.php b/includes/widget/ExpiryInputWidget.php index be6e676120..02f369a1b3 100644 --- a/includes/widget/ExpiryInputWidget.php +++ b/includes/widget/ExpiryInputWidget.php @@ -30,8 +30,6 @@ class ExpiryInputWidget extends Widget { * @param array $options Configuration options */ public function __construct( Widget $relativeInput, array $options = [] ) { - $config = \RequestContext::getMain()->getConfig(); - parent::__construct( $options ); $this->required = $options['required'] ?? false; diff --git a/includes/widget/search/InterwikiSearchResultWidget.php b/includes/widget/search/InterwikiSearchResultWidget.php index 4eead5e7e9..095c30a629 100644 --- a/includes/widget/search/InterwikiSearchResultWidget.php +++ b/includes/widget/search/InterwikiSearchResultWidget.php @@ -30,7 +30,6 @@ class InterwikiSearchResultWidget implements SearchResultWidget { */ public function render( SearchResult $result, $terms, $position ) { $title = $result->getTitle(); - $iwPrefix = $result->getTitle()->getInterwiki(); $titleSnippet = $result->getTitleSnippet(); $snippet = $result->getTextSnippet( $terms ); -- 2.20.1