r69777 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69776‎ | r69777 | r69778 >
Date:07:33, 23 July 2010
Author:reedy
Status:ok
Tags:
Comment:
Stylize API up to date

Fix spaces from r69755

Minor update to RELEASE-NOTES per r69753
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiBlock.php (modified) (history)
  • /trunk/phase3/includes/api/ApiEditPage.php (modified) (history)
  • /trunk/phase3/includes/api/ApiFormatBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiFormatYaml_spyc.php (modified) (history)
  • /trunk/phase3/includes/api/ApiHelp.php (modified) (history)
  • /trunk/phase3/includes/api/ApiLogin.php (modified) (history)
  • /trunk/phase3/includes/api/ApiMain.php (modified) (history)
  • /trunk/phase3/includes/api/ApiPageSet.php (modified) (history)
  • /trunk/phase3/includes/api/ApiParse.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQuery.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryAllmessages.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryBlocks.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryCategories.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryFilearchive.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryIWBacklinks.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryImageInfo.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryInfo.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryLinks.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryLogEvents.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRevisions.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryUserContributions.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryUserInfo.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryUsers.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryWatchlist.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryWatchlistRaw.php (modified) (history)
  • /trunk/phase3/includes/api/ApiRollback.php (modified) (history)
  • /trunk/phase3/includes/api/ApiUpload.php (modified) (history)
  • /trunk/phase3/includes/api/ApiUserrights.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES
@@ -283,7 +283,7 @@
284284 canonical language variant.
285285 * Fixed "link" parameter in image links with "thumb" parameter.
286286 * (bug 23936) Add "displaytitle" to query/info API
287 -* (bug 24485) Make iwbacklinks a generator, display iwprefix and iwtitle optional
 287+* (bug 24485) Make iwbacklinks a generator, optionally display iwprefix and iwtitle
288288
289289 === Languages updated in 1.17 ===
290290
Index: trunk/phase3/includes/api/ApiFormatBase.php
@@ -120,7 +120,7 @@
121121 public function disable() {
122122 $this->mDisabled = true;
123123 }
124 -
 124+
125125 public function isDisabled() {
126126 return $this->mDisabled;
127127 }
Index: trunk/phase3/includes/api/ApiPageSet.php
@@ -80,7 +80,7 @@
8181 if ( $resolveRedirects ) {
8282 $this->mPendingRedirectIDs = array();
8383 }
84 -
 84+
8585 $this->mConvertTitles = $convertTitles;
8686 $this->mConvertedTitles = array();
8787
@@ -225,12 +225,12 @@
226226 public function getNormalizedTitles() {
227227 return $this->mNormalizedTitles;
228228 }
229 -
 229+
230230 /**
231231 * Get a list of title conversions - maps a title to its converted
232232 * version.
233233 * @return array raw_prefixed_title (string) => prefixed_title (string)
234 - */
 234+ */
235235 public function getConvertedTitles() {
236236 return $this->mConvertedTitles;
237237 }
@@ -259,7 +259,7 @@
260260 public function getMissingRevisionIDs() {
261261 return $this->mMissingRevIDs;
262262 }
263 -
 263+
