From a37e466918a673dd40b8ce9303e5ed4fb6c859e0 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Thu, 14 Nov 2013 14:58:14 +0100 Subject: [PATCH] Fix CodeSniffer errors and warnings on yet more API classes Change-Id: I67739a0b7c456f3684abea84833753e79a485c07 --- includes/api/ApiQueryPagesWithProp.php | 9 +- includes/api/ApiQueryProtectedTitles.php | 8 +- includes/api/ApiQueryQueryPage.php | 5 +- includes/api/ApiQueryRandom.php | 27 +++-- includes/api/ApiQueryRecentChanges.php | 47 +++++++-- includes/api/ApiQueryRevisions.php | 117 +++++++++++++++------ includes/api/ApiQuerySearch.php | 3 +- includes/api/ApiQuerySiteinfo.php | 8 +- includes/api/ApiQueryStashImageInfo.php | 3 +- includes/api/ApiQueryUserContributions.php | 50 ++++++--- includes/api/ApiQueryUserInfo.php | 3 +- 11 files changed, 209 insertions(+), 71 deletions(-) diff --git a/includes/api/ApiQueryPagesWithProp.php b/includes/api/ApiQueryPagesWithProp.php index 6f2f02e471..e68eb5670e 100644 --- a/includes/api/ApiQueryPagesWithProp.php +++ b/includes/api/ApiQueryPagesWithProp.php @@ -92,7 +92,8 @@ class ApiQueryPagesWithProp extends ApiQueryGeneratorBase { $count = 0; foreach ( $this->select( __METHOD__ ) as $row ) { if ( ++$count > $limit ) { - // We've reached the one extra which shows that there are additional pages to be had. Stop here... + // We've reached the one extra which shows that there are + // additional pages to be had. Stop here... $this->setContinueEnumParameter( 'continue', $row->page_id ); break; } @@ -178,8 +179,10 @@ class ApiQueryPagesWithProp extends ApiQueryGeneratorBase { public function getExamples() { return array( - 'api.php?action=query&list=pageswithprop&pwppropname=displaytitle&pwpprop=ids|title|value' => 'Get first 10 pages using {{DISPLAYTITLE:}}', - 'api.php?action=query&generator=pageswithprop&gpwppropname=notoc&prop=info' => 'Get page info about first 10 pages using __NOTOC__', + 'api.php?action=query&list=pageswithprop&pwppropname=displaytitle&pwpprop=ids|title|value' + => 'Get first 10 pages using {{DISPLAYTITLE:}}', + 'api.php?action=query&generator=pageswithprop&gpwppropname=notoc&prop=info' + => 'Get page info about first 10 pages using __NOTOC__', ); } diff --git a/includes/api/ApiQueryProtectedTitles.php b/includes/api/ApiQueryProtectedTitles.php index 4273c0dea8..ea350adde3 100644 --- a/includes/api/ApiQueryProtectedTitles.php +++ b/includes/api/ApiQueryProtectedTitles.php @@ -81,7 +81,8 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase { foreach ( $res as $row ) { if ( ++$count > $params['limit'] ) { - // We've reached the one extra which shows that there are additional pages to be had. Stop here... + // We've reached the one extra which shows that there are + // additional pages to be had. Stop here... $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->pt_timestamp ) ); break; } @@ -131,7 +132,10 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase { } if ( is_null( $resultPageSet ) ) { - $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), $this->getModulePrefix() ); + $result->setIndexedTagName_internal( + array( 'query', $this->getModuleName() ), + $this->getModulePrefix() + ); } else { $resultPageSet->populateFromTitles( $titles ); } diff --git a/includes/api/ApiQueryQueryPage.php b/includes/api/ApiQueryQueryPage.php index a6e455f836..88af62b6d3 100644 --- a/includes/api/ApiQueryQueryPage.php +++ b/includes/api/ApiQueryQueryPage.php @@ -126,7 +126,10 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase { } } if ( is_null( $resultPageSet ) ) { - $result->setIndexedTagName_internal( array( 'query', $this->getModuleName(), 'results' ), 'page' ); + $result->setIndexedTagName_internal( + array( 'query', $this->getModuleName(), 'results' ), + 'page' + ); } else { $resultPageSet->populateFromTitles( $titles ); } diff --git a/includes/api/ApiQueryRandom.php b/includes/api/ApiQueryRandom.php index b1f5ab93c7..e99038696f 100644 --- a/includes/api/ApiQueryRandom.php +++ b/includes/api/ApiQueryRandom.php @@ -30,9 +30,7 @@ * * @ingroup API */ - class ApiQueryRandom extends ApiQueryGeneratorBase { - private $pageIDs; public function __construct( $query, $moduleName ) { @@ -110,14 +108,26 @@ class ApiQueryRandom extends ApiQueryGeneratorBase { $result = $this->getResult(); $this->pageIDs = array(); - $this->prepareQuery( wfRandom(), $params['limit'], $params['namespace'], $resultPageSet, $params['redirect'] ); + $this->prepareQuery( + wfRandom(), + $params['limit'], + $params['namespace'], + $resultPageSet, + $params['redirect'] + ); $count = $this->runQuery( $resultPageSet ); if ( $count < $params['limit'] ) { /* We got too few pages, we probably picked a high value * for page_random. We'll just take the lowest ones, see * also the comment in Title::getRandomTitle() */ - $this->prepareQuery( 0, $params['limit'] - $count, $params['namespace'], $resultPageSet, $params['redirect'] ); + $this->prepareQuery( + 0, + $params['limit'] - $count, + $params['namespace'], + $resultPageSet, + $params['redirect'] + ); $this->runQuery( $resultPageSet ); } @@ -177,9 +187,12 @@ class ApiQueryRandom extends ApiQueryGeneratorBase { public function getDescription() { return array( 'Get a set of random pages', - 'NOTE: Pages are listed in a fixed sequence, only the starting point is random. This means that if, for example, "Main Page" is the first', - ' random page on your list, "List of fictional monkeys" will *always* be second, "List of people on stamps of Vanuatu" third, etc', - 'NOTE: If the number of pages in the namespace is lower than rnlimit, you will get fewer pages. You will not get the same page twice' + 'NOTE: Pages are listed in a fixed sequence, only the starting point is random.', + ' This means that if, for example, "Main Page" is the first random page on', + ' your list, "List of fictional monkeys" will *always* be second, "List of', + ' people on stamps of Vanuatu" third, etc', + 'NOTE: If the number of pages in the namespace is lower than rnlimit, you will', + ' get fewer pages. You will not get the same page twice' ); } diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index 9abe76b494..7848853048 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -199,7 +199,10 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { // Check permissions if ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ) { if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) { - $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' ); + $this->dieUsage( + 'You need the patrol right to request the patrolled flag', + 'permissiondenied' + ); } } @@ -215,7 +218,10 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { $this->addWhereIf( 'page_is_redirect = 1', isset( $show['redirect'] ) ); // Don't throw log entries out the window here - $this->addWhereIf( 'page_is_redirect = 0 OR page_is_redirect IS NULL', isset( $show['!redirect'] ) ); + $this->addWhereIf( + 'page_is_redirect = 0 OR page_is_redirect IS NULL', + isset( $show['!redirect'] ) + ); } if ( !is_null( $params['user'] ) && !is_null( $params['excludeuser'] ) ) { @@ -253,7 +259,10 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { $this->initProperties( $prop ); if ( $this->fld_patrolled && !$user->useRCPatrol() && !$user->useNPPatrol() ) { - $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' ); + $this->dieUsage( + 'You need the patrol right to request the patrolled flag', + 'permissiondenied' + ); } $this->addFields( 'rc_id' ); @@ -265,8 +274,12 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { $this->addFieldsIf( array( 'rc_minor', 'rc_type', 'rc_bot' ), $this->fld_flags ); $this->addFieldsIf( array( 'rc_old_len', 'rc_new_len' ), $this->fld_sizes ); $this->addFieldsIf( 'rc_patrolled', $this->fld_patrolled ); - $this->addFieldsIf( array( 'rc_logid', 'rc_log_type', 'rc_log_action', 'rc_params' ), $this->fld_loginfo ); - $showRedirects = $this->fld_redirect || isset( $show['redirect'] ) || isset( $show['!redirect'] ); + $this->addFieldsIf( + array( 'rc_logid', 'rc_log_type', 'rc_log_action', 'rc_params' ), + $this->fld_loginfo + ); + $showRedirects = $this->fld_redirect || isset( $show['redirect'] ) + || isset( $show['!redirect'] ); } if ( $this->fld_tags ) { @@ -277,13 +290,15 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { if ( $this->fld_sha1 ) { $this->addTables( 'revision' ); - $this->addJoinConds( array( 'revision' => array( 'LEFT JOIN', array( 'rc_this_oldid=rev_id' ) ) ) ); + $this->addJoinConds( array( 'revision' => array( 'LEFT JOIN', + array( 'rc_this_oldid=rev_id' ) ) ) ); $this->addFields( array( 'rev_sha1', 'rev_deleted' ) ); } if ( $params['toponly'] || $showRedirects ) { $this->addTables( 'page' ); - $this->addJoinConds( array( 'page' => array( 'LEFT JOIN', array( 'rc_namespace=page_namespace', 'rc_title=page_title' ) ) ) ); + $this->addJoinConds( array( 'page' => array( 'LEFT JOIN', + array( 'rc_namespace=page_namespace', 'rc_title=page_title' ) ) ) ); $this->addFields( 'page_is_redirect' ); if ( $params['toponly'] ) { @@ -313,8 +328,12 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { /* Iterate through the rows, adding data extracted from them to our query result. */ foreach ( $res as $row ) { if ( ++$count > $params['limit'] ) { - // We've reached the one extra which shows that there are additional pages to be had. Stop here... - $this->setContinueEnumParameter( 'continue', wfTimestamp( TS_ISO_8601, $row->rc_timestamp ) . '|' . $row->rc_id ); + // We've reached the one extra which shows that there are + // additional pages to be had. Stop here... + $this->setContinueEnumParameter( + 'continue', + wfTimestamp( TS_ISO_8601, $row->rc_timestamp ) . '|' . $row->rc_id + ); break; } @@ -328,7 +347,10 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { } $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $vals ); if ( !$fit ) { - $this->setContinueEnumParameter( 'continue', wfTimestamp( TS_ISO_8601, $row->rc_timestamp ) . '|' . $row->rc_id ); + $this->setContinueEnumParameter( + 'continue', + wfTimestamp( TS_ISO_8601, $row->rc_timestamp ) . '|' . $row->rc_id + ); break; } } else { @@ -790,7 +812,10 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { public function getPossibleErrors() { return array_merge( parent::getPossibleErrors(), array( array( 'show' ), - array( 'code' => 'permissiondenied', 'info' => 'You need the patrol right to request the patrolled flag' ), + array( + 'code' => 'permissiondenied', + 'info' => 'You need the patrol right to request the patrolled flag' + ), array( 'code' => 'user-excludeuser', 'info' => 'user and excludeuser cannot be used together' ), ) ); } diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index 4be1594311..86351c0a32 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -25,9 +25,10 @@ */ /** - * A query action to enumerate revisions of a given page, or show top revisions of multiple pages. - * Various pieces of information may be shown - flags, comments, and the actual wiki markup of the rev. - * In the enumeration mode, ranges of revisions may be requested and filtered. + * A query action to enumerate revisions of a given page, or show top revisions + * of multiple pages. Various pieces of information may be shown - flags, + * comments, and the actual wiki markup of the rev. In the enumeration mode, + * ranges of revisions may be requested and filtered. * * @ingroup API */ @@ -40,8 +41,9 @@ class ApiQueryRevisions extends ApiQueryBase { parent::__construct( $query, $moduleName, 'rv' ); } - private $fld_ids = false, $fld_flags = false, $fld_timestamp = false, $fld_size = false, $fld_sha1 = false, - $fld_comment = false, $fld_parsedcomment = false, $fld_user = false, $fld_userid = false, + private $fld_ids = false, $fld_flags = false, $fld_timestamp = false, + $fld_size = false, $fld_sha1 = false, $fld_comment = false, + $fld_parsedcomment = false, $fld_user = false, $fld_userid = false, $fld_content = false, $fld_tags = false, $fld_contentmodel = false; private $tokenFunctions; @@ -107,11 +109,20 @@ class ApiQueryRevisions extends ApiQueryBase { } if ( $revCount > 0 && $enumRevMode ) { - $this->dieUsage( 'The revids= parameter may not be used with the list options (limit, startid, endid, dirNewer, start, end).', 'revids' ); + $this->dieUsage( + 'The revids= parameter may not be used with the list options ' . + '(limit, startid, endid, dirNewer, start, end).', + 'revids' + ); } if ( $pageCount > 1 && $enumRevMode ) { - $this->dieUsage( 'titles, pageids or a generator was used to supply multiple pages, but the limit, startid, endid, dirNewer, user, excludeuser, start and end parameters may only be used on a single page.', 'multpages' ); + $this->dieUsage( + 'titles, pageids or a generator was used to supply multiple pages, ' . + 'but the limit, startid, endid, dirNewer, user, excludeuser, start ' . + 'and end parameters may only be used on a single page.', + 'multpages' + ); } if ( !is_null( $params['difftotext'] ) ) { @@ -123,7 +134,10 @@ class ApiQueryRevisions extends ApiQueryBase { if ( ( !ctype_digit( $params['diffto'] ) || $params['diffto'] < 0 ) && $params['diffto'] != 'prev' && $params['diffto'] != 'next' ) { - $this->dieUsage( 'rvdiffto must be set to a non-negative number, "prev", "next" or "cur"', 'diffto' ); + $this->dieUsage( + 'rvdiffto must be set to a non-negative number, "prev", "next" or "cur"', + 'diffto' + ); } // Check whether the revision exists and is readable, // DifferenceEngine returns a rather ambiguous empty @@ -184,13 +198,17 @@ class ApiQueryRevisions extends ApiQueryBase { if ( isset( $prop['tags'] ) ) { $this->fld_tags = true; $this->addTables( 'tag_summary' ); - $this->addJoinConds( array( 'tag_summary' => array( 'LEFT JOIN', array( 'rev_id=ts_rev_id' ) ) ) ); + $this->addJoinConds( + array( 'tag_summary' => array( 'LEFT JOIN', array( 'rev_id=ts_rev_id' ) ) ) + ); $this->addFields( 'ts_tags' ); } if ( !is_null( $params['tag'] ) ) { $this->addTables( 'change_tag' ); - $this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'rev_id=ct_rev_id' ) ) ) ); + $this->addJoinConds( + array( 'change_tag' => array( 'INNER JOIN', array( 'rev_id=ct_rev_id' ) ) ) + ); $this->addWhereFld( 'ct_tag', $params['tag'] ); $index['change_tag'] = 'change_tag_tag_id'; } @@ -368,7 +386,8 @@ class ApiQueryRevisions extends ApiQueryBase { foreach ( $res as $row ) { if ( ++$count > $limit ) { - // We've reached the one extra which shows that there are additional pages to be had. Stop here... + // We've reached the one extra which shows that there are + // additional pages to be had. Stop here... if ( !$enumRevMode ) { ApiBase::dieDebug( __METHOD__, 'Got more rows then expected' ); // bug report } @@ -500,7 +519,10 @@ class ApiQueryRevisions extends ApiQueryBase { if ( $content && $this->section !== false ) { $content = $content->getSection( $this->section, false ); if ( !$content ) { - $this->dieUsage( "There is no section {$this->section} in r" . $revision->getId(), 'nosuchsection' ); + $this->dieUsage( + "There is no section {$this->section} in r" . $revision->getId(), + 'nosuchsection' + ); } } } @@ -511,7 +533,11 @@ class ApiQueryRevisions extends ApiQueryBase { if ( $content->getModel() === CONTENT_MODEL_WIKITEXT ) { $t = $content->getNativeData(); # note: don't set $text - $wgParser->startExternalParse( $title, ParserOptions::newFromContext( $this->getContext() ), OT_PREPROCESS ); + $wgParser->startExternalParse( + $title, + ParserOptions::newFromContext( $this->getContext() ), + OT_PREPROCESS + ); $dom = $wgParser->preprocessToDom( $t ); if ( is_callable( array( $dom, 'saveXML' ) ) ) { $xml = $dom->saveXML(); @@ -531,7 +557,11 @@ class ApiQueryRevisions extends ApiQueryBase { if ( $content->getModel() === CONTENT_MODEL_WIKITEXT ) { $text = $content->getNativeData(); - $text = $wgParser->preprocess( $text, $title, ParserOptions::newFromContext( $this->getContext() ) ); + $text = $wgParser->preprocess( + $text, + $title, + ParserOptions::newFromContext( $this->getContext() ) + ); } else { $this->setWarning( "Template expansion is supported for wikitext only, " . $title->getPrefixedDBkey() . @@ -541,7 +571,11 @@ class ApiQueryRevisions extends ApiQueryBase { } } if ( $this->parseContent ) { - $po = $content->getParserOutput( $title, $revision->getId(), ParserOptions::newFromContext( $this->getContext() ) ); + $po = $content->getParserOutput( + $title, + $revision->getId(), + ParserOptions::newFromContext( $this->getContext() ) + ); $text = $po->getText(); } @@ -600,7 +634,12 @@ class ApiQueryRevisions extends ApiQueryBase { "content model $model used by $name", 'badformat' ); } - $difftocontent = ContentHandler::makeContent( $this->difftotext, $title, $model, $this->contentFormat ); + $difftocontent = ContentHandler::makeContent( + $this->difftotext, + $title, + $model, + $this->contentFormat + ); $engine = $handler->createDifferenceEngine( $context ); $engine->setContent( $content, $difftocontent ); @@ -740,8 +779,11 @@ class ApiQueryRevisions extends ApiQueryBase { 'continue' => 'When more results are available, use this to continue', 'diffto' => array( 'Revision ID to diff each revision to.', 'Use "prev", "next" and "cur" for the previous, next and current revision respectively' ), - 'difftotext' => array( 'Text to diff each revision to. Only diffs a limited number of revisions.', - "Overrides {$p}diffto. If {$p}section is set, only that section will be diffed against this text" ), + 'difftotext' => array( + 'Text to diff each revision to. Only diffs a limited number of revisions.', + "Overrides {$p}diffto. If {$p}section is set, only that section will be", + 'diffed against this text', + ), 'tag' => 'Only list revisions tagged with this tag', 'contentformat' => 'Serialization format used for difftotext and expected for output of content', ); @@ -825,12 +867,21 @@ class ApiQueryRevisions extends ApiQueryBase { public function getPossibleErrors() { return array_merge( parent::getPossibleErrors(), array( array( 'nosuchrevid', 'diffto' ), - array( 'code' => 'revids', 'info' => 'The revids= parameter may not be used with the list options ' - . '(limit, startid, endid, dirNewer, start, end).' ), - array( 'code' => 'multpages', 'info' => 'titles, pageids or a generator was used to supply multiple pages, ' - . ' but the limit, startid, endid, dirNewer, user, excludeuser, ' - . 'start and end parameters may only be used on a single page.' ), - array( 'code' => 'diffto', 'info' => 'rvdiffto must be set to a non-negative number, "prev", "next" or "cur"' ), + array( + 'code' => 'revids', + 'info' => 'The revids= parameter may not be used with the list options ' + . '(limit, startid, endid, dirNewer, start, end).' + ), + array( + 'code' => 'multpages', + 'info' => 'titles, pageids or a generator was used to supply multiple pages, ' + . ' but the limit, startid, endid, dirNewer, user, excludeuser, ' + . 'start and end parameters may only be used on a single page.' + ), + array( + 'code' => 'diffto', + 'info' => 'rvdiffto must be set to a non-negative number, "prev", "next" or "cur"' + ), array( 'code' => 'badparams', 'info' => 'start and startid cannot be used together' ), array( 'code' => 'badparams', 'info' => 'end and endid cannot be used together' ), array( 'code' => 'badparams', 'info' => 'user and excludeuser cannot be used together' ), @@ -843,17 +894,23 @@ class ApiQueryRevisions extends ApiQueryBase { public function getExamples() { return array( 'Get data with content for the last revision of titles "API" and "Main Page"', - ' api.php?action=query&prop=revisions&titles=API|Main%20Page&rvprop=timestamp|user|comment|content', + ' api.php?action=query&prop=revisions&titles=API|Main%20Page&' . + 'rvprop=timestamp|user|comment|content', 'Get last 5 revisions of the "Main Page"', - ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment', + ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' . + 'rvprop=timestamp|user|comment', 'Get first 5 revisions of the "Main Page"', - ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvdir=newer', + ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' . + 'rvprop=timestamp|user|comment&rvdir=newer', 'Get first 5 revisions of the "Main Page" made after 2006-05-01', - ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvdir=newer&rvstart=20060501000000', + ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' . + 'rvprop=timestamp|user|comment&rvdir=newer&rvstart=20060501000000', 'Get first 5 revisions of the "Main Page" that were not made made by anonymous user "127.0.0.1"', - ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvexcludeuser=127.0.0.1', + ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' . + 'rvprop=timestamp|user|comment&rvexcludeuser=127.0.0.1', 'Get first 5 revisions of the "Main Page" that were made by the user "MediaWiki default"', - ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvuser=MediaWiki%20default', + ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' . + 'rvprop=timestamp|user|comment&rvuser=MediaWiki%20default', ); } diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php index 8f094faedc..4fedebce67 100644 --- a/includes/api/ApiQuerySearch.php +++ b/includes/api/ApiQuerySearch.php @@ -128,7 +128,8 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { while ( $result ) { if ( ++$count > $limit ) { - // We've reached the one extra which shows that there are additional items to be had. Stop here... + // We've reached the one extra which shows that there are + // additional items to be had. Stop here... $this->setContinueEnumParameter( 'offset', $params['offset'] + $params['limit'] ); break; } diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 57eb41e7e6..1c188da0a9 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -391,7 +391,10 @@ class ApiQuerySiteinfo extends ApiQueryBase { $lb = wfGetLB(); if ( $includeAll ) { if ( !$wgShowHostnames ) { - $this->dieUsage( 'Cannot view all servers info unless $wgShowHostnames is true', 'includeAllDenied' ); + $this->dieUsage( + 'Cannot view all servers info unless $wgShowHostnames is true', + 'includeAllDenied' + ); } $lags = $lb->getLagTimes(); @@ -729,7 +732,8 @@ class ApiQuerySiteinfo extends ApiQueryBase { 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map', 'showalldb' => 'List all database servers, not just the one lagging the most', 'numberingroup' => 'Lists the number of users in user groups', - 'inlanguagecode' => 'Language code for localised language names (best effort, use CLDR extension)', + 'inlanguagecode' => 'Language code for localised language names ' . + '(best effort, use CLDR extension)', ); } diff --git a/includes/api/ApiQueryStashImageInfo.php b/includes/api/ApiQueryStashImageInfo.php index f714227257..248b3d8b23 100644 --- a/includes/api/ApiQueryStashImageInfo.php +++ b/includes/api/ApiQueryStashImageInfo.php @@ -135,7 +135,8 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo { public function getExamples() { return array( 'api.php?action=query&prop=stashimageinfo&siifilekey=124sd34rsdf567', - 'api.php?action=query&prop=stashimageinfo&siifilekey=b34edoe3|bceffd4&siiurlwidth=120&siiprop=url', + 'api.php?action=query&prop=stashimageinfo&siifilekey=b34edoe3|bceffd4&' . + 'siiurlwidth=120&siiprop=url', ); } } diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index be08c8a490..6c7a57d55d 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -101,7 +101,8 @@ class ApiQueryContributions extends ApiQueryBase { // Fetch each row foreach ( $res as $row ) { if ( ++$count > $limit ) { - // We've reached the one extra which shows that there are additional pages to be had. Stop here... + // We've reached the one extra which shows that there are + // additional pages to be had. Stop here... if ( $this->multiUserMode ) { $this->setContinueEnumParameter( 'continue', $this->continueStr( $row ) ); } else { @@ -122,7 +123,10 @@ class ApiQueryContributions extends ApiQueryBase { } } - $this->getResult()->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'item' ); + $this->getResult()->setIndexedTagName_internal( + array( 'query', $this->getModuleName() ), + 'item' + ); } /** @@ -177,7 +181,8 @@ class ApiQueryContributions extends ApiQueryBase { } // We only want pages by the specified users. if ( $this->prefixMode ) { - $this->addWhere( 'rev_user_text' . $this->getDB()->buildLike( $this->userprefix, $this->getDB()->anyString() ) ); + $this->addWhere( 'rev_user_text' . + $this->getDB()->buildLike( $this->userprefix, $this->getDB()->anyString() ) ); } else { $this->addWhereFld( 'rev_user_text', $this->usernames ); } @@ -224,7 +229,10 @@ class ApiQueryContributions extends ApiQueryBase { $this->fld_patrolled ) { if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) { - $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' ); + $this->dieUsage( + 'You need the patrol right to request the patrolled flag', + 'permissiondenied' + ); } // Use a redundant join condition on both @@ -262,13 +270,17 @@ class ApiQueryContributions extends ApiQueryBase { if ( $this->fld_tags ) { $this->addTables( 'tag_summary' ); - $this->addJoinConds( array( 'tag_summary' => array( 'LEFT JOIN', array( 'rev_id=ts_rev_id' ) ) ) ); + $this->addJoinConds( + array( 'tag_summary' => array( 'LEFT JOIN', array( 'rev_id=ts_rev_id' ) ) ) + ); $this->addFields( 'ts_tags' ); } if ( isset( $this->params['tag'] ) ) { $this->addTables( 'change_tag' ); - $this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'rev_id=ct_rev_id' ) ) ) ); + $this->addJoinConds( + array( 'change_tag' => array( 'INNER JOIN', array( 'rev_id=ct_rev_id' ) ) ) + ); $this->addWhereFld( 'ct_tag', $this->params['tag'] ); $index['change_tag'] = 'change_tag_tag_id'; } @@ -348,8 +360,13 @@ class ApiQueryContributions extends ApiQueryBase { $vals['size'] = intval( $row->rev_len ); } - if ( $this->fld_sizediff && !is_null( $row->rev_len ) && !is_null( $row->rev_parent_id ) ) { - $parentLen = isset( $this->parentLens[$row->rev_parent_id] ) ? $this->parentLens[$row->rev_parent_id] : 0; + if ( $this->fld_sizediff + && !is_null( $row->rev_len ) + && !is_null( $row->rev_parent_id ) + ) { + $parentLen = isset( $this->parentLens[$row->rev_parent_id] ) + ? $this->parentLens[$row->rev_parent_id] + : 0; $vals['sizediff'] = intval( $row->rev_len - $parentLen ); } @@ -448,7 +465,10 @@ class ApiQueryContributions extends ApiQueryBase { 'end' => 'The end timestamp to return to', 'continue' => 'When more results are available, use this to continue', 'user' => 'The users to retrieve contributions for', - 'userprefix' => "Retrieve contributions for all users whose names begin with this value. Overrides {$p}user", + 'userprefix' => array( + "Retrieve contributions for all users whose names begin with this value.", + "Overrides {$p}user", + ), 'dir' => $this->getDirectionDescription( $p ), 'namespace' => 'Only list contributions in these namespaces', 'prop' => array( @@ -464,8 +484,11 @@ class ApiQueryContributions extends ApiQueryBase { ' patrolled - Tags patrolled edits', ' tags - Lists tags for the edit', ), - 'show' => array( "Show only items that meet this criteria, e.g. non minor edits only: {$p}show=!minor", - "NOTE: If {$p}show=patrolled or {$p}show=!patrolled is set, revisions older than \$wgRCMaxAge ($wgRCMaxAge) won't be shown", ), + 'show' => array( + "Show only items that meet thse criteria, e.g. non minor edits only: {$p}show=!minor", + "NOTE: If {$p}show=patrolled or {$p}show=!patrolled is set, revisions older than", + "\$wgRCMaxAge ($wgRCMaxAge) won't be shown", + ), 'tag' => 'Only list revisions tagged with this tag', 'toponly' => 'Only list changes which are the latest revision', ); @@ -539,7 +562,10 @@ class ApiQueryContributions extends ApiQueryBase { array( 'code' => 'param_user', 'info' => 'User parameter may not be empty.' ), array( 'code' => 'param_user', 'info' => 'User name user is not valid' ), array( 'show' ), - array( 'code' => 'permissiondenied', 'info' => 'You need the patrol right to request the patrolled flag' ), + array( + 'code' => 'permissiondenied', + 'info' => 'You need the patrol right to request the patrolled flag' + ), ) ); } diff --git a/includes/api/ApiQueryUserInfo.php b/includes/api/ApiQueryUserInfo.php index 1d7ed63ee6..37cf483039 100644 --- a/includes/api/ApiQueryUserInfo.php +++ b/includes/api/ApiQueryUserInfo.php @@ -234,7 +234,8 @@ class ApiQueryUserInfo extends ApiQueryBase { ' ratelimits - Lists all rate limits applying to the current user', ' realname - Adds the user\'s real name', ' email - Adds the user\'s email address and email authentication date', - ' acceptlang - Echoes the Accept-Language header sent by the client in a structured format', + ' acceptlang - Echoes the Accept-Language header sent by ' . + 'the client in a structured format', ' registrationdate - Adds the user\'s registration date', ) ); -- 2.20.1