r69898 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69897‎ | r69898 | r69899 >
Date:19:45, 25 July 2010
Author:platonides
Status:resolved (Comments)
Tags:
Comment:
Remove double globals.
Modified paths:
  • /trunk/phase3/includes/api/ApiLogin.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryDeletedrevs.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRecentChanges.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRevisions.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryUserContributions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryRecentChanges.php
@@ -108,6 +108,7 @@
109109 * Generates and outputs the result of this query based upon the provided parameters.
110110 */
111111 public function execute() {
 112+ global $wgUser;
112113 /* Get the parameters of the request. */
113114 $params = $this->extractRequestParams();
114115
@@ -141,7 +142,6 @@
142143 }
143144
144145 // Check permissions
145 - global $wgUser;
146146 if ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ) {
147147 if ( !$wgUser->useRCPatrol() && !$wgUser->useNPPatrol() ) {
148148 $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' );
@@ -197,7 +197,6 @@
198198 /* Set up internal members based upon params. */
199199 $this->initProperties( $prop );
200200
201 - global $wgUser;
202201 if ( $this->fld_patrolled && !$wgUser->useRCPatrol() && !$wgUser->useNPPatrol() )
203202 {
204203 $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' );
Index: trunk/phase3/includes/api/ApiQueryDeletedrevs.php
@@ -208,7 +208,6 @@
209209 $title = Title::makeTitle( $row->ar_namespace, $row->ar_title );
210210
211211 if ( $fld_parsedcomment ) {
212 - global $wgUser;
213212 $rev['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->ar_comment, $title );
214213 }
215214 if ( $fld_minor && $row->ar_minor_edit == 1 ) {
Index: trunk/phase3/includes/api/ApiLogin.php
@@ -89,7 +89,6 @@
9090 break;
9191
9292 case LoginForm::NEED_TOKEN:
93 - global $wgCookiePrefix;
9493 $result['result'] = 'NeedToken';
9594 $result['token'] = $loginForm->getLoginToken();
9695 $result['cookieprefix'] = $wgCookiePrefix;
Index: trunk/phase3/includes/api/ApiQueryRevisions.php
@@ -422,14 +422,13 @@
423423 }
424424
425425 $text = null;
 426+ global $wgParser;
426427 if ( $this->fld_content || !is_null( $this->difftotext ) ) {
427428 $text = $revision->getText();
428429 // Expand templates after getting section content because
429430 // template-added sections don't count and Parser::preprocess()
430431 // will have less input
431432 if ( $this->section !== false ) {
432 - global $wgParser;
433 -
434433 $text = $wgParser->getSection( $text, $this->section, false );
435434 if ( $text === false ) {
436435 $this->dieUsage( "There is no section {$this->section} in r" . $revision->getId(), 'nosuchsection' );
@@ -438,7 +437,6 @@
439438 }
440439 if ( $this->fld_content && !$revision->isDeleted( Revision::DELETED_TEXT ) ) {
441440 if ( $this->generateXML ) {
442 - global $wgParser;
443441 $wgParser->startExternalParse( $title, new ParserOptions(), OT_PREPROCESS );
444442 $dom = $wgParser->preprocessToDom( $text );
445443 if ( is_callable( array( $dom, 'saveXML' ) ) ) {
@@ -450,7 +448,6 @@
451449
452450 }
453451 if ( $this->expandTemplates ) {
454 - global $wgParser;
455452 $text = $wgParser->preprocess( $text, $title, new ParserOptions() );
456453 }
457454 ApiResult::setContent( $vals, $text );
Index: trunk/phase3/includes/api/ApiQueryUserContributions.php
@@ -213,7 +213,6 @@
214214 if ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ||
215215 $this->fld_patrolled )
216216 {
217 - global $wgUser;
218217 if ( !$wgUser->useRCPatrol() && !$wgUser->useNPPatrol() ) {
219218 $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' );
220219 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r70407Follow-up r69898: fix Undefined variable: wgCookiePrefix in /ApiLogin.php on ...siebrand20:05, 3 August 2010

Comments

#Comment by Reedy (talk | contribs)   20:08, 3 August 2010

Per r70407, I'm guessing your script logs dupes in switch cases as duplicates incorrectly...

#Comment by Platonides (talk | contribs)   14:29, 12 August 2010

Fixed in r70958.

Status & tagging log