From 510dfa7d9a4e7ac77e7b6b03a2de22f144c4d91e Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Sat, 14 Mar 2015 19:50:37 -0700 Subject: [PATCH] Fix phpcs errors and warnings in includes/specials Change-Id: I7608459fd50963fa8478b97ccd8f5a1a9d87aae8 --- includes/specials/SpecialAllPages.php | 5 ++++- includes/specials/SpecialChangeEmail.php | 3 ++- includes/specials/SpecialJavaScriptTest.php | 8 +++++-- includes/specials/SpecialLog.php | 5 ++++- includes/specials/SpecialPrefixindex.php | 5 ++++- includes/specials/SpecialRecentchanges.php | 11 ++++++--- includes/specials/SpecialRunJobs.php | 7 +++--- includes/specials/SpecialVersion.php | 25 +++++++++++++++------ includes/specials/SpecialWhatlinkshere.php | 10 +++++++-- 9 files changed, 58 insertions(+), 21 deletions(-) diff --git a/includes/specials/SpecialAllPages.php b/includes/specials/SpecialAllPages.php index 08b8761a18..74b1f7bb10 100644 --- a/includes/specials/SpecialAllPages.php +++ b/includes/specials/SpecialAllPages.php @@ -101,7 +101,10 @@ class SpecialAllPages extends IncludableSpecialPage { $t = $this->getPageTitle(); $out = Xml::openElement( 'div', array( 'class' => 'namespaceoptions' ) ); - $out .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $this->getConfig()->get( 'Script' ) ) ); + $out .= Xml::openElement( + 'form', + array( 'method' => 'get', 'action' => $this->getConfig()->get( 'Script' ) ) + ); $out .= Html::hidden( 'title', $t->getPrefixedText() ); $out .= Xml::openElement( 'fieldset' ); $out .= Xml::element( 'legend', null, $this->msg( 'allpages' )->text() ); diff --git a/includes/specials/SpecialChangeEmail.php b/includes/specials/SpecialChangeEmail.php index 674cbc8cee..eca307d9a1 100644 --- a/includes/specials/SpecialChangeEmail.php +++ b/includes/specials/SpecialChangeEmail.php @@ -141,7 +141,8 @@ class SpecialChangeEmail extends FormSpecialPage { # Notify user that a confirmation email has been sent... $this->getOutput()->wrapWikiMsg( "
\n$1\n
", 'eauthentsent', $this->getUser()->getName() ); - $this->getOutput()->addReturnTo( $titleObj, wfCgiToArray( $query ) ); // just show the link to go back + // just show the link to go back + $this->getOutput()->addReturnTo( $titleObj, wfCgiToArray( $query ) ); } } diff --git a/includes/specials/SpecialJavaScriptTest.php b/includes/specials/SpecialJavaScriptTest.php index 492105d942..ecb166a435 100644 --- a/includes/specials/SpecialJavaScriptTest.php +++ b/includes/specials/SpecialJavaScriptTest.php @@ -242,9 +242,13 @@ HTML; 'debug' => ResourceLoader::inDebugMode() ? 'true' : 'false', ) ); - $styles = $out->makeResourceLoaderLink( 'jquery.qunit', ResourceLoaderModule::TYPE_STYLES, false ); + $styles = $out->makeResourceLoaderLink( + 'jquery.qunit', ResourceLoaderModule::TYPE_STYLES, false + ); // Use 'raw' since this is a plain HTML page without ResourceLoader - $scripts = $out->makeResourceLoaderLink( 'jquery.qunit', ResourceLoaderModule::TYPE_SCRIPTS, false, array( 'raw' => 'true' ) ); + $scripts = $out->makeResourceLoaderLink( + 'jquery.qunit', ResourceLoaderModule::TYPE_SCRIPTS, false, array( 'raw' => 'true' ) + ); $head = trim( $styles['html'] . $scripts['html'] ); $html = <<getValue( 'type' ), $this->getRequest(), &$qc ) ); + Hooks::run( + 'SpecialLogAddLogSearchRelations', + array( $opts->getValue( 'type' ), $this->getRequest(), &$qc ) + ); } # Some log types are only for a 'User:' title but we might have been given diff --git a/includes/specials/SpecialPrefixindex.php b/includes/specials/SpecialPrefixindex.php index 2e67e2b54c..5a67d924bf 100644 --- a/includes/specials/SpecialPrefixindex.php +++ b/includes/specials/SpecialPrefixindex.php @@ -102,7 +102,10 @@ class SpecialPrefixindex extends SpecialAllPages { */ protected function namespacePrefixForm( $namespace = NS_MAIN, $from = '' ) { $out = Xml::openElement( 'div', array( 'class' => 'namespaceoptions' ) ); - $out .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $this->getConfig()->get( 'Script' ) ) ); + $out .= Xml::openElement( + 'form', + array( 'method' => 'get', 'action' => $this->getConfig()->get( 'Script' ) ) + ); $out .= Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() ); $out .= Xml::openElement( 'fieldset' ); $out .= Xml::element( 'legend', null, $this->msg( 'allpages' )->text() ); diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index efb870b830..64b0ecae0d 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -252,7 +252,9 @@ class SpecialRecentChanges extends ChangesListSpecialPage { return $rows; } - protected function runMainQueryHook( &$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts ) { + protected function runMainQueryHook( &$tables, &$fields, &$conds, + &$query_options, &$join_conds, $opts + ) { return parent::runMainQueryHook( $tables, $fields, $conds, $query_options, $join_conds, $opts ) && Hooks::run( 'SpecialRecentChangesQuery', @@ -311,7 +313,9 @@ class SpecialRecentChanges extends ChangesListSpecialPage { $rc = RecentChange::newFromRow( $obj ); $rc->counter = $counter++; # Check if the page has been updated since the last visit - if ( $this->getConfig()->get( 'ShowUpdatedMarker' ) && !empty( $obj->wl_notificationtimestamp ) ) { + if ( $this->getConfig()->get( 'ShowUpdatedMarker' ) + && !empty( $obj->wl_notificationtimestamp ) + ) { $rc->notificationtimestamp = ( $obj->rc_timestamp >= $obj->wl_notificationtimestamp ); } else { $rc->notificationtimestamp = false; // Default @@ -732,7 +736,8 @@ class SpecialRecentChanges extends ChangesListSpecialPage { $link = $this->makeOptionsLink( $linkMessage->text(), array( $key => 1 - $options[$key] ), $nondefaults ); - $links[] = "" . $this->msg( $msg )->rawParams( $link )->escaped() . ''; + $links[] = "" + . $this->msg( $msg )->rawParams( $link )->escaped() . ''; } // show from this onward link diff --git a/includes/specials/SpecialRunJobs.php b/includes/specials/SpecialRunJobs.php index 1bafc61601..0d44d34358 100644 --- a/includes/specials/SpecialRunJobs.php +++ b/includes/specials/SpecialRunJobs.php @@ -61,10 +61,11 @@ class SpecialRunJobs extends UnlistedSpecialPage { $squery = $params; unset( $squery['signature'] ); - $cSig = self::getQuerySignature( $squery, $this->getConfig()->get( 'SecretKey' ) ); // correct signature - $rSig = $params['signature']; // provided signature + $correctSignature = self::getQuerySignature( $squery, $this->getConfig()->get( 'SecretKey' ) ); + $providedSignature = $params['signature']; - $verified = is_string( $rSig ) && hash_equals( $cSig, $rSig ); + $verified = is_string( $providedSignature ) + && hash_equals( $correctSignature, $providedSignature ); if ( !$verified || $params['sigexpiry'] < time() ) { header( "HTTP/1.0 400 Bad Request" ); print 'Invalid or stale signature provided'; diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index a7365bb2e5..c1a95939fb 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -515,7 +515,10 @@ class SpecialVersion extends SpecialPage { array( 'id' => 'mw-version-libraries' ), $this->msg( 'version-libraries' )->text() ); - $out .= Html::openElement( 'table', array( 'class' => 'wikitable plainlinks', 'id' => 'sv-libraries' ) ); + $out .= Html::openElement( + 'table', + array( 'class' => 'wikitable plainlinks', 'id' => 'sv-libraries' ) + ); $out .= Html::openElement( 'tr' ) . Html::element( 'th', array(), $this->msg( 'version-libraries-library' )->text() ) . Html::element( 'th', array(), $this->msg( 'version-libraries-version' )->text() ) @@ -528,7 +531,11 @@ class SpecialVersion extends SpecialPage { continue; } $out .= Html::openElement( 'tr' ) - . Html::rawElement( 'td', array(), Linker::makeExternalLink( "https://packagist.org/packages/$name", $name ) ) + . Html::rawElement( + 'td', + array(), + Linker::makeExternalLink( "https://packagist.org/packages/$name", $name ) + ) . Html::element( 'td', array(), $info['version'] ) . Html::closeElement( 'tr' ); } @@ -588,11 +595,15 @@ class SpecialVersion extends SpecialPage { $fhooks = $wgParser->getFunctionHooks(); if ( count( $fhooks ) ) { - $out = Html::rawElement( 'h2', array( 'class' => 'mw-headline plainlinks' ), Linker::makeExternalLink( - '//www.mediawiki.org/wiki/Special:MyLanguage/Manual:Parser_functions', - $this->msg( 'version-parser-function-hooks' )->parse(), - false /* msg()->parse() already escapes */ - ) ); + $out = Html::rawElement( + 'h2', + array( 'class' => 'mw-headline plainlinks' ), + Linker::makeExternalLink( + '//www.mediawiki.org/wiki/Special:MyLanguage/Manual:Parser_functions', + $this->msg( 'version-parser-function-hooks' )->parse(), + false /* msg()->parse() already escapes */ + ) + ); $out .= $this->listToText( $fhooks ); } else { diff --git a/includes/specials/SpecialWhatlinkshere.php b/includes/specials/SpecialWhatlinkshere.php index 28be790911..40cce5e34d 100644 --- a/includes/specials/SpecialWhatlinkshere.php +++ b/includes/specials/SpecialWhatlinkshere.php @@ -152,7 +152,9 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { $conds['pagelinks'][] = 'rd_from is NOT NULL'; } - $queryFunc = function ( $dbr, $table, $fromCol ) use ( $conds, $target, $limit, $useLinkNamespaceDBFields ) { + $queryFunc = function ( $dbr, $table, $fromCol ) use ( + $conds, $target, $limit, $useLinkNamespaceDBFields + ) { // Read an extra row as an at-end check $queryLimit = $limit + 1; $on = array( @@ -278,7 +280,11 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { if ( $row->rd_from && $level < 2 ) { $out->addHTML( $this->listItem( $row, $nt, $target, true ) ); - $this->showIndirectLinks( $level + 1, $nt, $this->getConfig()->get( 'MaxRedirectLinksRetrieved' ) ); + $this->showIndirectLinks( + $level + 1, + $nt, + $this->getConfig()->get( 'MaxRedirectLinksRetrieved' ) + ); $out->addHTML( Xml::closeElement( 'li' ) ); } else { $out->addHTML( $this->listItem( $row, $nt, $target ) ); -- 2.20.1