264264 /**
265265 * Get the list of titles with negative namespace
266266 * @return array Title
@@ -667,7 +667,7 @@
668668 continue; // There's nothing else we can do
669669 }
670670 $unconvertedTitle = $titleObj->getPrefixedText();
671 - $titleWasConverted = false;
 671+ $titleWasConverted = false;
672672 $iw = $titleObj->getInterwiki();
673673 if ( strval( $iw ) !== '' ) {
674674 // This title is an interwiki link.
@@ -683,8 +683,8 @@
684684 $wgContLang->findVariantLink( $title, $titleObj );
685685 $titleWasConverted = $unconvertedTitle !== $titleObj->getPrefixedText();
686686 }
687 -
688 -
 687+
 688+
689689 if ( $titleObj->getNamespace() < 0 ) {
690690 // Handle Special and Media pages
691691 $titleObj = $titleObj->fixSpecialName();
Index: trunk/phase3/includes/api/ApiQueryLogEvents.php
@@ -204,7 +204,7 @@
205205 case 'block':
206206 $vals2 = array();
207207 list( $vals2['duration'], $vals2['flags'] ) = $params;
208 -
 208+
209209 // Indefinite blocks have no expiry time
210210 if ( Block::parseExpiryInput( $params[0] ) !== Block::infinity() ) {
211211 $vals2['expiry'] = wfTimestamp( TS_ISO_8601,
@@ -240,7 +240,7 @@
241241 ApiQueryBase::addTitleInfo( $vals, $title );
242242 }
243243 }
244 -
 244+
245245 if ( $this->fld_type || $this->fld_action ) {
246246 $vals['type'] = $row->log_type;
247247 $vals['action'] = $row->log_action;
Index: trunk/phase3/includes/api/ApiQueryBase.php
@@ -47,10 +47,10 @@
4848 }
4949
5050 /**
51 - * Get the cache mode for the data generated by this module. Override this
 51+ * Get the cache mode for the data generated by this module. Override this
5252 * in the module subclass.
5353 *
54 - * Public caching will only be allowed if *all* the modules that supply
 54+ * Public caching will only be allowed if *all* the modules that supply
5555 * data for a given request return a cache mode of public.
5656 */
5757 public function getCacheMode( $params ) {
Index: trunk/phase3/includes/api/ApiQueryCategories.php
@@ -228,7 +228,7 @@
229229 public function getDescription() {
230230 return 'List all categories the page(s) belong to';
231231 }
232 -
 232+
233233 public function getPossibleErrors() {
234234 return array_merge( parent::getPossibleErrors(), array(
235235 array( 'show' ),
Index: trunk/phase3/includes/api/ApiQueryImageInfo.php
@@ -222,7 +222,7 @@
223223 $vals['thumbwidth'] = intval( $file->getWidth() );
224224 $vals['thumbheight'] = intval( $file->getHeight() );
225225 }
226 -
 226+
227227 if ( isset( $prop['thumbmime'] ) ) {
228228 $thumbFile = UnregisteredLocalFile::newFromPath( $mto->getPath(), false );
229229 $vals['thumbmime'] = $thumbFile->getMimeType();
Index: trunk/phase3/includes/api/ApiQueryWatchlist.php
@@ -56,7 +56,7 @@
5757 $this->selectNamedDB( 'watchlist', DB_SLAVE, 'watchlist' );
5858
5959 $params = $this->extractRequestParams();
60 -
 60+
6161 $user = $this->getWatchlistUser( $params );
6262
6363 if ( !is_null( $params['prop'] ) && is_null( $resultPageSet ) ) {
Index: trunk/phase3/includes/api/ApiRollback.php
@@ -136,7 +136,7 @@
137137 if ( !isset( $params['user'] ) ) {
138138 $this->dieUsageMsg( array( 'missingparam', 'user' ) );
139139 }
140 -
 140+
141141 // We need to be able to revert IPs, but getCanonicalName rejects them
142142 $this->mUser = User::isIP( $params['user'] )
143143 ? $params['user']
@@ -166,7 +166,7 @@
167167 if ( !$this->mTitleObj->exists() ) {
168168 $this->dieUsageMsg( array( 'notanarticle' ) );
169169 }
170 -
 170+
171171 return $this->mTitleObj;
172172 }
173173
Index: trunk/phase3/includes/api/ApiQueryWatchlistRaw.php
@@ -50,7 +50,7 @@
5151
5252 private function run( $resultPageSet = null ) {
5353 $this->selectNamedDB( 'watchlist', DB_SLAVE, 'watchlist' );
54 -
 54+
5555 $params = $this->extractRequestParams();
5656
5757 $user = $this->getWatchlistUser( $params );
Index: trunk/phase3/includes/api/ApiQuery.php
@@ -174,7 +174,7 @@
175175 function getModules() {
176176 return array_merge( $this->mQueryPropModules, $this->mQueryListModules, $this->mQueryMetaModules );
177177 }
178 -
 178+
179179 /**
180180 * Get whether the specified module is a prop, list or a meta query module
181181 * @param $moduleName string Name of the module to find type for
@@ -184,15 +184,15 @@
185185 if ( array_key_exists ( $moduleName, $this->mQueryPropModules ) ) {
186186 return 'prop';
187187 }
188 -
 188+
189189 if ( array_key_exists ( $moduleName, $this->mQueryListModules ) ) {
190190 return 'list';
191191 }
192 -
 192+
193193 if ( array_key_exists ( $moduleName, $this->mQueryMetaModules ) ) {
194194 return 'meta';
195195 }
196 -
 196+
197197 return null;
198198 }
199199
@@ -238,7 +238,7 @@
239239 if ( isset( $this->params['generator'] ) ) {
240240 $generator = $this->newGenerator( $this->params['generator'] );
241241 $params = $generator->extractRequestParams();
242 - $cacheMode = $this->mergeCacheMode( $cacheMode,
 242+ $cacheMode = $this->mergeCacheMode( $cacheMode,
243243 $generator->getCacheMode( $params ) );
244244 $this->executeGeneratorModule( $generator, $modules );
245245 } else {
@@ -253,7 +253,7 @@
254254 // Execute all requested modules.
255255 foreach ( $modules as $module ) {
256256 $params = $module->extractRequestParams();
257 - $cacheMode = $this->mergeCacheMode(
 257+ $cacheMode = $this->mergeCacheMode(
258258 $cacheMode, $module->getCacheMode( $params ) );
259259 $module->profileIn();
260260 $module->execute();
@@ -267,7 +267,7 @@
268268
269269 /**
270270 * Update a cache mode string, applying the cache mode of a new module to it.
271 - * The cache mode may increase in the level of privacy, but public modules
 271+ * The cache mode may increase in the level of privacy, but public modules
272272 * added to private data do not decrease the level of privacy.
273273 */
274274 protected function mergeCacheMode( $cacheMode, $modCacheMode ) {
@@ -338,7 +338,7 @@
339339 $result->setIndexedTagName( $normValues, 'n' );
340340 $result->addValue( 'query', 'normalized', $normValues );
341341 }
342 -
 342+
343343 // Title conversions
344344 $convValues = array();
345345 foreach ( $pageSet->getConvertedTitles() as $rawTitleStr => $titleStr ) {
@@ -351,7 +351,7 @@
352352 if ( count( $convValues ) ) {
353353 $result->setIndexedTagName( $convValues, 'c' );
354354 $result->addValue( 'query', 'converted', $convValues );
355 - }
 355+ }
356356
357357 // Interwiki titles
358358 $intrwValues = array();
@@ -424,9 +424,9 @@
425425 $vals = array();
426426 ApiQueryBase::addTitleInfo( $vals, $title );
427427 $vals['special'] = '';
428 - if ( $title->getNamespace() == NS_SPECIAL &&
 428+ if ( $title->getNamespace() == NS_SPECIAL &&
429429 !SpecialPage::exists( $title->getText() ) ) {
430 - $vals['missing'] = '';
 430+ $vals['missing'] = '';
431431 } elseif ( $title->getNamespace() == NS_MEDIA &&
432432 !wfFindFile( $title ) ) {
433433 $vals['missing'] = '';
Index: trunk/phase3/includes/api/ApiQueryRevisions.php
@@ -387,7 +387,7 @@
388388 $vals['commenthidden'] = '';
389389 } else {
390390 $comment = $revision->getComment();
391 -
 391+
392392 if ( $this->fld_comment ) {
393393 $vals['comment'] = $comment;
394394 }
@@ -490,7 +490,7 @@
491491 if ( !is_null( $params['prop'] ) && in_array( 'parsedcomment', $params['prop'] ) ) {
492492 // formatComment() calls wfMsg() among other things
493493 return 'anon-public-user-private';
494 - }
 494+ }
495495 return 'public';
496496 }
497497
Index: trunk/phase3/includes/api/ApiQueryFilearchive.php
@@ -47,11 +47,11 @@
4848 if ( !$wgUser->isAllowed( 'deletedhistory' ) ) {
4949 $this->dieUsage( 'You don\'t have permission to view deleted file information', 'permissiondenied' );
5050 }
51 -
 51+
5252 $db = $this->getDB();
5353
5454 $params = $this->extractRequestParams();
55 -
 55+
5656 $prop = array_flip( $params['prop'] );
5757 $fld_sha1 = isset( $prop['sha1'] );
5858 $fld_timestamp = isset( $prop['timestamp'] );
@@ -62,9 +62,9 @@
6363 $fld_mime = isset( $prop['mime'] );
6464 $fld_metadata = isset( $prop['metadata'] );
6565 $fld_bitdepth = isset( $prop['bitdepth'] );
66 -
 66+
6767 $this->addTables( 'filearchive' );
68 -
 68+
6969 $this->addFields( 'fa_name' );
7070 $this->addFieldsIf( 'fa_storage_key', $fld_sha1 );
7171 $this->addFieldsIf( 'fa_timestamp', $fld_timestamp );
@@ -125,7 +125,7 @@
126126 $this->setContinueEnumParameter( 'from', $this->keyToTitle( $row->fa_name ) );
127127 break;
128128 }
129 -
 129+
130130 $file = array();
131131 $file['name'] = $row->fa_name;
132132
@@ -157,7 +157,7 @@
158158 if ( $fld_mime ) {
159159 $file['mime'] = "$row->fa_major_mime/$row->fa_minor_mime";
160160 }
161 -
 161+
162162 $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $file );
163163 if ( !$fit ) {
164164 $this->setContinueEnumParameter( 'from', $this->keyToTitle( $row->fa_name ) );
Index: trunk/phase3/includes/api/ApiLogin.php
@@ -87,7 +87,7 @@
8888 $result['cookieprefix'] = $wgCookiePrefix;
8989 $result['sessionid'] = session_id();
9090 break;
91 -
 91+
9292 case LoginForm::NEED_TOKEN:
9393 global $wgCookiePrefix;
9494 $result['result'] = 'NeedToken';
@@ -95,7 +95,7 @@
9696 $result['cookieprefix'] = $wgCookiePrefix;
9797 $result['sessionid'] = session_id();
9898 break;
99 -
 99+
100100 case LoginForm::WRONG_TOKEN:
101101 $result['result'] = 'WrongToken';
102102 break;
Index: trunk/phase3/includes/api/ApiQueryUserInfo.php
@@ -77,7 +77,7 @@
7878
7979 if ( isset( $this->prop['groups'] ) ) {
8080 $autolist = ApiQueryUsers::getAutoGroups( $wgUser );
81 -
 81+
8282 $vals['groups'] = array_merge( $autolist, $wgUser->getGroups() );
8383 $result->setIndexedTagName( $vals['groups'], 'g' ); // even if empty
8484 }
@@ -123,7 +123,7 @@
124124 $vals['emailauthenticated'] = wfTimestamp( TS_ISO_8601, $auth );
125125 }
126126 }
127 -
 127+
128128 if ( isset( $this->prop['acceptlang'] ) ) {
129129 $langs = $wgRequest->getAcceptLang();
130130 $acceptLang = array();
Index: trunk/phase3/includes/api/ApiEditPage.php
@@ -319,17 +319,17 @@
320320 $newArticle->getTimestamp() );
321321 }
322322 break;
323 -
 323+
324324 case EditPage::AS_SUMMARY_NEEDED:
325325 $this->dieUsageMsg( array( 'summaryrequired' ) );
326326
327327 case EditPage::AS_END:
328328 // This usually means some kind of race condition
329 - // or DB weirdness occurred.
 329+ // or DB weirdness occurred.
330330 if ( is_array( $result ) && count( $result ) > 0 ) {
331331 $this->dieUsageMsg( array( 'unknownerror', $result[0][0] ) );
332332 }
333 -
 333+
334334 // Unknown error, but no specific error message
335335 // Fall through
336336 default:
Index: trunk/phase3/includes/api/ApiUpload.php
@@ -268,8 +268,8 @@
269269
270270 $warnings = $this->checkForWarnings();
271271 if ( isset( $warnings ) ) {
272 - return $warnings;
273 - }
 272+ return $warnings;
 273+ }
