r42993 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42992‎ | r42993 | r42994 >
Date:12:53, 1 November 2008
Author:minuteelectron
Status:old
Tags:
Comment:
* Use $user parameter to doEdit() rather than messing about with $wgUser.
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/42666
Modified paths:
  • /trunk/extensions/Babel/BabelAutoCreate.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Babel/BabelAutoCreate.class.php
@@ -8,19 +8,15 @@
99 return !( $user->getName() === wfMsgForContent( 'babel-autocreate-user' ) );
1010 }
1111 public static function create( $category, $language, $level = null ) {
12 - global $wgUser;
1312 $title = Title::newFromText( $category, NS_CATEGORY );
1413 if( $title === null || $title->exists() ) return;
15 - $olduser = $wgUser;
16 - $wgUser = self::user();
1714 if( $level === null ) {
1815 $text = wfMsgForContent( 'babel-autocreate-text-main', $language );
1916 } else {
2017 $text = wfMsgForContent( 'babel-autocreate-text-levels', $language, $level );
2118 }
2219 $article = new Article( $title );
23 - $article->doEdit( $text, wfMsgForContent( 'babel-autocreate-reason' ), EDIT_SUPPRESS_RC );
24 - $wgUser = $olduser;
 20+ $article->doEdit( $text, wfMsgForContent( 'babel-autocreate-reason' ), EDIT_SUPPRESS_RC, false, self::user() );
2521 }
2622 public static function user() {
2723 if( !self::$user ) {

Status & tagging log