From 5387b8a806cb3ef5144136d05a9ebf5bcdee3b99 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Fri, 23 Jul 2010 07:33:40 +0000 Subject: [PATCH] Stylize API up to date Fix spaces from r69755 Minor update to RELEASE-NOTES per r69753 --- RELEASE-NOTES | 2 +- includes/api/ApiBase.php | 6 ++-- includes/api/ApiBlock.php | 4 +-- includes/api/ApiEditPage.php | 6 ++-- includes/api/ApiFormatBase.php | 2 +- includes/api/ApiFormatYaml_spyc.php | 2 +- includes/api/ApiHelp.php | 20 ++++++------ includes/api/ApiLogin.php | 4 +-- includes/api/ApiMain.php | 38 +++++++++++----------- includes/api/ApiPageSet.php | 14 ++++---- includes/api/ApiParse.php | 6 ++-- includes/api/ApiQuery.php | 22 ++++++------- includes/api/ApiQueryAllmessages.php | 4 +-- includes/api/ApiQueryBase.php | 4 +-- includes/api/ApiQueryBlocks.php | 2 +- includes/api/ApiQueryCategories.php | 2 +- includes/api/ApiQueryFilearchive.php | 12 +++---- includes/api/ApiQueryIWBacklinks.php | 20 ++++++------ includes/api/ApiQueryImageInfo.php | 2 +- includes/api/ApiQueryInfo.php | 16 ++++----- includes/api/ApiQueryLinks.php | 2 +- includes/api/ApiQueryLogEvents.php | 4 +-- includes/api/ApiQueryRevisions.php | 4 +-- includes/api/ApiQueryUserContributions.php | 2 +- includes/api/ApiQueryUserInfo.php | 4 +-- includes/api/ApiQueryUsers.php | 6 ++-- includes/api/ApiQueryWatchlist.php | 2 +- includes/api/ApiQueryWatchlistRaw.php | 2 +- includes/api/ApiRollback.php | 4 +-- includes/api/ApiUpload.php | 4 +-- includes/api/ApiUserrights.php | 2 +- 31 files changed, 112 insertions(+), 112 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 729dad4ffd..c93e01a7ff 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -283,7 +283,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN canonical language variant. * Fixed "link" parameter in image links with "thumb" parameter. * (bug 23936) Add "displaytitle" to query/info API -* (bug 24485) Make iwbacklinks a generator, display iwprefix and iwtitle optional +* (bug 24485) Make iwbacklinks a generator, optionally display iwprefix and iwtitle === Languages updated in 1.17 === diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 3ce630a026..19779d40f0 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -546,7 +546,7 @@ abstract class ApiBase { * Return true if we're to watch the page, false if not, null if no change. * @param $watchlist String Valid values: 'watch', 'unwatch', 'preferences', 'nochange' * @param $titleObj Title the page under consideration - * @param $userOption The user option to consider when $watchlist=preferences. + * @param $userOption The user option to consider when $watchlist=preferences. * If not set will magically default to either watchdefault or watchcreations * @returns mixed */ @@ -724,7 +724,7 @@ abstract class ApiBase { } $value[$key] = $title->getText(); } - + if ( !$multi ) { $value = $value[0]; } @@ -1090,7 +1090,7 @@ abstract class ApiBase { /** * Gets the user for whom to get the watchlist - * + * * @returns User */ public function getWatchlistUser( $params ) { diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php index c3272f7479..dfd52e5b3f 100644 --- a/includes/api/ApiBlock.php +++ b/includes/api/ApiBlock.php @@ -170,7 +170,7 @@ class ApiBlock extends ApiBase { public function getDescription() { return 'Block a user'; } - + public function getPossibleErrors() { return array_merge( parent::getPossibleErrors(), array( array( 'missingparam', 'user' ), @@ -181,7 +181,7 @@ class ApiBlock extends ApiBase { array( 'ipbnounblockself' ), ) ); } - + public function getTokenSalt() { return ''; } diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index b0d2ed750c..fabbd77fa6 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -319,17 +319,17 @@ class ApiEditPage extends ApiBase { $newArticle->getTimestamp() ); } break; - + case EditPage::AS_SUMMARY_NEEDED: $this->dieUsageMsg( array( 'summaryrequired' ) ); case EditPage::AS_END: // This usually means some kind of race condition - // or DB weirdness occurred. + // or DB weirdness occurred. if ( is_array( $result ) && count( $result ) > 0 ) { $this->dieUsageMsg( array( 'unknownerror', $result[0][0] ) ); } - + // Unknown error, but no specific error message // Fall through default: diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php index 8554b5b87e..493e866d8d 100644 --- a/includes/api/ApiFormatBase.php +++ b/includes/api/ApiFormatBase.php @@ -120,7 +120,7 @@ abstract class ApiFormatBase extends ApiBase { public function disable() { $this->mDisabled = true; } - + public function isDisabled() { return $this->mDisabled; } diff --git a/includes/api/ApiFormatYaml_spyc.php b/includes/api/ApiFormatYaml_spyc.php index 093ae3eb95..e10f0916ca 100644 --- a/includes/api/ApiFormatYaml_spyc.php +++ b/includes/api/ApiFormatYaml_spyc.php @@ -192,7 +192,7 @@ class Spyc { } else { if ( $key == '*' ) // bug 21922 - Quote asterix used as keys $key = "'*'"; - + // It's mapped if ( $value !== '' && !is_null( $value ) ) $string = $spaces . $key . ': ' . $value . "\n"; diff --git a/includes/api/ApiHelp.php b/includes/api/ApiHelp.php index 3d8e7e4000..26abda6c2c 100644 --- a/includes/api/ApiHelp.php +++ b/includes/api/ApiHelp.php @@ -45,13 +45,13 @@ class ApiHelp extends ApiBase { public function execute() { // Get parameters $params = $this->extractRequestParams(); - + if ( !isset( $params['modules'] ) && !isset( $params['querymodules'] ) ) { $this->dieUsage( '', 'help' ); } - + $this->getMain()->setHelp(); - + $result = $this->getResult(); $queryObj = new ApiQuery( $this->getMain(), 'query' ); $r = array(); @@ -79,27 +79,27 @@ class ApiHelp extends ApiBase { } $module = new $qmodArr[$qm]( $this, $qm ); $type = $queryObj->getModuleType( $qm ); - + if ( $type === null ) { $r[] = array( 'name' => $qm, 'missing' => '' ); continue; } - + $r[] = $this->buildModuleHelp( $module, $type ); } } $result->setIndexedTagName( $r, 'module' ); $result->addValue( null, $this->getModuleName(), $r ); } - + private function buildModuleHelp( $module, $type ) { $msg = ApiMain::makeHelpMsgHeader( $module, $type ); - + $msg2 = $module->makeHelpMsg(); if ( $msg2 !== false ) { $msg .= $msg2; } - + return $msg; } @@ -110,7 +110,7 @@ class ApiHelp extends ApiBase { public function isReadMode() { return false; } - + public function getAllowedParams() { return array( 'modules' => array( @@ -132,7 +132,7 @@ class ApiHelp extends ApiBase { public function getDescription() { return 'Display this help screen. Or the help screen for the specified module'; } - + protected function getExamples() { return array( 'Whole help page:', diff --git a/includes/api/ApiLogin.php b/includes/api/ApiLogin.php index d869b39d3e..c45ff213aa 100644 --- a/includes/api/ApiLogin.php +++ b/includes/api/ApiLogin.php @@ -87,7 +87,7 @@ class ApiLogin extends ApiBase { $result['cookieprefix'] = $wgCookiePrefix; $result['sessionid'] = session_id(); break; - + case LoginForm::NEED_TOKEN: global $wgCookiePrefix; $result['result'] = 'NeedToken'; @@ -95,7 +95,7 @@ class ApiLogin extends ApiBase { $result['cookieprefix'] = $wgCookiePrefix; $result['sessionid'] = session_id(); break; - + case LoginForm::WRONG_TOKEN: $result['result'] = 'WrongToken'; break; diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 5a97fa9622..62dc95c0e7 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -200,7 +200,7 @@ class ApiMain extends ApiBase { public function getModule() { return $this->mModule; } - + /** * Get the result formatter object. Only works after setupExecuteAction() */ @@ -222,30 +222,30 @@ class ApiMain extends ApiBase { * Set the type of caching headers which will be sent. * * @param $mode One of: - * - 'public': Cache this object in public caches, if the maxage or smaxage + * - 'public': Cache this object in public caches, if the maxage or smaxage * parameter is set, or if setCacheMaxAge() was called. If a maximum age is * not provided by any of these means, the object will be private. * - 'private': Cache this object only in private client-side caches. * - 'anon-public-user-private': Make this object cacheable for logged-out - * users, but private for logged-in users. IMPORTANT: If this is set, it must be - * set consistently for a given URL, it cannot be set differently depending on + * users, but private for logged-in users. IMPORTANT: If this is set, it must be + * set consistently for a given URL, it cannot be set differently depending on * things like the contents of the database, or whether the user is logged in. * * If the wiki does not allow anonymous users to read it, the mode set here - * will be ignored, and private caching headers will always be sent. In other words, + * will be ignored, and private caching headers will always be sent. In other words, * the "public" mode is equivalent to saying that the data sent is as public as a page * view. * - * For user-dependent data, the private mode should generally be used. The - * anon-public-user-private mode should only be used where there is a particularly + * For user-dependent data, the private mode should generally be used. The + * anon-public-user-private mode should only be used where there is a particularly * good performance reason for caching the anonymous response, but where the - * response to logged-in users may differ, or may contain private data. + * response to logged-in users may differ, or may contain private data. * * If this function is never called, then the default will be the private mode. */ public function setCacheMode( $mode ) { if ( !in_array( $mode, array( 'private', 'public', 'anon-public-user-private' ) ) ) { - wfDebug( __METHOD__.": unrecognised cache mode \"$mode\"\n" ); + wfDebug( __METHOD__ . ": unrecognised cache mode \"$mode\"\n" ); // Ignore for forwards-compatibility return; } @@ -253,18 +253,18 @@ class ApiMain extends ApiBase { if ( !in_array( 'read', User::getGroupPermissions( array( '*' ) ), true ) ) { // Private wiki, only private headers if ( $mode !== 'private' ) { - wfDebug( __METHOD__.": ignoring request for $mode cache mode, private wiki\n" ); + wfDebug( __METHOD__ . ": ignoring request for $mode cache mode, private wiki\n" ); return; } } - wfDebug( __METHOD__.": setting cache mode $mode\n" ); + wfDebug( __METHOD__ . ": setting cache mode $mode\n" ); $this->mCacheMode = $mode; } - + /** - * @deprecated Private caching is now the default, so there is usually no - * need to call this function. If there is a need, you can use + * @deprecated Private caching is now the default, so there is usually no + * need to call this function. If there is a need, you can use * $this->setCacheMode('private') */ public function setCachePrivate() { @@ -276,13 +276,13 @@ class ApiMain extends ApiBase { * Boolean values will be formatted as such, by including or omitting * without an equals sign. * - * Cache control values set here will only be used if the cache mode is not + * Cache control values set here will only be used if the cache mode is not * private, see setCacheMode(). */ public function setCacheControl( $directives ) { $this->mCacheControl = $directives + $this->mCacheControl; } - + /** * Make sure Vary: Cookie and friends are set. Use this when the output of a request * may be cached for anons but may not be cached for logged-in users. @@ -364,7 +364,7 @@ class ApiMain extends ApiBase { $this->printResult( true ); } - // Send cache headers after any code which might generate an error, to + // Send cache headers after any code which might generate an error, to // avoid sending public cache headers for errors. $this->sendCacheHeaders(); @@ -402,7 +402,7 @@ class ApiMain extends ApiBase { // Give a debugging message if the user object is unstubbed on a public request global $wgUser; if ( !( $wgUser instanceof StubUser ) ) { - wfDebug( __METHOD__." \$wgUser is unstubbed on a public request!\n" ); + wfDebug( __METHOD__ . " \$wgUser is unstubbed on a public request!\n" ); } } @@ -519,7 +519,7 @@ class ApiMain extends ApiBase { $this->getResult()->addValue( null, 'requestid', $requestid ); } $servedby = $this->getParameter( 'servedby' ); - if( $servedby ) { + if ( $servedby ) { $this->getResult()->addValue( null, 'servedby', wfHostName() ); } diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index a24a75f2b7..ae81d24f17 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -80,7 +80,7 @@ class ApiPageSet extends ApiQueryBase { if ( $resolveRedirects ) { $this->mPendingRedirectIDs = array(); } - + $this->mConvertTitles = $convertTitles; $this->mConvertedTitles = array(); @@ -225,12 +225,12 @@ class ApiPageSet extends ApiQueryBase { public function getNormalizedTitles() { return $this->mNormalizedTitles; } - + /** * Get a list of title conversions - maps a title to its converted * version. * @return array raw_prefixed_title (string) => prefixed_title (string) - */ + */ public function getConvertedTitles() { return $this->mConvertedTitles; } @@ -259,7 +259,7 @@ class ApiPageSet extends ApiQueryBase { public function getMissingRevisionIDs() { return $this->mMissingRevIDs; } - + /** * Get the list of titles with negative namespace * @return array Title @@ -667,7 +667,7 @@ class ApiPageSet extends ApiQueryBase { continue; // There's nothing else we can do } $unconvertedTitle = $titleObj->getPrefixedText(); - $titleWasConverted = false; + $titleWasConverted = false; $iw = $titleObj->getInterwiki(); if ( strval( $iw ) !== '' ) { // This title is an interwiki link. @@ -683,8 +683,8 @@ class ApiPageSet extends ApiQueryBase { $wgContLang->findVariantLink( $title, $titleObj ); $titleWasConverted = $unconvertedTitle !== $titleObj->getPrefixedText(); } - - + + if ( $titleObj->getNamespace() < 0 ) { // Handle Special and Media pages $titleObj = $titleObj->fixSpecialName(); diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index b7b2563613..d850690ccd 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -241,7 +241,7 @@ class ApiParse extends ApiBase { $result_array['headhtml'] = array(); $result->setContent( $result_array['headhtml'], $out->headElement( $userSkin ) ); } - + if ( isset( $prop['iwlinks'] ) ) { $result_array['iwlinks'] = $this->formatIWLinks( $p_result->getInterwikiLinks() ); } @@ -324,12 +324,12 @@ class ApiParse extends ApiBase { foreach ( $titles as $title => $id ) { $entry = array(); $entry['prefix'] = $prefix; - + $title = Title::newFromText( "{$prefix}:{$title}" ); if ( $title ) { $entry['url'] = $title->getFullURL(); } - + $this->getResult()->setContent( $entry, $title->getFullText() ); $result[] = $entry; } diff --git a/includes/api/ApiQuery.php b/includes/api/ApiQuery.php index b3caa1009d..b86438f108 100644 --- a/includes/api/ApiQuery.php +++ b/includes/api/ApiQuery.php @@ -174,7 +174,7 @@ class ApiQuery extends ApiBase { function getModules() { return array_merge( $this->mQueryPropModules, $this->mQueryListModules, $this->mQueryMetaModules ); } - + /** * Get whether the specified module is a prop, list or a meta query module * @param $moduleName string Name of the module to find type for @@ -184,15 +184,15 @@ class ApiQuery extends ApiBase { if ( array_key_exists ( $moduleName, $this->mQueryPropModules ) ) { return 'prop'; } - + if ( array_key_exists ( $moduleName, $this->mQueryListModules ) ) { return 'list'; } - + if ( array_key_exists ( $moduleName, $this->mQueryMetaModules ) ) { return 'meta'; } - + return null; } @@ -238,7 +238,7 @@ class ApiQuery extends ApiBase { if ( isset( $this->params['generator'] ) ) { $generator = $this->newGenerator( $this->params['generator'] ); $params = $generator->extractRequestParams(); - $cacheMode = $this->mergeCacheMode( $cacheMode, + $cacheMode = $this->mergeCacheMode( $cacheMode, $generator->getCacheMode( $params ) ); $this->executeGeneratorModule( $generator, $modules ); } else { @@ -253,7 +253,7 @@ class ApiQuery extends ApiBase { // Execute all requested modules. foreach ( $modules as $module ) { $params = $module->extractRequestParams(); - $cacheMode = $this->mergeCacheMode( + $cacheMode = $this->mergeCacheMode( $cacheMode, $module->getCacheMode( $params ) ); $module->profileIn(); $module->execute(); @@ -267,7 +267,7 @@ class ApiQuery extends ApiBase { /** * Update a cache mode string, applying the cache mode of a new module to it. - * The cache mode may increase in the level of privacy, but public modules + * The cache mode may increase in the level of privacy, but public modules * added to private data do not decrease the level of privacy. */ protected function mergeCacheMode( $cacheMode, $modCacheMode ) { @@ -338,7 +338,7 @@ class ApiQuery extends ApiBase { $result->setIndexedTagName( $normValues, 'n' ); $result->addValue( 'query', 'normalized', $normValues ); } - + // Title conversions $convValues = array(); foreach ( $pageSet->getConvertedTitles() as $rawTitleStr => $titleStr ) { @@ -351,7 +351,7 @@ class ApiQuery extends ApiBase { if ( count( $convValues ) ) { $result->setIndexedTagName( $convValues, 'c' ); $result->addValue( 'query', 'converted', $convValues ); - } + } // Interwiki titles $intrwValues = array(); @@ -424,9 +424,9 @@ class ApiQuery extends ApiBase { $vals = array(); ApiQueryBase::addTitleInfo( $vals, $title ); $vals['special'] = ''; - if ( $title->getNamespace() == NS_SPECIAL && + if ( $title->getNamespace() == NS_SPECIAL && !SpecialPage::exists( $title->getText() ) ) { - $vals['missing'] = ''; + $vals['missing'] = ''; } elseif ( $title->getNamespace() == NS_MEDIA && !wfFindFile( $title ) ) { $vals['missing'] = ''; diff --git a/includes/api/ApiQueryAllmessages.php b/includes/api/ApiQueryAllmessages.php index 86e2f91554..39b736b4ac 100644 --- a/includes/api/ApiQueryAllmessages.php +++ b/includes/api/ApiQueryAllmessages.php @@ -43,7 +43,7 @@ class ApiQueryAllmessages extends ApiQueryBase { $params = $this->extractRequestParams(); global $wgLang; - + $oldLang = null; if ( !is_null( $params['lang'] ) ) { $oldLang = $wgLang; // Keep $wgLang for restore later @@ -122,7 +122,7 @@ class ApiQueryAllmessages extends ApiQueryBase { } } $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'message' ); - + if ( !is_null( $oldLang ) ) { $wgLang = $oldLang; // Restore $oldLang } diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index 80b2ca9414..1a2ddcc96e 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -47,10 +47,10 @@ abstract class ApiQueryBase extends ApiBase { } /** - * Get the cache mode for the data generated by this module. Override this + * Get the cache mode for the data generated by this module. Override this * in the module subclass. * - * Public caching will only be allowed if *all* the modules that supply + * Public caching will only be allowed if *all* the modules that supply * data for a given request return a cache mode of public. */ public function getCacheMode( $params ) { diff --git a/includes/api/ApiQueryBlocks.php b/includes/api/ApiQueryBlocks.php index dd0e53f03e..a1f50702da 100644 --- a/includes/api/ApiQueryBlocks.php +++ b/includes/api/ApiQueryBlocks.php @@ -124,7 +124,7 @@ class ApiQueryBlocks extends ApiQueryBase { 'ipb_auto' => 0 ) ); } - + if ( !$wgUser->isAllowed( 'hideuser' ) ) { $this->addWhereFld( 'ipb_deleted', 0 ); } diff --git a/includes/api/ApiQueryCategories.php b/includes/api/ApiQueryCategories.php index 9d95fc7200..fb2b3ec5d4 100644 --- a/includes/api/ApiQueryCategories.php +++ b/includes/api/ApiQueryCategories.php @@ -228,7 +228,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { public function getDescription() { return 'List all categories the page(s) belong to'; } - + public function getPossibleErrors() { return array_merge( parent::getPossibleErrors(), array( array( 'show' ), diff --git a/includes/api/ApiQueryFilearchive.php b/includes/api/ApiQueryFilearchive.php index e7393451f1..9c459d7937 100644 --- a/includes/api/ApiQueryFilearchive.php +++ b/includes/api/ApiQueryFilearchive.php @@ -47,11 +47,11 @@ class ApiQueryFilearchive extends ApiQueryBase { if ( !$wgUser->isAllowed( 'deletedhistory' ) ) { $this->dieUsage( 'You don\'t have permission to view deleted file information', 'permissiondenied' ); } - + $db = $this->getDB(); $params = $this->extractRequestParams(); - + $prop = array_flip( $params['prop'] ); $fld_sha1 = isset( $prop['sha1'] ); $fld_timestamp = isset( $prop['timestamp'] ); @@ -62,9 +62,9 @@ class ApiQueryFilearchive extends ApiQueryBase { $fld_mime = isset( $prop['mime'] ); $fld_metadata = isset( $prop['metadata'] ); $fld_bitdepth = isset( $prop['bitdepth'] ); - + $this->addTables( 'filearchive' ); - + $this->addFields( 'fa_name' ); $this->addFieldsIf( 'fa_storage_key', $fld_sha1 ); $this->addFieldsIf( 'fa_timestamp', $fld_timestamp ); @@ -125,7 +125,7 @@ class ApiQueryFilearchive extends ApiQueryBase { $this->setContinueEnumParameter( 'from', $this->keyToTitle( $row->fa_name ) ); break; } - + $file = array(); $file['name'] = $row->fa_name; @@ -157,7 +157,7 @@ class ApiQueryFilearchive extends ApiQueryBase { if ( $fld_mime ) { $file['mime'] = "$row->fa_major_mime/$row->fa_minor_mime"; } - + $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $file ); if ( !$fit ) { $this->setContinueEnumParameter( 'from', $this->keyToTitle( $row->fa_name ) ); diff --git a/includes/api/ApiQueryIWBacklinks.php b/includes/api/ApiQueryIWBacklinks.php index ab5cbaef1d..40a9a53c4e 100644 --- a/includes/api/ApiQueryIWBacklinks.php +++ b/includes/api/ApiQueryIWBacklinks.php @@ -38,7 +38,7 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase { public function __construct( $query, $moduleName ) { parent::__construct( $query, $moduleName, 'iwbl' ); } - + public function execute() { $this->run(); } @@ -49,7 +49,7 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase { public function run( $resultPageSet = null ) { $params = $this->extractRequestParams(); - + if ( isset( $params['title'] ) && !isset( $params['prefix'] ) ) { $this->dieUsageMsg( array( 'missingparam', 'prefix' ) ); } @@ -72,7 +72,7 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase { "iwl_from >= $from)))" ); } - + $prop = array_flip( $params['prop'] ); $iwprefix = isset( $prop['iwprefix'] ); $iwtitle = isset( $prop['iwtitle'] ); @@ -98,7 +98,7 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase { $this->addOption( 'LIMIT', $params['limit'] + 1 ); $res = $this->select( __METHOD__ ); - + $pages = array(); $count = 0; @@ -110,24 +110,24 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase { $this->setContinueEnumParameter( 'continue', "{$row->iwl_prefix}|{$row->iwl_title}|{$row->iwl_from}" ); break; } - + if ( !is_null( $resultPageSet ) ) { $pages[] = Title::makeTitle( $row->page_namespace, $row->page_title )->getPrefixedText(); } else { $entry = array(); - + $entry['pageid'] = intval( $row->page_id ); $entry['ns'] = $row->page_namespace; $entry['title'] = $row->page_title; - + if ( $row->page_is_redirect ) { $entry['redirect'] = ''; } - + if ( $iwprefix ) { $entry['iwprefix'] = $row->iwl_prefix; } - + if ( $iwtitle ) { $entry['iwtitle'] = $row->iwl_title; } @@ -139,7 +139,7 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase { } } } - + if ( is_null( $resultPageSet ) ) { $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'iw' ); } else { diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index 465d8c0472..8b6a995b20 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -222,7 +222,7 @@ class ApiQueryImageInfo extends ApiQueryBase { $vals['thumbwidth'] = intval( $file->getWidth() ); $vals['thumbheight'] = intval( $file->getHeight() ); } - + if ( isset( $prop['thumbmime'] ) ) { $thumbFile = UnregisteredLocalFile::newFromPath( $mto->getPath(), false ); $vals['thumbmime'] = $thumbFile->getMimeType(); diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index 4dfeb7f60a..fd0b1074ff 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -260,7 +260,7 @@ class ApiQueryInfo extends ApiQueryBase { if ( $this->fld_talkid || $this->fld_subjectid ) { $this->getTSIDs(); } - + if ( $this->fld_displaytitle ) { $this->getDisplayTitle(); } @@ -354,7 +354,7 @@ class ApiQueryInfo extends ApiQueryBase { $pageInfo['preload'] = $text; } } - + if ( $this->fld_displaytitle ) { if ( isset( $this->displaytitles[$title->getArticleId()] ) ) { $pageInfo['displaytitle'] = $this->displaytitles[$title->getArticleId()]; @@ -528,7 +528,7 @@ class ApiQueryInfo extends ApiQueryBase { if ( !count( $getTitles ) ) { return; } - + $db = $this->getDB(); // Construct a custom WHERE clause that matches @@ -549,12 +549,12 @@ class ApiQueryInfo extends ApiQueryBase { } } } - + private function getDisplayTitle() { $this->displaytitles = array(); - + $pageIds = array_keys( $this->titles ); - + if ( !count( $pageIds ) ) { return; } @@ -565,7 +565,7 @@ class ApiQueryInfo extends ApiQueryBase { $this->addWhereFld( 'pp_page', $pageIds ); $this->addWhereFld( 'pp_propname', 'displaytitle' ); $res = $this->select( __METHOD__ ); - + foreach ( $res as $row ) { $this->displaytitles[$row->pp_page] = $row->pp_value; } @@ -639,7 +639,7 @@ class ApiQueryInfo extends ApiQueryBase { 'readable', # private 'preload', 'displaytitle', - // If you add more properties here, please consider whether they + // If you add more properties here, please consider whether they // need to be added to getCacheMode() ) ), 'token' => array( diff --git a/includes/api/ApiQueryLinks.php b/includes/api/ApiQueryLinks.php index 732f31064e..b2a5b7ab54 100644 --- a/includes/api/ApiQueryLinks.php +++ b/includes/api/ApiQueryLinks.php @@ -89,7 +89,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase { $this->addTables( $this->table ); $this->addWhereFld( $this->prefix . '_from', array_keys( $this->getPageSet()->getGoodTitles() ) ); $this->addWhereFld( $this->prefix . '_namespace', $params['namespace'] ); - + if ( !is_null( $params[$this->titlesParam] ) ) { $lb = new LinkBatch; foreach ( $params[$this->titlesParam] as $t ) { diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index e56b895895..5af2f5044e 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -204,7 +204,7 @@ class ApiQueryLogEvents extends ApiQueryBase { case 'block': $vals2 = array(); list( $vals2['duration'], $vals2['flags'] ) = $params; - + // Indefinite blocks have no expiry time if ( Block::parseExpiryInput( $params[0] ) !== Block::infinity() ) { $vals2['expiry'] = wfTimestamp( TS_ISO_8601, @@ -240,7 +240,7 @@ class ApiQueryLogEvents extends ApiQueryBase { ApiQueryBase::addTitleInfo( $vals, $title ); } } - + if ( $this->fld_type || $this->fld_action ) { $vals['type'] = $row->log_type; $vals['action'] = $row->log_action; diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index 3130405320..a90a73bb95 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -387,7 +387,7 @@ class ApiQueryRevisions extends ApiQueryBase { $vals['commenthidden'] = ''; } else { $comment = $revision->getComment(); - + if ( $this->fld_comment ) { $vals['comment'] = $comment; } @@ -490,7 +490,7 @@ class ApiQueryRevisions extends ApiQueryBase { if ( !is_null( $params['prop'] ) && in_array( 'parsedcomment', $params['prop'] ) ) { // formatComment() calls wfMsg() among other things return 'anon-public-user-private'; - } + } return 'public'; } diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index c62b4239b7..51b3914319 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -217,7 +217,7 @@ class ApiQueryContributions extends ApiQueryBase { if ( !$wgUser->useRCPatrol() && !$wgUser->useNPPatrol() ) { $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' ); } - + // Use a redundant join condition on both // timestamp and ID so we can use the timestamp // index diff --git a/includes/api/ApiQueryUserInfo.php b/includes/api/ApiQueryUserInfo.php index ffe1a0cf3d..8645bf708f 100644 --- a/includes/api/ApiQueryUserInfo.php +++ b/includes/api/ApiQueryUserInfo.php @@ -77,7 +77,7 @@ class ApiQueryUserInfo extends ApiQueryBase { if ( isset( $this->prop['groups'] ) ) { $autolist = ApiQueryUsers::getAutoGroups( $wgUser ); - + $vals['groups'] = array_merge( $autolist, $wgUser->getGroups() ); $result->setIndexedTagName( $vals['groups'], 'g' ); // even if empty } @@ -123,7 +123,7 @@ class ApiQueryUserInfo extends ApiQueryBase { $vals['emailauthenticated'] = wfTimestamp( TS_ISO_8601, $auth ); } } - + if ( isset( $this->prop['acceptlang'] ) ) { $langs = $wgRequest->getAcceptLang(); $acceptLang = array(); diff --git a/includes/api/ApiQueryUsers.php b/includes/api/ApiQueryUsers.php index 23ea58dd0e..4fd256fe30 100644 --- a/includes/api/ApiQueryUsers.php +++ b/includes/api/ApiQueryUsers.php @@ -200,9 +200,9 @@ if ( !defined( 'MEDIAWIKI' ) ) { } else { if ( isset( $this->prop['groups'] ) && isset( $data[$u]['groups'] ) ) { $autolist = ApiQueryUsers::getAutoGroups( User::newFromName( $u ) ); - + $data[$u]['groups'] = array_merge( $autolist, $data[$u]['groups'] ); - + $this->getResult()->setIndexedTagName( $data[$u]['groups'], 'g' ); } } @@ -217,7 +217,7 @@ if ( !defined( 'MEDIAWIKI' ) ) { } return $this->getResult()->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'user' ); } - + /** * Gets all the groups that a user is automatically a member of * @return array diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index 2d61f82027..e6896da739 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -56,7 +56,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { $this->selectNamedDB( 'watchlist', DB_SLAVE, 'watchlist' ); $params = $this->extractRequestParams(); - + $user = $this->getWatchlistUser( $params ); if ( !is_null( $params['prop'] ) && is_null( $resultPageSet ) ) { diff --git a/includes/api/ApiQueryWatchlistRaw.php b/includes/api/ApiQueryWatchlistRaw.php index df1034058c..93dd018b1a 100644 --- a/includes/api/ApiQueryWatchlistRaw.php +++ b/includes/api/ApiQueryWatchlistRaw.php @@ -50,7 +50,7 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase { private function run( $resultPageSet = null ) { $this->selectNamedDB( 'watchlist', DB_SLAVE, 'watchlist' ); - + $params = $this->extractRequestParams(); $user = $this->getWatchlistUser( $params ); diff --git a/includes/api/ApiRollback.php b/includes/api/ApiRollback.php index 1857bafc21..5f6f5c6314 100644 --- a/includes/api/ApiRollback.php +++ b/includes/api/ApiRollback.php @@ -136,7 +136,7 @@ class ApiRollback extends ApiBase { if ( !isset( $params['user'] ) ) { $this->dieUsageMsg( array( 'missingparam', 'user' ) ); } - + // We need to be able to revert IPs, but getCanonicalName rejects them $this->mUser = User::isIP( $params['user'] ) ? $params['user'] @@ -166,7 +166,7 @@ class ApiRollback extends ApiBase { if ( !$this->mTitleObj->exists() ) { $this->dieUsageMsg( array( 'notanarticle' ) ); } - + return $this->mTitleObj; } diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index 96ff211e97..ca91c0406b 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -268,8 +268,8 @@ class ApiUpload extends ApiBase { $warnings = $this->checkForWarnings(); if ( isset( $warnings ) ) { - return $warnings; - } + return $warnings; + } // Use comment as initial page text by default if ( is_null( $this->mParams['text'] ) ) { diff --git a/includes/api/ApiUserrights.php b/includes/api/ApiUserrights.php index 8ca22f3fdf..8f6f659fb9 100644 --- a/includes/api/ApiUserrights.php +++ b/includes/api/ApiUserrights.php @@ -54,7 +54,7 @@ class ApiUserrights extends ApiBase { $this->getResult()->setIndexedTagName( $r['removed'], 'group' ); $this->getResult()->addValue( null, $this->getModuleName(), $r ); } - + private function getUser() { if ( $this->mUser !== null ) { return $this->mUser; -- 2.20.1