274274
275275 // Use comment as initial page text by default
276276 if ( is_null( $this->mParams['text'] ) ) {
Index: trunk/phase3/includes/api/ApiQueryAllmessages.php
@@ -43,7 +43,7 @@
4444 $params = $this->extractRequestParams();
4545
4646 global $wgLang;
47 -
 47+
4848 $oldLang = null;
4949 if ( !is_null( $params['lang'] ) ) {
5050 $oldLang = $wgLang; // Keep $wgLang for restore later
@@ -122,7 +122,7 @@
123123 }
124124 }
125125 $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'message' );
126 -
 126+
127127 if ( !is_null( $oldLang ) ) {
128128 $wgLang = $oldLang; // Restore $oldLang
129129 }
Index: trunk/phase3/includes/api/ApiQueryUsers.php
@@ -200,9 +200,9 @@
201201 } else {
202202 if ( isset( $this->prop['groups'] ) && isset( $data[$u]['groups'] ) ) {
203203 $autolist = ApiQueryUsers::getAutoGroups( User::newFromName( $u ) );
204 -
 204+
205205 $data[$u]['groups'] = array_merge( $autolist, $data[$u]['groups'] );
206 -
 206+
207207 $this->getResult()->setIndexedTagName( $data[$u]['groups'], 'g' );
208208 }
209209 }
@@ -217,7 +217,7 @@
218218 }
219219 return $this->getResult()->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'user' );
220220 }
221 -
 221+
222222 /**
223223 * Gets all the groups that a user is automatically a member of
224224 * @return array
Index: trunk/phase3/includes/api/ApiQueryUserContributions.php
@@ -217,7 +217,7 @@
218218 if ( !$wgUser->useRCPatrol() && !$wgUser->useNPPatrol() ) {
219219 $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' );
220220 }
221 -
 221+
222222 // Use a redundant join condition on both
223223 // timestamp and ID so we can use the timestamp
224224 // index
Index: trunk/phase3/includes/api/ApiBlock.php
@@ -170,7 +170,7 @@
171171 public function getDescription() {
172172 return 'Block a user';
173173 }
174 -
 174+
175175 public function getPossibleErrors() {
176176 return array_merge( parent::getPossibleErrors(), array(
177177 array( 'missingparam', 'user' ),
@@ -181,7 +181,7 @@
182182 array( 'ipbnounblockself' ),
183183 ) );
184184 }
185 -
 185+
186186 public function getTokenSalt() {
187187 return '';
188188 }
Index: trunk/phase3/includes/api/ApiQueryBlocks.php
@@ -124,7 +124,7 @@
125125 'ipb_auto' => 0
126126 ) );
127127 }
128 -
 128+
129129 if ( !$wgUser->isAllowed( 'hideuser' ) ) {
130130 $this->addWhereFld( 'ipb_deleted', 0 );
131131 }
Index: trunk/phase3/includes/api/ApiQueryLinks.php
@@ -89,7 +89,7 @@
9090 $this->addTables( $this->table );
9191 $this->addWhereFld( $this->prefix . '_from', array_keys( $this->getPageSet()->getGoodTitles() ) );
9292 $this->addWhereFld( $this->prefix . '_namespace', $params['namespace'] );
93 -
 93+
9494 if ( !is_null( $params[$this->titlesParam] ) ) {
9595 $lb = new LinkBatch;
9696 foreach ( $params[$this->titlesParam] as $t ) {
Index: trunk/phase3/includes/api/ApiQueryInfo.php
@@ -260,7 +260,7 @@
261261 if ( $this->fld_talkid || $this->fld_subjectid ) {
262262 $this->getTSIDs();
263263 }
264 -
 264+
265265 if ( $this->fld_displaytitle ) {
266266 $this->getDisplayTitle();
267267 }
@@ -354,7 +354,7 @@
355355 $pageInfo['preload'] = $text;
356356 }
357357 }
358 -
 358+
359359 if ( $this->fld_displaytitle ) {
360360 if ( isset( $this->displaytitles[$title->getArticleId()] ) ) {
361361 $pageInfo['displaytitle'] = $this->displaytitles[$title->getArticleId()];
@@ -528,7 +528,7 @@
529529 if ( !count( $getTitles ) ) {
530530 return;
531531 }
532 -
 532+
533533 $db = $this->getDB();
534534
535535 // Construct a custom WHERE clause that matches
@@ -549,12 +549,12 @@
550550 }
551551 }
552552 }
553 -
 553+
554554 private function getDisplayTitle() {
555555 $this->displaytitles = array();
556 -
 556+
557557 $pageIds = array_keys( $this->titles );
558 -
 558+
559559 if ( !count( $pageIds ) ) {
560560 return;
561561 }
@@ -565,7 +565,7 @@
566566 $this->addWhereFld( 'pp_page', $pageIds );
567567 $this->addWhereFld( 'pp_propname', 'displaytitle' );
568568 $res = $this->select( __METHOD__ );
569 -
 569+
570570 foreach ( $res as $row ) {
571571 $this->displaytitles[$row->pp_page] = $row->pp_value;
572572 }
@@ -639,7 +639,7 @@
640640 'readable', # private
641641 'preload',
642642 'displaytitle',
643 - // If you add more properties here, please consider whether they
 643+ // If you add more properties here, please consider whether they
644644 // need to be added to getCacheMode()
645645 ) ),
646646 'token' => array(
Index: trunk/phase3/includes/api/ApiMain.php
@@ -200,7 +200,7 @@
201201 public function getModule() {
202202 return $this->mModule;
203203 }
204 -
 204+
205205 /**
206206 * Get the result formatter object. Only works after setupExecuteAction()
207207 */
@@ -222,30 +222,30 @@
223223 * Set the type of caching headers which will be sent.
224224 *
225225 * @param $mode One of:
226 - * - 'public': Cache this object in public caches, if the maxage or smaxage
 226+ * - 'public': Cache this object in public caches, if the maxage or smaxage
227227 * parameter is set, or if setCacheMaxAge() was called. If a maximum age is
228228 * not provided by any of these means, the object will be private.
229229 * - 'private': Cache this object only in private client-side caches.
230230 * - 'anon-public-user-private': Make this object cacheable for logged-out
231 - * users, but private for logged-in users. IMPORTANT: If this is set, it must be
232 - * set consistently for a given URL, it cannot be set differently depending on
 231+ * users, but private for logged-in users. IMPORTANT: If this is set, it must be
 232+ * set consistently for a given URL, it cannot be set differently depending on
233233 * things like the contents of the database, or whether the user is logged in.
234234 *
235235 * If the wiki does not allow anonymous users to read it, the mode set here
236 - * will be ignored, and private caching headers will always be sent. In other words,
 236+ * will be ignored, and private caching headers will always be sent. In other words,
237237 * the "public" mode is equivalent to saying that the data sent is as public as a page
238238 * view.
239239 *
240 - * For user-dependent data, the private mode should generally be used. The
241 - * anon-public-user-private mode should only be used where there is a particularly
 240+ * For user-dependent data, the private mode should generally be used. The
 241+ * anon-public-user-private mode should only be used where there is a particularly
242242 * good performance reason for caching the anonymous response, but where the
243 - * response to logged-in users may differ, or may contain private data.
 243+ * response to logged-in users may differ, or may contain private data.
244244 *
245245 * If this function is never called, then the default will be the private mode.
246246 */
247247 public function setCacheMode( $mode ) {
248248 if ( !in_array( $mode, array( 'private', 'public', 'anon-public-user-private' ) ) ) {
249 - wfDebug( __METHOD__.": unrecognised cache mode \"$mode\"\n" );
 249+ wfDebug( __METHOD__ . ": unrecognised cache mode \"$mode\"\n" );
250250 // Ignore for forwards-compatibility
251251 return;
252252 }
@@ -253,18 +253,18 @@
254254 if ( !in_array( 'read', User::getGroupPermissions( array( '*' ) ), true ) ) {
255255 // Private wiki, only private headers
256256 if ( $mode !== 'private' ) {
257 - wfDebug( __METHOD__.": ignoring request for $mode cache mode, private wiki\n" );
 257+ wfDebug( __METHOD__ . ": ignoring request for $mode cache mode, private wiki\n" );
258258 return;
259259 }
260260 }
261261
262 - wfDebug( __METHOD__.": setting cache mode $mode\n" );
 262+ wfDebug( __METHOD__ . ": setting cache mode $mode\n" );
263263 $this->mCacheMode = $mode;
264264 }
265 -
 265+
266266 /**
267 - * @deprecated Private caching is now the default, so there is usually no
268 - * need to call this function. If there is a need, you can use
 267+ * @deprecated Private caching is now the default, so there is usually no
 268+ * need to call this function. If there is a need, you can use
269269 * $this->setCacheMode('private')
270270 */
271271 public function setCachePrivate() {
@@ -276,13 +276,13 @@
277277 * Boolean values will be formatted as such, by including or omitting
278278 * without an equals sign.
279279 *
280 - * Cache control values set here will only be used if the cache mode is not
 280+ * Cache control values set here will only be used if the cache mode is not
281281 * private, see setCacheMode().
282282 */
283283 public function setCacheControl( $directives ) {
284284 $this->mCacheControl = $directives + $this->mCacheControl;
285285 }
286 -
 286+
287287 /**
288288 * Make sure Vary: Cookie and friends are set. Use this when the output of a request
289289 * may be cached for anons but may not be cached for logged-in users.
@@ -364,7 +364,7 @@
365365 $this->printResult( true );
366366 }
367367
368 - // Send cache headers after any code which might generate an error, to
 368+ // Send cache headers after any code which might generate an error, to
369369 // avoid sending public cache headers for errors.
370370 $this->sendCacheHeaders();
371371
@@ -402,7 +402,7 @@
403403 // Give a debugging message if the user object is unstubbed on a public request
404404 global $wgUser;
405405 if ( !( $wgUser instanceof StubUser ) ) {
406 - wfDebug( __METHOD__." \$wgUser is unstubbed on a public request!\n" );
 406+ wfDebug( __METHOD__ . " \$wgUser is unstubbed on a public request!\n" );
407407 }
408408 }
409409
@@ -519,7 +519,7 @@
520520 $this->getResult()->addValue( null, 'requestid', $requestid );
521521 }
522522 $servedby = $this->getParameter( 'servedby' );
523 - if( $servedby ) {
 523+ if ( $servedby ) {
524524 $this->getResult()->addValue( null, 'servedby', wfHostName() );
525525 }
526526
Index: trunk/phase3/includes/api/ApiQueryIWBacklinks.php
@@ -38,7 +38,7 @@
3939 public function __construct( $query, $moduleName ) {
4040 parent::__construct( $query, $moduleName, 'iwbl' );
4141 }
42 -
 42+
4343 public function execute() {
4444 $this->run();
4545 }
@@ -49,7 +49,7 @@
5050
5151 public function run( $resultPageSet = null ) {
5252 $params = $this->extractRequestParams();
53 -
 53+
5454 if ( isset( $params['title'] ) && !isset( $params['prefix'] ) ) {
5555 $this->dieUsageMsg( array( 'missingparam', 'prefix' ) );
5656 }
@@ -72,7 +72,7 @@
7373 "iwl_from >= $from)))"
7474 );
7575 }
76 -
 76+
7777 $prop = array_flip( $params['prop'] );
7878 $iwprefix = isset( $prop['iwprefix'] );
7979 $iwtitle = isset( $prop['iwtitle'] );
@@ -98,7 +98,7 @@
9999 $this->addOption( 'LIMIT', $params['limit'] + 1 );
100100
101101 $res = $this->select( __METHOD__ );
102 -
 102+
103103 $pages = array();
104104
105105 $count = 0;
@@ -110,24 +110,24 @@
111111 $this->setContinueEnumParameter( 'continue', "{$row->iwl_prefix}|{$row->iwl_title}|{$row->iwl_from}" );
112112 break;
113113 }
114 -
 114+
115115 if ( !is_null( $resultPageSet ) ) {
116116 $pages[] = Title::makeTitle( $row->page_namespace, $row->page_title )->getPrefixedText();
117117 } else {
118118 $entry = array();
119 -
 119+
120120 $entry['pageid'] = intval( $row->page_id );
121121 $entry['ns'] = $row->page_namespace;
122122 $entry['title'] = $row->page_title;
123 -
 123+
124124 if ( $row->page_is_redirect ) {
125125 $entry['redirect'] = '';
126126 }
127 -
 127+
128128 if ( $iwprefix ) {
129129 $entry['iwprefix'] = $row->iwl_prefix;
130130 }
131 -
 131+
132132 if ( $iwtitle ) {
133133 $entry['iwtitle'] = $row->iwl_title;
134134 }
@@ -139,7 +139,7 @@
140140 }
141141 }
142142 }
143 -
 143+
144144 if ( is_null( $resultPageSet ) ) {
145145 $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'iw' );
146146 } else {
Index: trunk/phase3/includes/api/ApiHelp.php
@@ -45,13 +45,13 @@
4646 public function execute() {
4747 // Get parameters
4848 $params = $this->extractRequestParams();
49 -
 49+
5050 if ( !isset( $params['modules'] ) && !isset( $params['querymodules'] ) ) {
5151 $this->dieUsage( '', 'help' );
5252 }
53 -
 53+
5454 $this->getMain()->setHelp();
55 -
 55+
5656 $result = $this->getResult();
5757 $queryObj = new ApiQuery( $this->getMain(), 'query' );
5858 $r = array();
@@ -79,27 +79,27 @@
8080 }
8181 $module = new $qmodArr[$qm]( $this, $qm );
8282 $type = $queryObj->getModuleType( $qm );
83 -
 83+
8484 if ( $type === null ) {
8585 $r[] = array( 'name' => $qm, 'missing' => '' );
8686 continue;
8787 }
88 -
 88+
8989 $r[] = $this->buildModuleHelp( $module, $type );
9090 }
9191 }
9292 $result->setIndexedTagName( $r, 'module' );
9393 $result->addValue( null, $this->getModuleName(), $r );
9494 }
95 -
 95+
9696 private function buildModuleHelp( $module, $type ) {
9797 $msg = ApiMain::makeHelpMsgHeader( $module, $type );
98 -
 98+
9999 $msg2 = $module->makeHelpMsg();
100100 if ( $msg2 !== false ) {
101101 $msg .= $msg2;
102102 }
103 -
 103+
104104 return $msg;
105105 }
106106
@@ -110,7 +110,7 @@
111111 public function isReadMode() {
112112 return false;
113113 }
114 -
 114+
115115 public function getAllowedParams() {
116116 return array(
117117 'modules' => array(
@@ -132,7 +132,7 @@
133133 public function getDescription() {
134134 return 'Display this help screen. Or the help screen for the specified module';
135135 }
136 -
 136+
137137 protected function getExamples() {
138138 return array(
139139 'Whole help page:',
Index: trunk/phase3/includes/api/ApiUserrights.php
@@ -54,7 +54,7 @@
5555 $this->getResult()->setIndexedTagName( $r['removed'], 'group' );
5656 $this->getResult()->addValue( null, $this->getModuleName(), $r );
5757 }
58 -
 58+
5959 private function getUser() {
6060 if ( $this->mUser !== null ) {
6161 return $this->mUser;
Index: trunk/phase3/includes/api/ApiFormatYaml_spyc.php
@@ -192,7 +192,7 @@
193193 } else {
194194 if ( $key == '*' ) // bug 21922 - Quote asterix used as keys
195195 $key = "'*'";
196 -
 196+
197197 // It's mapped
198198 if ( $value !== '' && !is_null( $value ) )
199199 $string = $spaces . $key . ': ' . $value . "\n";
Index: trunk/phase3/includes/api/ApiBase.php
@@ -546,7 +546,7 @@
547547 * Return true if we're to watch the page, false if not, null if no change.
548548 * @param $watchlist String Valid values: 'watch', 'unwatch', 'preferences', 'nochange'
549549 * @param $titleObj Title the page under consideration
550 - * @param $userOption The user option to consider when $watchlist=preferences.
 550+ * @param $userOption The user option to consider when $watchlist=preferences.
551551 * If not set will magically default to either watchdefault or watchcreations
552552 * @returns mixed
553553 */
@@ -724,7 +724,7 @@
725725 }
726726 $value[$key] = $title->getText();
727727 }
728 -
 728+
729729 if ( !$multi ) {
730730 $value = $value[0];
731731 }
@@ -1090,7 +1090,7 @@
10911091
10921092 /**
10931093 * Gets the user for whom to get the watchlist
1094 - *
 1094+ *
10951095 * @returns User
10961096 */
10971097 public function getWatchlistUser( $params ) {
Index: trunk/phase3/includes/api/ApiParse.php
@@ -241,7 +241,7 @@
242242 $result_array['headhtml'] = array();
243243 $result->setContent( $result_array['headhtml'], $out->headElement( $userSkin ) );
244244 }
245 -
 245+
246246 if ( isset( $prop['iwlinks'] ) ) {
247247 $result_array['iwlinks'] = $this->formatIWLinks( $p_result->getInterwikiLinks() );
248248 }
@@ -324,12 +324,12 @@
325325 foreach ( $titles as $title => $id ) {
326326 $entry = array();
327327 $entry['prefix'] = $prefix;
328 -
 328+
329329 $title = Title::newFromText( "{$prefix}:{$title}" );
330330 if ( $title ) {
331331 $entry['url'] = $title->getFullURL();
332332 }
333 -
 333+
334334 $this->getResult()->setContent( $entry, $title->getFullText() );
335335 $result[] = $entry;
336336 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r69753* (bug 24485) Make iwbacklinks a generator, display iwprefix and iwtitle opti...reedy21:03, 22 July 2010
r69755LIMIT_SML2, LIMIT_BIG2 are in ApiBase, not ApiMainreedy21:52, 22 July 2010

Status & tagging log