r108840 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108839‎ | r108840 | r108841 >
Date:20:21, 13 January 2012
Author:ialex
Status:ok
Tags:
Comment:
* Use local context instead of global variables where possible
* Call Linker methods statically
* Bump version requirement to 1.18 for the above
Modified paths:
  • /trunk/extensions/Configure/CHANGELOG (modified) (history)
  • /trunk/extensions/Configure/Configure.diff.php (modified) (history)
  • /trunk/extensions/Configure/Configure.obj.php (modified) (history)
  • /trunk/extensions/Configure/Configure.php (modified) (history)
  • /trunk/extensions/Configure/handler/Handler.php (modified) (history)
  • /trunk/extensions/Configure/handler/HandlerDb.php (modified) (history)
  • /trunk/extensions/Configure/handler/HandlerFiles.php (modified) (history)
  • /trunk/extensions/Configure/scripts/manage.php (modified) (history)
  • /trunk/extensions/Configure/scripts/migrateToDB.php (modified) (history)
  • /trunk/extensions/Configure/settings/WebExtension.php (modified) (history)
  • /trunk/extensions/Configure/specials/ConfigurationPage.php (modified) (history)
  • /trunk/extensions/Configure/specials/SpecialConfigure.php (modified) (history)
  • /trunk/extensions/Configure/specials/SpecialExtensions.php (modified) (history)
  • /trunk/extensions/Configure/specials/SpecialViewConfig.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Configure/Configure.obj.php
@@ -291,10 +291,12 @@
292292 /**
293293 * Save a new configuration
294294 * @param $settings array of settings
 295+ * @param $user User doing the modification
295296 * @param $wiki String: wiki name or false to use the current one
 297+ * @param $reason String
296298 * @return bool true on success
297299 */
298 - public function saveNewSettings( $settings, $wiki = false, $reason = '' ) {
 300+ public function saveNewSettings( $settings, User $user, $wiki = false, $reason = '' ) {
299301 if ( !is_array( $settings ) )
300302 # hmmm
301303 return false;
@@ -308,7 +310,7 @@
309311 $this->mConf[$wiki] = $settings;
310312 }
311313
312 - return $this->getHandler()->saveNewSettings( $this->mConf, $wiki, false, $reason );
 314+ return $this->getHandler()->saveNewSettings( $this->mConf, $user, $wiki, false, $reason );
313315 }
314316
315317 /**
Index: trunk/extensions/Configure/CHANGELOG
@@ -1,6 +1,12 @@
22 This file lists changes on this extension. Localisation updates are done
33 through translatewiki.net and are not listed here.
44
 5+0.17.0 - 13 January 2012
 6+ Rewrote the extension to use local context instead of global variables where
 7+ possible.
 8+ THIS VERSION NOW REQUIRES MediaWiki 1.18 TO WORK.
 9+
 10+
511 0.16.3 - 3 March 2011
612 Updated the extension to work with the current development version.
713
Index: trunk/extensions/Configure/scripts/migrateToDB.php
@@ -76,11 +76,12 @@
7777
7878 protected function migrateVersion( $version ){
7979 $now = $this->mFilesHandler->getOldSettings( $version );
 80+ $user = User::newFromName( 'Maintenance script' );
8081 $this->output( "doing $version...\n" );
8182 foreach( $now as $wiki => $settings ){
8283 if( !isset( $this->mPreviousVersion[$wiki] ) || $this->mPreviousVersion[$wiki] != $settings ){
8384 $this->output( " $wiki..." );
84 - $this->mDBHandler->saveNewSettings( $now, $wiki, $version );
 85+ $this->mDBHandler->saveNewSettings( $now, $user, $wiki, $version );
8586 $this->output( "ok\n" );
8687 }
8788 }
Index: trunk/extensions/Configure/scripts/manage.php
@@ -92,7 +92,8 @@
9393 $this->error( "revert: The version given ($version) is invalid\n" );
9494 return;
9595 }
96 - $wgConf->saveNewSettings( $arr, null, "Reverting to verion $version" );
 96+ $user = User::newFromName( 'Maintenance script' );
 97+ $wgConf->saveNewSettings( $arr, $user, null, "Reverting to verion $version" );
9798 }
9899 }
99100
Index: trunk/extensions/Configure/settings/WebExtension.php
@@ -180,30 +180,35 @@
181181 * @return String
182182 */
183183 public static function prettifyForDisplay( $val ) {
184 - if ( is_bool( $val ) )
 184+ if ( is_bool( $val ) ) {
185185 return wfBoolToStr( $val );
186 - return $val;
 186+ } else {
 187+ return $val;
 188+ }
187189 }
188190
189191 /**
190192 * Generate html to configure this extension
191193 *
 194+ * @param $context
192195 * @return String: XHTML
193196 */
194 - public function getHtml() {
195 - if ( !$this->isUsable() )
 197+ public function getHtml( $context ) {
 198+ if ( !$this->isUsable() ) {
196199 return '';
 200+ }
 201+
197202 $ret = '<fieldset><legend>' . htmlspecialchars( $this->mName ) . '</legend>';
198203 if ( count( $errors = $this->checkSettingsDependencies() ) ) {
199204 $ret .= "<span class=\"errorbox\">";
200 - $ret .= wfMessage( 'configure-ext-settings-dep-errors', count( $errors ) )->parse();
 205+ $ret .= $context->msg( 'configure-ext-settings-dep-errors', count( $errors ) )->parse();
201206 $ret .= "<ul>\n";
202207 foreach ( $errors as $err ) {
203208 list( $setting, $req, $cur ) = $err;
204209 $setting = '$'.$setting;
205210 $req = self::prettifyForDisplay( $req );
206211 $cur = self::prettifyForDisplay( $cur );
207 - $ret .= '<li>' . wfMessage( 'configure-ext-settings-dep-error', $setting, $req, $cur )->parse() . "</li>\n";
 212+ $ret .= '<li>' . $context->msg( 'configure-ext-settings-dep-error', $setting, $req, $cur )->parse() . "</li>\n";
208213 }
209214 return $ret . "</ul>\n</span>\n</fieldset>";
210215 }
@@ -211,11 +216,11 @@
212217 $warnings = array();
213218
214219 if ( $this->mDbChange ) {
215 - $warnings[] = wfMessage( 'configure-ext-schemachange' )->parse();
 220+ $warnings[] = $context->msg( 'configure-ext-schemachange' )->parse();
216221 }
217222 if ( count( $this->mExtensionsDependencies ) ) {
218 - global $wgLang;
219 - $warnings[] = wfMessage( 'configure-ext-ext-dependencies', $wgLang->listToText( $this->mExtensionsDependencies ), count( $this->mExtensionsDependencies ) )->parse();
 223+ $warnings[] = $context->msg( 'configure-ext-ext-dependencies',
 224+ $context->getLang()->listToText( $this->mExtensionsDependencies ), count( $this->mExtensionsDependencies ) )->parse();
220225 }
221226
222227 if ( count( $warnings ) ) {
@@ -230,20 +235,20 @@
231236 $ret .= "</span><br clear=\"left\" />\n";
232237 }
233238
234 - $use = wfMessage( 'configure-ext-use' )->parse();
 239+ $use = $context->msg( 'configure-ext-use' )->parse();
235240 $ret .= "<h2>{$use}</h2>\n";
236241 $ret .= "<table class=\"configure-table configure-table-ext\"><tr><td>\n";
237242 $checkName = $this->getCheckName();
238 - $ret .= Xml::checkLabel( wfMessage( 'configure-ext-use-extension' )->text(), $checkName, $checkName, $this->isActivated() );
 243+ $ret .= Xml::checkLabel( $context->msg( 'configure-ext-use-extension' )->text(), $checkName, $checkName, $this->isActivated() );
239244 $ret .= "</td></tr>\n";
240245 if ( !empty( $this->mDoc ) ) {
241246 $ret .= "<tr><td>\n";
242 - $ret .= '<p>' . Xml::element( 'a', array( 'href' => $this->mDoc ), wfMessage( 'configure-ext-doc' )->text() ) . "</p>\n";
 247+ $ret .= '<p>' . Xml::element( 'a', array( 'href' => $this->mDoc ), $context->msg( 'configure-ext-doc' )->text() ) . "</p>\n";
243248 $ret .= "</td></tr>";
244249 }
245250 $ret .= "</table>\n";
246251 if ( count( $this->mSettings ) ) {
247 - $settings = wfMessage( 'configure-ext-settings' )->parse();
 252+ $settings = $context->msg( 'configure-ext-settings' )->parse();
248253 $ret .= "<h2>{$settings}</h2>\n";
249254 $ret .= "<table class=\"configure-table\">\n";
250255 foreach ( $this->mSettings as $name => $type ) {
Index: trunk/extensions/Configure/specials/SpecialExtensions.php
@@ -23,8 +23,8 @@
2424 * Submit a posted form
2525 */
2626 public function doSubmit() {
27 - global $wgConf, $wgOut, $wgRequest;
28 - $reason = $wgRequest->getText( 'wpReason' );
 27+ global $wgConf;
 28+ $reason = $this->getRequest()->getText( 'wpReason' );
2929 $current = $wgConf->getCurrent( $this->mWiki );
3030 $settings = $this->importFromRequest();
3131 $new = $settings + $current;
@@ -36,25 +36,24 @@
3737 }
3838 $new = $this->removeDefaults( $new );
3939 $new['__includes'] = $this->getRequiredFiles();
40 - $ok = $wgConf->saveNewSettings( $new, $this->mWiki, $reason );
 40+ $ok = $wgConf->saveNewSettings( $new, $this->getUser(), $this->mWiki, $reason );
4141
4242 $result = $ok ? 'success' : 'failure';
4343
44 - $url = $this->getTitle()->getLocalURL( "result=$result" );
45 - $wgOut->redirect( $url );
 44+ $this->getOutput()->redirect( $this->getTitle()->getFullURL( "result=$result" ) );
4645 }
4746
4847 /**
4948 * Show the diff between the current version and the posted version
5049 */
5150 protected function showDiff() {
52 - global $wgConf, $wgOut;
 51+ global $wgConf;
5352 $wiki = $this->mWiki;
5453 $old = array( $wiki => $wgConf->getCurrent( $wiki ) );
5554 $new = array( $wiki => $this->conf );
56 - $diff = new ExtPreviewConfigurationDiff( $old, $new, array( $wiki ) );
 55+ $diff = new ExtPreviewConfigurationDiff( $this->getContext(), $old, $new, array( $wiki ) );
5756 $diff->setViewCallback( array( $this, 'userCanRead' ) );
58 - $wgOut->addHTML( $diff->getHtml() );
 57+ $this->getOut()->addHTML( $diff->getHtml() );
5958 }
6059
6160 /**
@@ -63,18 +62,18 @@
6463 * @return Boolean: success
6564 */
6665 protected function checkExtensionsDependencies() {
67 - global $wgRequest, $wgOut;
68 -
 66+ $request = $this->getRequest();
6967 foreach ( $this->mConfSettings->getAllExtensionsObjects() as $ext ) {
70 - if ( !count( $ext->getExtensionsDependencies() ) || !$wgRequest->getCheck( $ext->getCheckName() ) )
 68+ if ( !count( $ext->getExtensionsDependencies() ) || !$request->getCheck( $ext->getCheckName() ) )
7169 continue;
7270
7371 foreach ( $ext->getExtensionsDependencies() as $depName ) {
7472 $dep = $this->mConfSettings->getExtension( $depName );
7573 if ( !is_object( $dep ) )
7674 throw new MWException( "Unable to find \"{$depName}\" dependency for \"{$ext->getName()}\" extension" );
77 - if ( !$wgRequest->getCheck( $dep->getCheckName() ) ) {
78 - $wgOut->wrapWikiMsg( '<span class="errorbox">$1</span>', array( 'configure-ext-ext-dependency-err', $ext->getName(), $depName ) );
 75+ if ( !$request->getCheck( $dep->getCheckName() ) ) {
 76+ $this->getOutput()->wrapWikiMsg( '<span class="errorbox">$1</span>',
 77+ array( 'configure-ext-ext-dependency-err', $ext->getName(), $depName ) );
7978 return false;
8079 }
8180 }
@@ -87,7 +86,7 @@
8887 * @return array
8988 */
9089 protected function getRequiredFiles() {
91 - global $wgRequest, $wgConfigureOnlyUseVarForExt;
 90+ global $wgConfigureOnlyUseVarForExt;
9291 if ( $wgConfigureOnlyUseVarForExt )
9392 return array();
9493 $arr = array();
@@ -96,7 +95,7 @@
9796 continue; // must exist
9897 if ( $ext->useVariable() )
9998 continue;
100 - if ( $wgRequest->getCheck( $ext->getCheckName() ) )
 99+ if ( $this->getRequest()->getCheck( $ext->getCheckName() ) )
101100 $arr[] = $ext->getFile();
102101 }
103102 return $arr;
@@ -122,8 +121,6 @@
123122 * @return xhtml
124123 */
125124 protected function buildAllSettings() {
126 - global $wgRequest;
127 -
128125 $ret = '';
129126 $globalDone = false;
130127 foreach ( $this->mConfSettings->getAllExtensionsObjects() as $wikiExt ) {
@@ -133,7 +130,7 @@
134131 $wikiExt->setPageObj( $this );
135132
136133 if ( $this->mIsPreview )
137 - $wikiExt->setTempActivated( $wgRequest->getCheck( $ext->getCheckName() ) );
 134+ $wikiExt->setTempActivated( $this->getRequest()->getCheck( $ext->getCheckName() ) );
138135
139136 $settings = $wikiExt->getSettings();
140137 foreach ( $settings as $setting => $type ) {
@@ -152,7 +149,7 @@
153150 if ( $globalDone )
154151 $GLOBALS['wgHooks'] = $oldHooks;
155152
156 - $ret .= $wikiExt->getHtml();
 153+ $ret .= $wikiExt->getHtml( $this->getContext() );
157154 }
158155
159156 return $ret;
Index: trunk/extensions/Configure/specials/SpecialViewConfig.php
@@ -22,13 +22,14 @@
2323 }
2424
2525 protected function showOldVersionMessage( $version ) {
26 - global $wgConf, $wgOut, $wgRequest;
 26+ global $wgConf;
2727
2828 $this->version = $version;
2929
30 - if ( $diff = $wgRequest->getVal( 'diff' ) ) {
 30+ $diff = $this->getRequest()->getVal( 'diff' );
 31+ if ( $diff ) {
3132 if ( !$wgConf->versionExists( $diff ) ) {
32 - $wgOut->wrapWikiMsg( '<div class="errorbox">$1</div>',
 33+ $this->getOutput()->wrapWikiMsg( '<div class="errorbox">$1</div>',
3334 array( 'configure-old-not-available', $diff ) );
3435 return false;
3536 }
@@ -46,24 +47,21 @@
4748 * Show diff
4849 */
4950 protected function showDiff() {
50 - global $wgOut;
5151 $wikis = $this->isUserAllowedAll() ? true : array( $this->mWiki );
52 - $diffEngine = new HistoryConfigurationDiff( $this->diff, $this->version, $wikis );
 52+ $diffEngine = new HistoryConfigurationDiff( $this->getContext(), $this->diff, $this->version, $wikis );
5353 $diffEngine->setViewCallback( array( $this, 'userCanRead' ) );
54 - $wgOut->addHTML( $diffEngine->getHTML() );
 54+ $this->getOutput()->addHTML( $diffEngine->getHTML() );
5555 }
5656
5757 /**
5858 * Show the main form
5959 */
6060 protected function showForm() {
61 - global $wgOut, $wgRequest;
62 -
6361 if ( !empty( $this->conf ) || isset( $this->diff ) ) {
6462 if ( isset( $this->diff ) ) {
6563 $this->showDiff();
6664 } else {
67 - $wgOut->addHTML(
 65+ $this->getOutput()->addHTML(
6866 $this->buildSearchForm() . "\n" .
6967 Xml::openElement( 'div', array( 'id' => 'configure-form' ) ) . "\n" .
7068 Xml::openElement( 'div', array( 'id' => 'configure' ) ) . "\n" .
@@ -75,7 +73,7 @@
7674 );
7775 }
7876 } else {
79 - $wgOut->addHTML( $this->buildOldVersionSelect() );
 77+ $this->getOutput()->addHTML( $this->buildOldVersionSelect() );
8078 }
8179 $this->injectScriptsAndStyles();
8280 }
@@ -84,27 +82,27 @@
8583 * Build links to old version of the configuration
8684 */
8785 protected function buildOldVersionSelect() {
88 - global $wgConf, $wgUser, $wgRequest, $wgScript;
 86+ global $wgConf, $wgScript;
8987
9088 $self = $this->getTitle();
9189 $pager = $wgConf->getPager();
9290 $pager->setFormatCallback( array( $this, 'formatVersionRow' ) );
9391
94 - $wiki = $this->isUserAllowedInterwiki() && $wgRequest->getVal( 'view', 'all' ) == 'all' ? false : $this->mWiki;
 92+ $wiki = $this->isUserAllowedInterwiki() && $this->getRequest()->getVal( 'view', 'all' ) == 'all' ? false : $this->mWiki;
9593 $pager->setWiki( $wiki );
9694
9795 $showDiff = $pager->getNumRows() > 1;
9896
 97+ $user = $this->getUser();
9998 $formatConf = array(
10099 'showDiff' => $showDiff,
101 - 'allowedConfig' => $wgUser->isAllowed( 'configure' ),
102 - 'allowedExtensions' => $wgUser->isAllowed( 'extensions' ),
 100+ 'allowedConfig' => $user->isAllowed( 'configure' ),
 101+ 'allowedExtensions' => $user->isAllowed( 'extensions' ),
103102 'allowedAll' => $this->isUserAllowedInterwiki(),
104 - 'allowedConfigAll' => $wgUser->isAllowed( 'configure-interwiki' ),
105 - 'allowedExtensionsAll' => $wgUser->isAllowed( 'extensions-interwiki' ),
 103+ 'allowedConfigAll' => $user->isAllowed( 'configure-interwiki' ),
 104+ 'allowedExtensionsAll' => $user->isAllowed( 'extensions-interwiki' ),
106105 'self' => $self,
107 - 'skin' => $wgUser->getSkin(),
108 - 'editMsg' => wfMessage( 'edit' )->text() . wfMessage( 'colon-separator' )->text(),
 106+ 'editMsg' => $this->msg( 'edit' )->text() . $this->msg( 'colon-separator' )->text(),
109107 );
110108
111109 if ( $formatConf['allowedConfig'] )
@@ -115,7 +113,7 @@
116114
117115 $this->formatConf = $formatConf;
118116
119 - $text = wfMessage( 'configure-old-versions' )->parseAsBlock();
 117+ $text = $this->msg( 'configure-old-versions' )->parseAsBlock();
120118 if( $this->isUserAllowedInterwiki() )
121119 $text .= $this->getWikiSelectForm();
122120 $text .= $pager->getNavigationBar();
@@ -133,28 +131,28 @@
134132 }
135133
136134 public function formatVersionRow( $arr ) {
137 - global $wgLang;
138 -
139135 $ts = $arr['timestamp'];
140136 $wikis = $arr['wikis'];
141137 $c = $arr['count'];
142138 $hasSelf = in_array( $this->mWiki, $wikis );
143139
144140 extract( $this->formatConf );
145 - $datime = $wgLang->timeanddate( $ts );
146 - $date = $wgLang->date( $ts );
147 - $time = $wgLang->time( $ts );
148141
 142+ $lang = $this->getLang();
 143+ $datime = $lang->timeanddate( $ts );
 144+ $date = $lang->date( $ts );
 145+ $time = $lang->time( $ts );
 146+
149147 ## Make user link...
150148 $userLink = '';
151149 if (!$arr['user_wiki'] && !$arr['user_name'] ) {
152150 $userLink = ''; # Nothing...
153151 $username = '';
154152 } elseif ( $arr['user_wiki'] == wfWikiId() ) {
155 - $userLink = $skin->link( Title::makeTitle( NS_USER, $arr['user_name'] ), htmlspecialchars( $arr['user_name'] ) );
 153+ $userLink = Linker::link( Title::makeTitle( NS_USER, $arr['user_name'] ), htmlspecialchars( $arr['user_name'] ) );
156154 $username = $arr['user_name'];
157155 } elseif ( $wiki = WikiMap::getWiki( $arr['user_wiki'] ) ) {
158 - $userLink = $skin->makeExternalLink( $wiki->getUrl( 'User:'.$arr['user_name'] ), htmlspecialchars( $arr['user_name'].'@'.$arr['user_wiki'] ) );
 156+ $userLink = Linker::makeExternalLink( $wiki->getUrl( 'User:'.$arr['user_name'] ), htmlspecialchars( $arr['user_name'].'@'.$arr['user_wiki'] ) );
159157 $username = '';
160158 } else {
161159 ## Last-ditch
@@ -165,16 +163,16 @@
166164 $actions = array();
167165 $view = '';
168166 if ( $hasSelf )
169 - $view .= $skin->linkKnown( $self, wfMessage( 'configure-view' )->escaped(), array(), array( 'version' => $ts ) );
 167+ $view .= Linker::linkKnown( $self, $this->msg( 'configure-view' )->escaped(), array(), array( 'version' => $ts ) );
170168 elseif( $allowedAll )
171 - $view .= wfMessage( 'configure-view' )->escaped();
 169+ $view .= $this->msg( 'configure-view' )->escaped();
172170
173171 if ( $allowedAll ) {
174172 $viewWikis = array();
175173 foreach ( $wikis as $wiki ) {
176 - $viewWikis[] = $skin->linkKnown( $self, htmlspecialchars( $wiki ), array(), array( 'version' => $ts, 'wiki' => $wiki ) );
 174+ $viewWikis[] = Linker::linkKnown( $self, htmlspecialchars( $wiki ), array(), array( 'version' => $ts, 'wiki' => $wiki ) );
177175 }
178 - $view .= ' (' . $wgLang->commaList( $viewWikis ) . ')';
 176+ $view .= ' (' . $lang->commaList( $viewWikis ) . ')';
179177 }
180178
181179 if( $view )
@@ -183,18 +181,18 @@
184182 $editDone = false;
185183 if ( $allowedConfig ) {
186184 if ( $hasSelf )
187 - $editCore = $editMsg . $skin->linkKnown( $configTitle, wfMessage( 'configure-edit-core' )->escaped(), array(), array( 'version' => $ts ) );
 185+ $editCore = $editMsg . Linker::linkKnown( $configTitle, $this->msg( 'configure-edit-core' )->escaped(), array(), array( 'version' => $ts ) );
188186 elseif( $allowedConfigAll )
189 - $editCore = $editMsg . wfMessage( 'configure-edit-core' )->escaped();
 187+ $editCore = $editMsg . $this->msg( 'configure-edit-core' )->escaped();
190188 else
191189 $editCore = $editMsg;
192190
193191 if ( $allowedConfigAll ) {
194192 $viewWikis = array();
195193 foreach ( $wikis as $wiki ) {
196 - $viewWikis[] = $skin->linkKnown( $configTitle, htmlspecialchars( $wiki ), array(), array( 'version' => $ts, 'wiki' => $wiki ) );
 194+ $viewWikis[] = Linker::linkKnown( $configTitle, htmlspecialchars( $wiki ), array(), array( 'version' => $ts, 'wiki' => $wiki ) );
197195 }
198 - $editCore .= ' (' . $wgLang->commaList( $viewWikis ) . ')';
 196+ $editCore .= ' (' . $lang->commaList( $viewWikis ) . ')';
199197 }
200198 $actions[] = $editCore;
201199 }
@@ -203,16 +201,16 @@
204202 if ( !$allowedConfig )
205203 $editExt .= $editMsg;
206204 if ( $hasSelf )
207 - $editExt .= $skin->linkKnown( $extTitle, wfMessage( 'configure-edit-ext' )->escaped(), array(), array( 'version' => $ts ) );
 205+ $editExt .= Linker::linkKnown( $extTitle, $this->msg( 'configure-edit-ext' )->escaped(), array(), array( 'version' => $ts ) );
208206 elseif( $allowedExtensionsAll )
209 - $editExt .= wfMessage( 'configure-edit-ext' )->escaped();
 207+ $editExt .= $this->msg( 'configure-edit-ext' )->escaped();
210208
211209 if ( $allowedExtensionsAll ) {
212210 $viewWikis = array();
213211 foreach ( $wikis as $wiki ) {
214 - $viewWikis[] = $skin->linkKnown( $extTitle, htmlspecialchars( $wiki ), array(), array( 'version' => $ts, 'wiki' => $wiki ) );
 212+ $viewWikis[] = Linker::linkKnown( $extTitle, htmlspecialchars( $wiki ), array(), array( 'version' => $ts, 'wiki' => $wiki ) );
215213 }
216 - $editExt .= ' (' . $wgLang->commaList( $viewWikis ) . ')';
 214+ $editExt .= ' (' . $lang->commaList( $viewWikis ) . ')';
217215 }
218216 $actions[] = $editExt;
219217 }
@@ -227,17 +225,17 @@
228226 array( 'type' => 'radio', 'name' => 'version', 'value' => $ts ),
229227 $versionCheck ) );
230228
231 - $actions[] = $skin->link( $this->getTitle(), wfMessage( 'configure-viewconfig-default-diff' )->escaped(),
 229+ $actions[] = Linker::link( $this->getTitle(), $this->msg( 'configure-viewconfig-default-diff' )->escaped(),
232230 array(), array( 'version' => $ts, 'diff' => 'default' ) );
233231 } else {
234232 $buttons = '';
235233 }
236234
237 - $comment = $arr['reason'] ? $skin->commentBlock( $arr['reason'] ) : '';
 235+ $comment = $arr['reason'] ? Linker::commentBlock( $arr['reason'] ) : '';
238236
239 - $action = $wgLang->commaList( $actions );
 237+ $action = $lang->commaList( $actions );
240238
241 - $msg = wfMessage( 'configure-viewconfig-line' )->rawParams( $buttons )->params(
 239+ $msg = $this->msg( 'configure-viewconfig-line' )->rawParams( $buttons )->params(
242240 $datime )->rawParams( $userLink, $action, $comment )->params( $date, $time, $username )->parse();
243241 return Xml::tags( 'li', null, $msg )."\n";
244242 }
@@ -246,17 +244,17 @@
247245 * Get a form to select the wiki to configure
248246 */
249247 protected function getWikiSelectForm() {
250 - global $wgConfigureWikis, $wgScript, $wgRequest;
 248+ global $wgConfigureWikis, $wgScript;
251249 if ( $wgConfigureWikis === false || !$this->isUserAllowedInterwiki() )
252250 return '';
253 - $form = '<fieldset><legend>' . wfMessage( 'configure-select-wiki' )->escaped() . '</legend>';
254 - $form .= wfMessage( 'configure-select-wiki-view-desc' )->parseAsBlock();
 251+ $form = '<fieldset><legend>' . $this->msg( 'configure-select-wiki' )->escaped() . '</legend>';
 252+ $form .= $this->msg( 'configure-select-wiki-view-desc' )->parseAsBlock();
255253 $form .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
256254 $form .= Html::Hidden( 'title', $this->getTitle()->getPrefixedDBkey() );
257 - $all = ( $wgRequest->getVal( 'view', 'all' ) == 'all' );
258 - $form .= Xml::radioLabel( wfMessage( 'configure-select-wiki-view-all' )->text(), 'view', 'all', 'wiki-all', $all );
 255+ $all = ( $this->getRequest()->getVal( 'view', 'all' ) == 'all' );
 256+ $form .= Xml::radioLabel( $this->msg( 'configure-select-wiki-view-all' )->text(), 'view', 'all', 'wiki-all', $all );
259257 $form .= "<br />\n";
260 - $form .= Xml::radioLabel( wfMessage( 'configure-select-wiki-view-specific' )->text(), 'view', 'specific', 'wiki-specific', !$all ) . ' ';
 258+ $form .= Xml::radioLabel( $this->msg( 'configure-select-wiki-view-specific' )->text(), 'view', 'specific', 'wiki-specific', !$all ) . ' ';
261259
262260 if ( is_array( $wgConfigureWikis ) ) {
263261 $selector = new XmlSelect( 'wiki', 'wiki', $this->mWiki );
@@ -268,7 +266,7 @@
269267 $form .= Xml::input( 'wiki', false, $this->mWiki )."<br />";
270268 }
271269
272 - $form .= Xml::submitButton( wfMessage( 'configure-select-wiki-submit' )->text() );
 270+ $form .= Xml::submitButton( $this->msg( 'configure-select-wiki-submit' )->text() );
273271 $form .= '</form></fieldset>';
274272 return $form;
275273 }
@@ -277,11 +275,11 @@
278276 * Taken from PageHistory.php
279277 */
280278 protected function getButton() {
281 - return Xml::submitButton( wfMessage( 'compareselectedversions' )->text(),
 279+ return Xml::submitButton( $this->msg( 'compareselectedversions' )->text(),
282280 array(
283281 'class' => 'historysubmit',
284 - 'accesskey' => wfMessage( 'accesskey-compareselectedversions' )->text(),
285 - 'title' => wfMessage( 'tooltip-compareselectedversions' )->text(),
 282+ 'accesskey' => $this->msg( 'accesskey-compareselectedversions' )->text(),
 283+ 'title' => $this->msg( 'tooltip-compareselectedversions' )->text(),
286284 )
287285 );
288286 }
Index: trunk/extensions/Configure/specials/SpecialConfigure.php
@@ -17,9 +17,9 @@
1818 }
1919
2020 protected function doSubmit() {
21 - global $wgConf, $wgOut, $wgConfigureUpdateCacheEpoch, $wgUser, $wgRequest;
 21+ global $wgConf, $wgConfigureUpdateCacheEpoch;
2222
23 - $reason = $wgRequest->getText( 'wpReason' );
 23+ $reason = $this->getRequest()->getText( 'wpReason' );
2424 $settings = $this->importFromRequest();
2525
2626 ## Add extensions settings, so we don't lose them..
@@ -35,11 +35,11 @@
3636 $settings = $this->removeDefaults( $settings );
3737 if ( $wgConfigureUpdateCacheEpoch )
3838 $settings['wgCacheEpoch'] = max( $settings['wgCacheEpoch'], wfTimestampNow() );
39 - $ok = $wgConf->saveNewSettings( $settings, $this->mWiki, $reason );
 39+ $ok = $wgConf->saveNewSettings( $settings, $this->getUser(), $this->mWiki, $reason );
4040 $result = $ok ? 'success' : 'failure';
4141
4242 $url = $this->getTitle()->getLocalURL( "result=$result" );
43 - $wgOut->redirect( $url );
 43+ $this->getOutput()->redirect( $url );
4444 }
4545
4646 protected function getSettingMask() {
@@ -62,13 +62,13 @@
6363 * Show the diff between the current version and the posted version
6464 */
6565 protected function showDiff() {
66 - global $wgConf, $wgOut;
 66+ global $wgConf;
6767 $wiki = $this->mWiki;
6868 $old = array( $wiki => $this->removeDefaults( $wgConf->getCurrent( $wiki ) ) );
6969 $new = array( $wiki => $this->removeDefaults( $this->conf ) );
70 - $diff = new CorePreviewConfigurationDiff( $old, $new, array( $wiki ) );
 70+ $diff = new CorePreviewConfigurationDiff( $this->getContext(), $old, $new, array( $wiki ) );
7171 $diff->setViewCallback( array( $this, 'isSettingEditable' ) );
72 - $wgOut->addHTML( $diff->getHtml() );
 72+ $this->getOutput()->addHTML( $diff->getHtml() );
7373 }
7474
7575 /**
Index: trunk/extensions/Configure/specials/ConfigurationPage.php
@@ -1,5 +1,4 @@
22 <?php
3 -if ( !defined( 'MEDIAWIKI' ) ) die();
43
54 /**
65 * Special page allows authorised users to configure the wiki
@@ -29,11 +28,12 @@
3029 * @param $par Mixed: parameter passed to the page or null
3130 */
3231 public function execute( $par ) {
33 - global $wgUser, $wgRequest, $wgOut, $wgConf, $wgConfigureWikis, $wgLang;
 32+ global $wgConf, $wgConfigureWikis;
3433
3534 $this->setHeaders();
3635
37 - if ( !$this->userCanExecute( $wgUser ) ) {
 36+ $user = $this->getUser();
 37+ if ( !$this->userCanExecute( $user ) ) {
3838 $this->displayRestrictionError();
3939 return;
4040 }
@@ -41,26 +41,27 @@
4242 // Since efConfigureSetup() should be explicitly called, don't go
4343 // further if that function wasn't called
4444 if ( !$wgConf instanceof WebConfiguration ) {
45 - $wgOut->wrapWikiMsg( '<div class="errorbox"><strong>$1</strong></div>', 'configure-no-setup' );
 45+ $this->getOutput()->wrapWikiMsg( '<div class="errorbox"><strong>$1</strong></div>', 'configure-no-setup' );
4646 return;
4747 }
4848
4949 $ret = $wgConf->doChecks();
5050 if ( count( $ret ) ) {
51 - $wgOut->wrapWikiMsg( '<div class="errorbox"><strong>$1</strong></div>', $ret );
 51+ $this->getOutput()->wrapWikiMsg( '<div class="errorbox"><strong>$1</strong></div>', $ret );
5252 return;
5353 }
5454
55 - $wikiParam = ( $this->mCanEdit && $wgRequest->wasPosted() ) ? 'wpWiki' : 'wiki';
56 - if ( $wiki = $wgRequest->getVal( $wikiParam, false ) ) {
 55+ $request = $this->getRequest();
 56+ $wikiParam = ( $this->mCanEdit && $request->wasPosted() ) ? 'wpWiki' : 'wiki';
 57+ if ( $wiki = $request->getVal( $wikiParam, false ) ) {
5758 if ( $wgConf->getWiki() != $wiki ) {
5859 if ( !$this->isUserAllowedInterwiki() || $wgConfigureWikis === false ) {
59 - $wgOut->wrapWikiMsg( '<div class="errorbox"><strong>$1</strong></div>', 'configure-no-transwiki' );
 60+ $this->getOutput()->wrapWikiMsg( '<div class="errorbox"><strong>$1</strong></div>', 'configure-no-transwiki' );
6061 return;
6162 }
6263 if ( is_array( $wgConfigureWikis ) && !in_array( $wiki, $wgConfigureWikis ) ) {
63 - $wgOut->wrapWikiMsg( '<div class="errorbox"><strong>$1</strong></div>',
64 - array( 'configure-transwiki-not-in-range', $wiki, $wgLang->commaList( $wgConfigureWikis ), count( $wgConfigureWikis ) ) );
 64+ $this->getOutput()->wrapWikiMsg( '<div class="errorbox"><strong>$1</strong></div>',
 65+ array( 'configure-transwiki-not-in-range', $wiki, $this->getLang()->commaList( $wgConfigureWikis ), count( $wgConfigureWikis ) ) );
6566 return;
6667 }
6768 }
@@ -74,29 +75,29 @@
7576 if ( !$this->getVersion() )
7677 return;
7778
78 - if ( $this->mCanEdit && $wgRequest->wasPosted() ) {
79 - if ( $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
80 - if ( $wgRequest->getCheck( 'wpSave' ) ) {
 79+ if ( $this->mCanEdit && $request->wasPosted() ) {
 80+ if ( $user->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) {
 81+ if ( $request->getCheck( 'wpSave' ) ) {
8182 $type = 'submit';
8283 } else {
8384 $type = 'diff';
8485 }
8586 } else {
86 - $wgOut->addWikiMsg( 'sessionfailure' );
 87+ $this->getOutput()->addWikiMsg( 'sessionfailure' );
8788 $type = 'diff';
8889 }
8990 } else {
9091 $type = 'initial';
9192 }
9293
93 - if ( $result = $wgRequest->getVal( 'result' ) ) {
 94+ if ( $result = $request->getVal( 'result' ) ) {
9495 $this->showResult( $result );
9596 return;
9697 }
9798
9899 switch( $type ) {
99100 case 'submit':
100 - if( $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) )
 101+ if( $user->matchEditToken( $request->getVal( 'wpEditToken' ) ) )
101102 $this->doSubmit();
102103 else
103104 $this->showForm();
@@ -139,8 +140,7 @@
140141 protected function isUserAllowedAll() {
141142 static $allowed = null;
142143 if ( $allowed === null ) {
143 - global $wgUser;
144 - $allowed = $wgUser->isAllowed( $this->getRestriction() . '-all' );
 144+ $allowed = $this->getUser()->isAllowed( $this->getRestriction() . '-all' );
145145 }
146146 return $allowed;
147147 }
@@ -152,8 +152,7 @@
153153 protected function isUserAllowedInterwiki() {
154154 static $allowed = null;
155155 if ( $allowed === null ) {
156 - global $wgUser;
157 - $allowed = $wgUser->isAllowed( $this->getRestriction() . '-interwiki' );
 156+ $allowed = $this->getUser()->isAllowed( $this->getRestriction() . '-interwiki' );
158157 }
159158 return $allowed;
160159 }
@@ -179,9 +178,8 @@
180179 global $wgConfigureEditRestrictions;
181180 if ( !isset( $wgConfigureEditRestrictions[$setting] ) )
182181 return true;
183 - global $wgUser;
184182 foreach ( $wgConfigureEditRestrictions[$setting] as $right ) {
185 - if ( !$wgUser->isAllowed( $right ) )
 183+ if ( !$this->getUser()->isAllowed( $right ) )
186184 return false;
187185 }
188186 return true;
@@ -199,9 +197,8 @@
200198 global $wgConfigureViewRestrictions;
201199 if ( !isset( $wgConfigureViewRestrictions[$setting] ) )
202200 return true;
203 - global $wgUser;
204201 foreach ( $wgConfigureViewRestrictions[$setting] as $right ) {
205 - if ( !$wgUser->isAllowed( $right ) )
 202+ if ( !$this->getUser()->isAllowed( $right ) )
206203 return false;
207204 }
208205 return true;
@@ -285,16 +282,15 @@
286283 * Show a 'success' page.
287284 */
288285 protected function showResult( $result ) {
289 - global $wgOut, $wgUser;
290286 $ok = $result == 'success';
291287 $msg = $ok ? 'configure-saved' : 'configure-error';
292288 $class = $ok ? 'successbox' : 'errorbox';
293289
294 - $wgOut->wrapWikiMsg( Html::rawElement( 'div', array( 'class' => $class ), '$1' ), $msg );
 290+ $out = $this->getOutput();
 291+ $out->wrapWikiMsg( Html::rawElement( 'div', array( 'class' => $class ), '$1' ), $msg );
295292
296 - $sk = $wgUser->getSkin();
297 - $linkText = wfMessage( 'configure-backlink' )->parse();
298 - $wgOut->addHTML( Html::rawElement( 'p', array( 'style' => 'clear:both;' ), $sk->link( $this->getTitle(), $linkText ) ) );
 293+ $out->addHTML( Html::rawElement( 'p', array( 'style' => 'clear:both;' ),
 294+ Linker::link( $this->getTitle(), $this->msg( 'configure-backlink' )->parse() ) ) );
299295 }
300296
301297 /**
@@ -308,12 +304,11 @@
309305 * Show "you are editing old version" message
310306 */
311307 protected function showOldVersionMessage( $version ) {
312 - global $wgOut, $wgLang;
313 -
314 - $wgOut->addWikiMsg( 'configure-edit-old',
315 - $wgLang->timeanddate( $version ),
316 - $wgLang->date( $version ),
317 - $wgLang->time( $version )
 308+ $lang = $this->getLang();
 309+ $this->getOutput()->addWikiMsg( 'configure-edit-old',
 310+ $lang->timeanddate( $version ),
 311+ $lang->date( $version ),
 312+ $lang->time( $version )
318313 );
319314 }
320315
@@ -321,9 +316,10 @@
322317 * Get the version
323318 */
324319 protected function getVersion() {
325 - global $wgConf, $wgOut, $wgRequest;
 320+ global $wgConf;
326321
327 - if ( $version = $wgRequest->getVal( 'version' ) ) {
 322+ $request = $this->getRequest();
 323+ if ( $version = $request->getVal( 'version' ) ) {
328324 if ( $version == 'default' || $wgConf->versionExists( $version ) ) {
329325 if ( $version == 'default' ) { ## Hacky special case.
330326 $this->conf = $wgConf->getDefaultsForWiki( $this->mWiki );
@@ -331,7 +327,7 @@
332328 $conf = $wgConf->getOldSettings( $version );
333329
334330 if ( !isset( $conf[$this->mWiki] ) ) {
335 - $wgOut->wrapWikiMsg( '<div class="errorbox">$1</div>',
 331+ $this->getOutput()->wrapWikiMsg( '<div class="errorbox">$1</div>',
336332 array( 'configure-old-not-available', $version ) );
337333 return false;
338334 }
@@ -351,7 +347,7 @@
352348 if ( !$this->showOldVersionMessage( $version ) )
353349 return false;
354350 } else {
355 - $wgOut->wrapWikiMsg( '<div class="errorbox">$1</div>',
 351+ $this->getOutput()->wrapWikiMsg( '<div class="errorbox">$1</div>',
356352 array( 'configure-old-not-available', $version ) );
357353 return false;
358354 }
@@ -365,14 +361,14 @@
366362 * Build links to old version of the configuration
367363 */
368364 protected function buildOldVersionSelect() {
369 - global $wgConf, $wgLang, $wgUser;
 365+ global $wgConf;
370366
371367 $count = 0;
372368 $links = array();
373369
374370 $versions = $wgConf->getArchiveVersions( array( 'wiki' => $this->mWiki, 'limit' => 11 ) );
375 - $skin = $wgUser->getSkin();
376371 $title = $this->getTitle();
 372+ $lang = $this->getLang();
377373 $prev = null;
378374
379375 ksort( $versions ); ## Put in ascending order for now.
@@ -380,16 +376,17 @@
381377 foreach ( $versions as $data ) {
382378 $ts = $data['timestamp'];
383379 $count++;
384 - $datetime = wfMessage( 'configure-old-summary-datetime',
385 - $wgLang->timeanddate( $ts ),
386 - $wgLang->date( $ts ),
387 - $wgLang->time( $ts )
 380+ $datetime = $this->msg( 'configure-old-summary-datetime',
 381+ $lang->timeanddate( $ts ),
 382+ $lang->date( $ts ),
 383+ $lang->time( $ts )
388384 )->escaped();
389 - $link = $skin->linkKnown( $title, $datetime, array(), array( 'version' => $ts ) );
 385+ $link = Linker::linkKnown( $title, $datetime, array(), array( 'version' => $ts ) );
390386 $diffLink = '';
391 - if ( $prev )
392 - $diffLink = '(' . $skin->linkKnown( SpecialPage::getTitleFor( 'ViewConfig' ),
393 - wfMessage( 'configure-old-changes' )->escaped(), array(), array( 'version' => $ts, 'diff' => $prev ) ) . ')';
 387+ if ( $prev ) {
 388+ $diffLink = '(' . Linker::linkKnown( SpecialPage::getTitleFor( 'ViewConfig' ),
 389+ $this->msg( 'configure-old-changes' )->escaped(), array(), array( 'version' => $ts, 'diff' => $prev ) ) . ')';
 390+ }
394391
395392 ## Make user link...
396393 $userLink = '';
@@ -397,10 +394,10 @@
398395 $userLink = '';
399396 $username = '';
400397 } elseif ( $data['userwiki'] == wfWikiId() ) {
401 - $userLink = $skin->link( Title::makeTitle( NS_USER, $data['username'] ), htmlspecialchars( $data['username'] ) );
 398+ $userLink = Linker::link( Title::makeTitle( NS_USER, $data['username'] ), htmlspecialchars( $data['username'] ) );
402399 $username = $data['username'];
403400 } elseif ( $wiki = WikiMap::getWiki( $data['userwiki'] ) ) {
404 - $userLink = $skin->makeExternalLink( $wiki->getUrl( 'User:'.$data['username'] ), htmlspecialchars( $data['username'].'@'.$data['userwiki'] ) );
 401+ $userLink = Linker::makeExternalLink( $wiki->getUrl( 'User:'.$data['username'] ), htmlspecialchars( $data['username'].'@'.$data['userwiki'] ) );
405402 $username = '';
406403 } else {
407404 ## Last-ditch
@@ -408,9 +405,9 @@
409406 $username = '';
410407 }
411408
412 - $comment = $data['reason'] ? $skin->commentBlock( $data['reason'] ) : '';
 409+ $comment = $data['reason'] ? Linker::commentBlock( $data['reason'] ) : '';
413410
414 - $text = wfMessage( 'configure-old-summary' )->rawParams( $link, $userLink, $diffLink, $comment )->params( $username )->parse();
 411+ $text = $this->msg( 'configure-old-summary' )->rawParams( $link, $userLink, $diffLink, $comment )->params( $username )->parse();
415412
416413 $prev = $ts;
417414
@@ -422,18 +419,18 @@
423420 ## Take out the first ten...
424421 $links = array_slice( $links, 0, 10 );
425422
426 - $text = Html::element( 'legend', null, wfMessage( 'configure-old' )->text() );
 423+ $text = Html::element( 'legend', null, $this->msg( 'configure-old' )->text() );
427424 if ( !count( $links ) ) {
428 - $text .= wfMessage( 'configure-no-old' )->parseAsBlock();
 425+ $text .= $this->msg( 'configure-no-old' )->parseAsBlock();
429426 } else {
430 - $text .= wfMessage( 'configure-old-versions' )->parseAsBlock();
 427+ $text .= $this->msg( 'configure-old-versions' )->parseAsBlock();
431428 $text .= "<ul>\n<li>";
432429 $text .= implode( "</li>\n<li>", $links );
433430 $text .= "</li>\n</ul>\n";
434431 }
435432 $link = SpecialPage::getTitleFor( 'ViewConfig' );
436 - $text .= Html::rawElement( 'p', null, $skin->linkKnown( $link, wfMessage( 'configure-view-all-versions' )->escaped() ) );
437 - $text .= Html::rawElement( 'p', null, $skin->linkKnown( $link, wfMessage( 'configure-view-default' )->escaped(), array(), array( 'version' => 'default' ) ) );
 433+ $text .= Html::rawElement( 'p', null, Linker::linkKnown( $link, $this->msg( 'configure-view-all-versions' )->escaped() ) );
 434+ $text .= Html::rawElement( 'p', null, Linker::linkKnown( $link, $this->msg( 'configure-view-default' )->escaped(), array(), array( 'version' => 'default' ) ) );
438435
439436 return Html::rawElement( 'fieldset', null, $text );
440437 }
@@ -445,8 +442,8 @@
446443 global $wgConfigureWikis, $wgScript;
447444 if ( $wgConfigureWikis === false || !$this->isUserAllowedInterwiki() )
448445 return '';
449 - $form = Html::element( 'legend', null, wfMessage( 'configure-select-wiki' )->text() );
450 - $form .= wfMessage( 'configure-select-wiki-desc' )->parseAsBlock();
 446+ $form = Html::element( 'legend', null, $this->msg( 'configure-select-wiki' )->text() );
 447+ $form .= $this->msg( 'configure-select-wiki-desc' )->parseAsBlock();
451448 $form .= Html::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
452449 $form .= Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() );
453450 if ( is_array( $wgConfigureWikis ) ) {
@@ -458,7 +455,7 @@
459456 } else {
460457 $form .= Html::input( 'wiki', $this->mWiki, 'text' ) . '&#160;';
461458 }
462 - $form .= Html::input( null, wfMessage( 'configure-select-wiki-submit' )->text(), 'submit' );
 459+ $form .= Html::input( null, $this->msg( 'configure-select-wiki-submit' )->text(), 'submit' );
463460 $form .= Html::closeElement( 'form' );
464461 return Html::rawElement( 'fieldset', null, $form );
465462 }
@@ -469,9 +466,10 @@
470467 * @return array
471468 */
472469 protected function importFromRequest() {
473 - global $wgRequest;
 470+ global $wgContLang;
474471
475 - if ( !$this->mCanEdit || !$wgRequest->wasPosted() )
 472+ $request = $this->getRequest();
 473+ if ( !$this->mCanEdit || !$request->wasPosted() )
476474 return array();
477475
478476 $settings = array();
@@ -487,7 +485,7 @@
488486 $arrType = $this->getArrayType( $name );
489487 switch( $arrType ) {
490488 case 'simple':
491 - $text = rtrim($wgRequest->getText( 'wp' . $name ));
 489+ $text = rtrim( $request->getText( 'wp' . $name ) );
492490 if ( $text == '' )
493491 $arr = array();
494492 else
@@ -509,7 +507,7 @@
510508 $settings[$name] = $arr;
511509 break;
512510 case 'simple-dual':
513 - $text = $wgRequest->getText( 'wp' . $name );
 511+ $text = $request->getText( 'wp' . $name );
514512 if ( $text == '' ) {
515513 $arr = array();
516514 } else {
@@ -523,37 +521,33 @@
524522 $settings[$name] = $arr;
525523 break;
526524 case 'ns-bool':
527 - global $wgContLang;
528525 $arr = array();
529526 foreach ( $wgContLang->getNamespaces() as $ns => $unused ) {
530 - $arr[$ns] = $wgRequest->getCheck( 'wp' . $name . '-ns' . strval( $ns ) );
 527+ $arr[$ns] = $request->getCheck( 'wp' . $name . '-ns' . strval( $ns ) );
531528 }
532529 $settings[$name] = $arr;
533530 break;
534531 case 'ns-text':
535 - global $wgContLang;
536532 $arr = array();
537533 foreach ( $wgContLang->getNamespaces() as $ns => $unused ) {
538 - $arr[$ns] = $wgRequest->getVal( 'wp' . $name . '-ns' . strval( $ns ) );
 534+ $arr[$ns] = $request->getVal( 'wp' . $name . '-ns' . strval( $ns ) );
539535 }
540536 $settings[$name] = $arr;
541537 break;
542538 case 'ns-simple':
543 - global $wgContLang;
544539 $arr = array();
545540 foreach ( $wgContLang->getNamespaces() as $ns => $unused ) {
546 - if ( $wgRequest->getCheck( 'wp' . $name . '-ns' . strval( $ns ) ) )
 541+ if ( $request->getCheck( 'wp' . $name . '-ns' . strval( $ns ) ) )
547542 $arr[] = $ns;
548543 }
549544 $settings[$name] = $arr;
550545 break;
551546 case 'ns-array':
552 - global $wgContLang;
553547 $arr = array();
554548 foreach ( $wgContLang->getNamespaces() as $ns => $unused ) {
555549 if ( $ns < 0 )
556550 continue;
557 - $text = rtrim($wgRequest->getText( 'wp' . $name . '-ns' . strval( $ns ) ) );
 551+ $text = rtrim( $request->getText( 'wp' . $name . '-ns' . strval( $ns ) ) );
558552 if ( $text == '' )
559553 $nsProtection = array();
560554 else
@@ -566,7 +560,7 @@
567561 case 'group-array':
568562 $all = array();
569563 if ( isset( $_REQUEST['wp' . $name . '-vals'] ) ) {
570 - $iter = explode( "\n", trim($wgRequest->getText( 'wp' . $name . '-vals' ) ) );
 564+ $iter = explode( "\n", trim( $request->getText( 'wp' . $name . '-vals' ) ) );
571565 foreach ( $iter as &$group ) {
572566 // Our own Sanitizer::unescapeId() :)
573567 $group = urldecode( str_replace( array( '.', "\r" ), array( '%', '' ),
@@ -587,14 +581,14 @@
588582 if ( $arrType == 'group-bool' ) {
589583 $encId = Sanitizer::escapeId( $id );
590584 if ( $id != $encId ) {
591 - $val = $wgRequest->getCheck( str_replace( '.', '_', $encId ) ) ||
592 - $wgRequest->getCheck( $encId ) || $wgRequest->getCheck( $id );
 585+ $val = $request->getCheck( str_replace( '.', '_', $encId ) ) ||
 586+ $request->getCheck( $encId ) || $request->getCheck( $id );
593587 } else {
594 - $val = $wgRequest->getCheck( $id );
 588+ $val = $request->getCheck( $id );
595589 }
596590 if ( $val )
597591 $settings[$name][$group][$right] = true;
598 - } elseif ( $wgRequest->getCheck( $id ) ) {
 592+ } elseif ( $request->getCheck( $id ) ) {
599593 $settings[$name][$group][] = $right;
600594 }
601595 }
@@ -610,8 +604,8 @@
611605 foreach( $validActions as $action ) {
612606 $all[$action] = array();
613607 foreach( $validGroups as $group ) {
614 - $count = $wgRequest->getIntOrNull( "wp$name-key-$action-$group-count" );
615 - $period = $wgRequest->getIntOrNull( "wp$name-key-$action-$group-period" );
 608+ $count = $request->getIntOrNull( "wp$name-key-$action-$group-count" );
 609+ $period = $request->getIntOrNull( "wp$name-key-$action-$group-period" );
616610
617611 if ($count && $period) {
618612 $all[$action][$group] = array( $count, $period );
@@ -630,7 +624,7 @@
631625 APCOND_AGE_FROM_EDIT => 'int' );
632626
633627 if ( isset( $_REQUEST['wp' . $name . '-vals'] ) ) {
634 - $groups = explode( "\n", trim( $wgRequest->getText( 'wp' . $name . '-vals' ) ) );
 628+ $groups = explode( "\n", trim( $request->getText( 'wp' . $name . '-vals' ) ) );
635629 foreach ( $groups as &$group ) {
636630 // Our own Sanitizer::unescapeId() :)
637631 $group = urldecode( str_replace( array( '.', "\r" ), array( '%', '' ),
@@ -642,7 +636,7 @@
643637 }
644638
645639 foreach( $groups as $group ) {
646 - $op = $wgRequest->getText( 'wp' . $name . '-' . $group . '-opt' );
 640+ $op = $request->getText( 'wp' . $name . '-' . $group . '-opt' );
647641 if ( empty( $op ) ) {
648642 $op = 'and';
649643 }
@@ -655,22 +649,22 @@
656650 foreach ( $conds as $condName => $condType ) {
657651 switch( $condType ) {
658652 case 'bool':
659 - $val = $wgRequest->getCheck( 'wp' . $name . '-' . $group . '-cond-' . $condName );
 653+ $val = $request->getCheck( 'wp' . $name . '-' . $group . '-cond-' . $condName );
660654 if( $val )
661655 $condsVal[] = array( $condName );
662656 break;
663657 case 'int':
664 - $val = $wgRequest->getInt( 'wp' . $name . '-' . $group . '-cond-' . $condName );
 658+ $val = $request->getInt( 'wp' . $name . '-' . $group . '-cond-' . $condName );
665659 if( $val )
666660 $condsVal[] = array( $condName, $val );
667661 break;
668662 case 'text':
669 - $val = $wgRequest->getVal( 'wp' . $name . '-' . $group . '-cond-' . $condName );
 663+ $val = $request->getVal( 'wp' . $name . '-' . $group . '-cond-' . $condName );
670664 if( $val )
671665 $condsVal[] = array( $condName, $val );
672666 break;
673667 case 'array':
674 - $val = trim( $wgRequest->getText( 'wp' . $name . '-' . $group . '-cond-' . $condName ) );
 668+ $val = trim( $request->getText( 'wp' . $name . '-' . $group . '-cond-' . $condName ) );
675669 if( !$val )
676670 break;
677671 $val = array_map( 'trim', explode( "\n", $val ) );
@@ -694,7 +688,7 @@
695689 case 'text':
696690 case 'lang':
697691 case 'image-url':
698 - $setting = $wgRequest->getVal( 'wp' . $name );
 692+ $setting = $request->getVal( 'wp' . $name );
699693
700694 if ( $file = wfFindFile( $setting ) ) {
701695 ## It's actually a local file.
@@ -705,14 +699,14 @@
706700
707701 break;
708702 case 'int':
709 - $settings[$name] = $wgRequest->getInt( 'wp' . $name );
 703+ $settings[$name] = $request->getInt( 'wp' . $name );
710704 break;
711705 case 'bool':
712 - $settings[$name] = $wgRequest->getCheck( 'wp' . $name );
 706+ $settings[$name] = $request->getCheck( 'wp' . $name );
713707 break;
714708 default:
715709 if ( is_array( $type ) ) {
716 - $val = $wgRequest->getVal( 'wp' . $name );
 710+ $val = $request->getVal( 'wp' . $name );
717711 if ( !array_key_exists( $val, $type ) && $val !== null ) {
718712 $perm = implode( ', ', $type );
719713 throw new MWException( "Value for \$$name setting is not in permitted (given: $val, permitted: $perm)" );
@@ -841,17 +835,11 @@
842836 * Show the main form
843837 */
844838 protected function showForm() {
845 - global $wgOut, $wgUser, $wgRequest;
846 -
847 - $action = $this->getTitle()->getLocalURL();
848 -
849 - $reason = $wgRequest->getText( 'wpReason' );
850 -
851 - $wgOut->addHTML(
 839+ $this->getOutput()->addHTML(
852840 ( $this->mCanEdit ?
853841 $this->getWikiSelectForm() .
854 - Html::openElement( 'form', array( 'method' => 'post', 'action' => $action,
855 - 'id' => 'configure-form' ) ) . "\n" :
 842+ Html::openElement( 'form', array( 'method' => 'post',
 843+ 'action' => $this->getTitle()->getLocalURL(), 'id' => 'configure-form' ) ) . "\n" :
856844 Html::openElement( 'div', array( 'id' => 'configure-form' ) )
857845 ) .
858846 $this->buildOldVersionSelect() . "\n" .
@@ -859,15 +847,15 @@
860848 Html::openElement( 'div', array( 'id' => 'configure' ) ) . "\n" .
861849 $this->buildAllSettings() . "\n" .
862850 ( $this->mCanEdit ?
863 - wfMessage( 'configure-form-reason' )->text() . ' ' . Html::input( 'wpReason', $reason, 'text', array( 'size' => 45 ) ) . "\n" .
 851+ $this->msg( 'configure-form-reason' )->text() . ' ' . Html::input( 'wpReason',
 852+ $this->getRequest()->getText( 'wpReason' ), 'text', array( 'size' => 45 ) ) . "\n" .
864853 Html::openElement( 'div', array( 'id' => 'prefsubmit' ) ) . "\n" .
865854 Html::openElement( 'div', array() ) . "\n" .
866 - Html::hidden( 'wpEditToken', $wgUser->editToken() ) . "\n" .
867 - Html::input( 'wpSave', wfMessage( 'configure-btn-save' )->text(), 'submit', array( 'class' => 'btnSavePrefs' ) ) . "\n" .
868 - Html::input( 'wpPreview', wfMessage( 'showdiff' )->text(), 'submit' ) . "\n" .
 855+ Html::input( 'wpSave', $this->msg( 'configure-btn-save' )->text(), 'submit', array( 'class' => 'btnSavePrefs' ) ) . "\n" .
 856+ Html::input( 'wpPreview', $this->msg( 'showdiff' )->text(), 'submit' ) . "\n" .
869857 Html::closeElement( 'div' ) . "\n" .
870858 Html::closeElement( 'div' ) . "\n" .
871 - Html::hidden( 'wpEditToken', $wgUser->editToken() ) . "\n" .
 859+ Html::hidden( 'wpEditToken', $this->getUser()->editToken() ) . "\n" .
872860 ( $this->mWiki ? Html::hidden( 'wpWiki', $this->mWiki ) . "\n" : '' )
873861 : ''
874862 ) .
@@ -879,9 +867,9 @@
880868
881869 /** Show a hidden-by-default search form */
882870 protected function buildSearchForm() {
883 - $input = wfMessage( 'configure-js-search-prompt' )->parse() . wfMessage( 'word-separator' )->escaped() .
 871+ $input = $this->msg( 'configure-js-search-prompt' )->parse() . $this->msg( 'word-separator' )->escaped() .
884872 Html::element( 'input', array( 'id' => 'configure-search-input', 'size' => 45 ), null );
885 - $form = Html::element( 'legend', null, wfMessage( 'configure-js-search-legend' )->text() ) . Html::rawElement( 'p', null, $input ) . "\n" .
 873+ $form = Html::element( 'legend', null, $this->msg( 'configure-js-search-legend' )->text() ) . Html::rawElement( 'p', null, $input ) . "\n" .
886874 Html::openElement( 'ul', array( 'id' => 'configure-search-results' ) ) . Html::closeElement( 'ul' );
887875 $form = Html::rawElement( 'fieldset', array( 'style' => 'display: none;', 'id' => 'configure-search-form' ), $form );
888876 return $form;
@@ -891,9 +879,7 @@
892880 * Inject JavaScripts and Stylesheets in page output
893881 */
894882 protected function injectScriptsAndStyles() {
895 - global $wgOut;
896 -
897 - $wgOut->addModules( 'ext.configure' );
 883+ $this->getOutput()->addModules( 'ext.configure' );
898884 }
899885
900886 /**
@@ -903,7 +889,7 @@
904890 * @return String xhtml fragment
905891 */
906892 protected function buildTableHeading( $msg ) {
907 - $msgObj = wfMessage( 'configure-section-' . $msg );
 893+ $msgObj = $this->msg( 'configure-section-' . $msg );
908894 if ( $msgObj->exists() ) {
909895 $msgVal = $msgObj->parse();
910896 } else {
@@ -922,7 +908,7 @@
923909 protected function buildInput( $conf, $params = array() ) {
924910 $read = isset( $params['read'] ) ? $params['read'] : $this->userCanRead( $conf );
925911 if ( !$read )
926 - return Html::rawElement( 'span', array( 'class' => 'disabled' ), wfMessage( 'configure-view-not-allowed' )->parse() );
 912+ return Html::rawElement( 'span', array( 'class' => 'disabled' ), $this->msg( 'configure-view-not-allowed' )->parse() );
927913 $allowed = isset( $params['edit'] ) ? $params['edit'] : $this->userCanEdit( $conf );
928914 $type = isset( $params['type'] ) ? $params['type'] : $this->getSettingType( $conf );
929915 $default = isset( $params['value'] ) ? $params['value'] : $this->getSettingValue( $conf );
@@ -934,7 +920,7 @@
935921 if ( $type == 'image-url' ) {
936922 if ( !$allowed )
937923 return '<code>' . htmlspecialchars( (string)$default ) . '</code>';
938 - return wfMessage( 'configure-image-url-explanation' )->parse() . '<br />' .
 924+ return $this->msg( 'configure-image-url-explanation' )->parse() . '<br />' .
939925 Html::element( 'input', array( 'name' => "wp$conf", 'size' => 45, 'value' => (string)$default,
940926 'class' => 'image-selector', 'id' => 'image-url-textbox-' . $conf )
941927 ) . '&#160;' .
@@ -944,7 +930,7 @@
945931 if ( !$allowed )
946932 return '<code>' . ( $default ? 'true' : 'false' ) . '</code>';
947933 $attribs = array( 'type' => 'checkbox', 'name' => "wp$conf", 'value' => '1' );
948 - if ( $allowed ) {
 934+ if ( $default ) {
949935 $attribs['checked'] = 'checked';
950936 }
951937 return Html::element( 'input', $attribs );
@@ -1014,7 +1000,7 @@
10151001 htmlspecialchars( ( is_array( $default ) ? implode( "\n", $default ) : $default ) ) .
10161002 "\n</pre>";
10171003 }
1018 - $text = wfMessage( 'configure-arrayinput-oneperline' )->parse();
 1004+ $text = $this->msg( 'configure-arrayinput-oneperline' )->parse();
10191005 $text .= Html::textarea( "wp{$conf}", is_array( $default ) ? implode( "\n", $default ) : '',
10201006 array( 'id' => "wp{$conf}", 'rows' => 8, 'style' => 'width:95%;' ) );
10211007 return $text;
@@ -1022,18 +1008,18 @@
10231009 if ( $type == 'assoc' ) {
10241010 ## See if the key/value has a special description
10251011
1026 - $keydescmsg = wfMessage( "configure-setting-$conf-key" );
 1012+ $keydescmsg = $this->msg( "configure-setting-$conf-key" );
10271013 if ( $keydescmsg->exists() ) {
10281014 $keydesc = $keydescmsg->parse();
10291015 } else {
1030 - $keydesc = wfMessage( 'configure-desc-key' )->escaped();
 1016+ $keydesc = $this->msg( 'configure-desc-key' )->escaped();
10311017 }
10321018
1033 - $valdescmsg = wfMessage( "configure-setting-$conf-value" );
 1019+ $valdescmsg = $this->msg( "configure-setting-$conf-value" );
10341020 if ( $valdescmsg->exists() ) {
10351021 $valdesc = $valdescmsg->parse();
10361022 } else {
1037 - $valdesc = wfMessage( 'configure-desc-val' )->escaped();
 1023+ $valdesc = $this->msg( 'configure-desc-val' )->escaped();
10381024 }
10391025
10401026 $classes = array( 'configure-array-table', 'assoc' );
@@ -1093,18 +1079,18 @@
10941080 return $text;
10951081 }
10961082 if ( $type == 'rate-limits' ) { ## Some of this is stolen from assoc, since it's an assoc with an assoc.
1097 - $keydescmsg = wfMessage( "configure-setting-$conf-key" );
 1083+ $keydescmsg = $this->msg( "configure-setting-$conf-key" );
10981084 if ( $keydescmsg->exists() ) {
10991085 $keydesc = $keydescmsg->parse();
11001086 } else {
1101 - $keydesc = wfMessage( 'configure-desc-key' )->escaped();
 1087+ $keydesc = $this->msg( 'configure-desc-key' )->escaped();
11021088 }
11031089
1104 - $valdescmsg = wfMessage( "configure-setting-$conf-value" );
 1090+ $valdescmsg = $this->msg( "configure-setting-$conf-value" );
11051091 if ( $valdescmsg->exists() ) {
11061092 $valdesc = $valdescmsg->parse();
11071093 } else {
1108 - $valdesc = wfMessage( 'configure-desc-val' )->escaped();
 1094+ $valdesc = $this->msg( 'configure-desc-val' )->escaped();
11091095 }
11101096
11111097 $classes = array( 'configure-array-table', 'configure-rate-limits' );
@@ -1123,11 +1109,11 @@
11241110 if ( isset( $default[$action] ) )
11251111 $val = $default[$action];
11261112
1127 - $key = Html::rawElement( 'td', array(), wfMessage( "configure-throttle-action-$action" )->parse() );
 1113+ $key = Html::rawElement( 'td', array(), $this->msg( "configure-throttle-action-$action" )->parse() );
11281114
11291115 ## Build YET ANOTHER ASSOC TABLE ARGH!
1130 - $innerRows = Html::rawElement( 'tr', array(), Html::rawElement( 'th', array(), wfMessage( 'configure-throttle-group' )->parse() ) . ' ' .
1131 - Html::rawElement( 'th', array(), wfMessage( 'configure-throttle-limit' )->parse() ) )."\n";
 1116+ $innerRows = Html::rawElement( 'tr', array(), Html::rawElement( 'th', array(), $this->msg( 'configure-throttle-group' )->parse() ) . ' ' .
 1117+ Html::rawElement( 'th', array(), $this->msg( 'configure-throttle-limit' )->parse() ) )."\n";
11321118 foreach( $validGroups as $type ) {
11331119 $limits = null;
11341120 if ( isset( $default[$action][$type] ) )
@@ -1138,16 +1124,16 @@
11391125 $count = $period = 0;
11401126
11411127 $id = 'wp'.$conf.'-key-'.$action.'-'.$type;
1142 - $left_col = Html::rawElement( 'td', array(), wfMessage( "configure-throttle-group-$type" )->parse() );
 1128+ $left_col = Html::rawElement( 'td', array(), $this->msg( "configure-throttle-group-$type" )->parse() );
11431129
11441130 if ( $allowed ) {
1145 - $right_col = Html::element( 'label', array( 'for' => "$id-count" ), wfMessage( 'configure-throttle-count' )->text() ) .
 1131+ $right_col = Html::element( 'label', array( 'for' => "$id-count" ), $this->msg( 'configure-throttle-count' )->text() ) .
11461132 '&#160;' . Html::input( "$id-count", $count, 'text', array( 'name' => "$id-count", 'size' => 15 ) ) .
11471133 Html::element( 'br' ) .
1148 - Html::element( 'label', array( 'for' => "$id-period" ), wfMessage( 'configure-throttle-period' )->text() ) .
 1134+ Html::element( 'label', array( 'for' => "$id-period" ), $this->msg( 'configure-throttle-period' )->text() ) .
11491135 '&#160;' . Html::input( "$id-period", $period, 'text', array( 'name' => "$id-period", 'size' => 15 ) );
11501136 } else {
1151 - $right_col = ($count && $period) ? wfMessage( 'configure-throttle-summary', $count, $period )->text() : wfMessage( 'configure-throttle-none' )->text();
 1137+ $right_col = ($count && $period) ? $this->msg( 'configure-throttle-summary', $count, $period )->text() : $this->msg( 'configure-throttle-none' )->text();
11521138 ## Laziness: Make summaries work by putting the data in hidden fields, rather than a special case in JS.
11531139 $right_col .= "\n" . Html::hidden( "$id-count", $count, array( 'id' => "$id-count" ) ) . Html::hidden( "$id-period", $period, array( 'id' => "$id-period" ) );
11541140 }
@@ -1185,7 +1171,7 @@
11861172 foreach ( $wgContLang->getNamespaces() as $ns => $name ) {
11871173 $name = str_replace( '_', ' ', $name );
11881174 if ( '' == $name ) {
1189 - $name = wfMessage( 'blanknamespace' )->parse();
 1175+ $name = $this->msg( 'blanknamespace' )->parse();
11901176 }
11911177 if ( $type == 'ns-bool' ) {
11921178 $checked = isset( $default[$ns] ) && $default[$ns];
@@ -1211,12 +1197,12 @@
12121198 }
12131199 if ( $type == 'ns-text' ) {
12141200 global $wgContLang;
1215 - $nsdesc = wfMessage( 'configure-desc-ns' )->escaped();
1216 - $valdescmsg = wfMessage( "configure-setting-$conf-value" );
 1201+ $nsdesc = $this->msg( 'configure-desc-ns' )->escaped();
 1202+ $valdescmsg = $this->msg( "configure-setting-$conf-value" );
12171203 if ( $valdescmsg->exists() ) {
12181204 $valdesc = $valdescmsg->parse();
12191205 } else {
1220 - $valdesc = wfMessage( 'configure-desc-val' )->escaped();
 1206+ $valdesc = $this->msg( 'configure-desc-val' )->escaped();
12211207 }
12221208
12231209 $text = Html::openElement( 'table', array( 'class' => 'configure-array-table ns-text configure-biglist' ) ) . "\n" .
@@ -1224,7 +1210,7 @@
12251211 foreach ( $wgContLang->getNamespaces() as $ns => $name ) {
12261212 $name = str_replace( '_', ' ', $name );
12271213 if ( '' == $name ) {
1228 - $name = wfMessage( 'blanknamespace' )->parse();
 1214+ $name = $this->msg( 'blanknamespace' )->parse();
12291215 }
12301216 $text .= Html::openElement( 'tr', array() ) . Html::rawElement( 'td', array(), $name ) . Html::openElement( 'td', array() );
12311217 if ( $allowed )
@@ -1242,12 +1228,12 @@
12431229 }
12441230 if ( $type == 'ns-array' ) {
12451231 global $wgContLang;
1246 - $nsdesc = wfMessage( 'configure-desc-ns' )->escaped();
1247 - $valdescmsg = wfMessage( "configure-setting-$conf-value" );
 1232+ $nsdesc = $this->msg( 'configure-desc-ns' )->escaped();
 1233+ $valdescmsg = $this->msg( "configure-setting-$conf-value" );
12481234 if ( $valdescmsg->exists() ) {
12491235 $valdesc = $valdescmsg->parse();
12501236 } else {
1251 - $valdesc = wfMessage( 'configure-desc-val' )->escaped();
 1237+ $valdesc = $this->msg( 'configure-desc-val' )->escaped();
12521238 }
12531239
12541240 $text = Html::openElement( 'table', array( 'class' => 'ns-array configure-biglist configure-array-table' ) ) . "\n" .
@@ -1257,7 +1243,7 @@
12581244 continue;
12591245 $name = str_replace( '_', ' ', $name );
12601246 if ( '' == $name ) {
1261 - $name = wfMessage( 'blanknamespace' )->parse();
 1247+ $name = $this->msg( 'blanknamespace' )->parse();
12621248 }
12631249 $text .= Html::openElement( 'tr' ) . Html::rawElement( 'td', array(),
12641250 Html::rawElement( 'label', array( 'for' => "wp{$conf}-ns{$ns}" ), $name ) ) . Html::openElement( 'td' );
@@ -1298,12 +1284,12 @@
12991285 $all = array_diff( $all, $this->getSettingValue( 'wgImplicitGroups' ) );
13001286 }
13011287 sort( $all );
1302 - $groupdesc = wfMessage( 'configure-desc-group' )->escaped();
1303 - $valdescmsg = wfMessage( "configure-setting-$conf-value" );
 1288+ $groupdesc = $this->msg( 'configure-desc-group' )->escaped();
 1289+ $valdescmsg = $this->msg( "configure-setting-$conf-value" );
13041290 if ( $valdescmsg->exists() ) {
13051291 $valdesc = $valdescmsg->parse();
13061292 } else {
1307 - $valdesc = wfMessage( 'configure-desc-val' )->escaped();
 1293+ $valdesc = $this->msg( 'configure-desc-val' )->escaped();
13081294 }
13091295
13101296 $classes = "{$type} configure-array-table" . ( $type == 'group-bool' ? ' ajax-group' : '' );
@@ -1323,12 +1309,12 @@
13241310 }
13251311 if ( $type == 'promotion-conds' ) {
13261312
1327 - $groupdesc = wfMessage( 'configure-desc-group' )->escaped();
1328 - $valdescmsg = wfMessage( "configure-setting-$conf-value" );
 1313+ $groupdesc = $this->msg( 'configure-desc-group' )->escaped();
 1314+ $valdescmsg = $this->msg( "configure-setting-$conf-value" );
13291315 if ( $valdescmsg->exists() ) {
13301316 $valdesc = $valdescmsg->parse();
13311317 } else {
1332 - $valdesc = wfMessage( 'configure-desc-val' )->escaped();
 1318+ $valdesc = $this->msg( 'configure-desc-val' )->escaped();
13331319 }
13341320
13351321 $text = Html::openElement( 'table', array( 'id' => $conf, 'class' => "{$type} configure-array-table ajax-group" ) ) ."\n";
@@ -1504,7 +1490,7 @@
15051491 $link = $rawVal;
15061492 }
15071493
1508 - $msgObj = wfMessage( $msg );
 1494+ $msgObj = $this->msg( $msg );
15091495 if ( $msgObj->exists() ) {
15101496 $msgVal = $msgObj->parse() . " ($link)";
15111497 } else {
@@ -1512,7 +1498,7 @@
15131499 }
15141500
15151501 if ( $params['customised'] ) {
1516 - $msgVal = Html::rawElement( 'p', null, $msgVal ) . wfMessage( 'configure-customised' )->parseAsBlock();
 1502+ $msgVal = Html::rawElement( 'p', null, $msgVal ) . $this->msg( 'configure-customised' )->parseAsBlock();
15171503 }
15181504
15191505 $attribs = array();
@@ -1618,7 +1604,7 @@
16191605 }
16201606
16211607 if ( $thisSection ) {
1622 - $thisSection = Html::rawElement( 'legend', null, wfMessage( "configure-section-$title" )->parse() ) . $thisSection;
 1608+ $thisSection = Html::rawElement( 'legend', null, $this->msg( "configure-section-$title" )->parse() ) . $thisSection;
16231609 $ret .= Html::rawElement( 'fieldset', null, $thisSection );
16241610 }
16251611 }
Index: trunk/extensions/Configure/Configure.php
@@ -17,7 +17,7 @@
1818 'author' => array( 'Alexandre Emsenhuber', 'Andrew Garrett' ),
1919 'url' => 'https://www.mediawiki.org/wiki/Extension:Configure',
2020 'descriptionmsg' => 'configure-desc',
21 - 'version' => '0.16.3',
 21+ 'version' => '0.17.0',
2222 );
2323
2424 # Configuration part
Index: trunk/extensions/Configure/handler/Handler.php
@@ -46,12 +46,13 @@
4747 * Save a new configuration
4848 *
4949 * @param $settings array of settings
 50+ * @param $user User doing the modification
5051 * @param $wiki String: wiki name or true for all
5152 * @param $ts 14 chars timestamps
5253 * @param $reason String: Reason, as given by the user.
5354 * @return bool true on success
5455 */
55 - public function saveNewSettings( $settings, $wiki, $ts = false, $reason = '' );
 56+ public function saveNewSettings( $settings, User $user, $wiki, $ts = false, $reason = '' );
5657
5758 /**
5859 * List all archived versions
Index: trunk/extensions/Configure/handler/HandlerFiles.php
@@ -89,19 +89,18 @@
9090 /**
9191 * Save a new configuration
9292 * @param $settings array of settings
 93+ * @param $user User doing the modification
9394 * @param $wiki String: wiki name or true for all
9495 * @return bool true on success
9596 */
96 - public function saveNewSettings( $settings, $wiki, $ts = false, $reason = '' ) {
97 - global $wgUser;
98 -
 97+ public function saveNewSettings( $settings, User $user, $wiki, $ts = false, $reason = '' ) {
9998 $arch = $this->getArchiveFileName();
10099 $cur = $this->getFileName();
101100
102101 ## Add meta-data
103102 $settings['__metadata'] = array(
104103 'user_wiki' => wfWikiID(),
105 - 'user_name' => $wgUser->getName(),
 104+ 'user_name' => $user->getName(),
106105 'reason' => $reason
107106 );
108107
Index: trunk/extensions/Configure/handler/HandlerDb.php
@@ -192,20 +192,21 @@
193193 * Save a new configuration
194194 *
195195 * @param $settings array of settings
 196+ * @param $user User doing the modification
196197 * @param $wiki String: wiki name or true for all
197198 * @param $ts 14 chars timestamps
198199 * @param $reason String: Reason, as given by the user.
199200 * @return bool true on success
200201 */
201 - public function saveNewSettings( $settings, $wiki, $ts = false, $reason = '' ) {
 202+ public function saveNewSettings( $settings, User $user, $wiki, $ts = false, $reason = '' ) {
202203 if ( $wiki === true ) {
203204 foreach ( $settings as $name => $val ) {
204 - $this->saveSettingsForWiki( $val, $name, $ts, $reason );
 205+ $this->saveSettingsForWiki( $val, $user, $name, $ts, $reason );
205206 }
206207 } else {
207208 if ( !isset( $settings[$wiki] ) )
208209 return false;
209 - $this->saveSettingsForWiki( $settings[$wiki], $wiki, $ts, $reason );
 210+ $this->saveSettingsForWiki( $settings[$wiki], $user, $wiki, $ts, $reason );
210211 }
211212 $this->getCache()->delete( $this->cacheKey( 'configure', 'current' ) );
212213 return true;
@@ -214,9 +215,7 @@
215216 /**
216217 * save the configuration for $wiki
217218 */
218 - protected function saveSettingsForWiki( $settings, $wiki, $ts, $reason = '' ) {
219 - global $wgUser;
220 -
 219+ protected function saveSettingsForWiki( $settings, User $user, $wiki, $ts, $reason = '' ) {
221220 $dbw = $this->getMasterDB();
222221 if ( !$ts )
223222 $ts = wfTimestampNow();
@@ -233,7 +232,7 @@
234233 'cv_wiki' => $wiki,
235234 'cv_timestamp' => $dbw->timestamp( $ts ),
236235 'cv_is_latest' => 1,
237 - 'cv_user_text' => $wgUser->getName(),
 236+ 'cv_user_text' => $user->getName(),
238237 'cv_user_wiki' => wfWikiId(),
239238 'cv_reason' => $reason
240239 ),
Index: trunk/extensions/Configure/Configure.diff.php
@@ -6,7 +6,7 @@
77 *
88 * @ingroup Extensions
99 */
10 -abstract class ConfigurationDiff {
 10+abstract class ConfigurationDiff extends ContextSource {
1111 protected $diff;
1212 protected $version;
1313 protected $wikis;
@@ -19,7 +19,8 @@
2020 * @param $version String: new versions
2121 * @param $wikis Array: array of wiki names
2222 */
23 - public function __construct( $diff, $version, $wikis ) {
 23+ public function __construct( $context, $diff, $version, $wikis ) {
 24+ $this->setContext( $context );
2425 $this->diff = $diff;
2526 $this->version = $version;
2627 $this->wikis = $wikis;
@@ -113,12 +114,11 @@
114115 * Get the HTML of the diff
115116 */
116117 function getHTML() {
117 - global $wgOut;
118 - $wgOut->addStyle( 'common/diff.css' );
 118+ $this->getOutput()->addStyle( 'common/diff.css' );
119119 $old = $this->getOldVersion();
120120 $new = $this->getNewVersion();
121121 if ( !( $wikis = $this->cleanWikis( $old, $new ) ) ) {
122 - return wfMessage( 'configure-no-diff' )->parseAsBlock();
 122+ return $this->msg( 'configure-no-diff' )->parseAsBlock();
123123 }
124124 $text = '';
125125 foreach ( $wikis as $wiki ) {
@@ -152,7 +152,7 @@
153153 $groupDiff .= $this->processDiffSetting( $setting, $oldSetting, $newSetting, $type ) . "\n";
154154 }
155155 if ( $groupDiff != '' ) {
156 - $msg = wfMessage( 'configure-section-' . $groupName );
 156+ $msg = $this->msg( 'configure-section-' . $groupName );
157157 if ( $msg->exists() ) {
158158 $name = $msg->parse();
159159 } else {
@@ -163,14 +163,14 @@
164164 }
165165 }
166166 if ( $sectionDiff != '' ) {
167 - $name = wfMessage( 'configure-section-' . $sectionName )->parse();
 167+ $name = $this->msg( 'configure-section-' . $sectionName )->parse();
168168 $text .= "<tr><td colspan=\"4\"><h3 class=\"config-diff-section\">{$name}</h3></td></tr>\n";
169169 $text .= $sectionDiff;
170170 }
171171 }
172172
173173 if ( empty( $text ) )
174 - return wfMessage( 'configure-no-diff' )->parseAsBlock();
 174+ return $this->msg( 'configure-no-diff' )->parseAsBlock();
175175
176176 $ret = "<table class='diff'>\n";
177177 $ret .= "<col class='diff-marker' />";
@@ -192,7 +192,7 @@
193193 * @return String: XHTML
194194 */
195195 function processDiffSetting( $name, $old, $new, $type ) {
196 - $msg = wfMessage( 'configure-setting-' . $name );
 196+ $msg = $this->msg( 'configure-setting-' . $name );
197197 $rawVal = Xml::element( 'tt', null, "\$$name" );
198198 if ( $msg->exists() ) {
199199 $msgVal = $msg->parse() . " ($rawVal)";
@@ -275,7 +275,7 @@
276276 if ($count == 0 || $period == 0)
277277 continue;
278278
279 - $val[] = "$action, $group: " . wfMessage( 'configure-throttle-summary', $count, $period )->text();
 279+ $val[] = "$action, $group: " . $this->msg( 'configure-throttle-summary', $count, $period )->text();
280280 }
281281 }
282282 }
@@ -288,11 +288,11 @@
289289
290290 foreach( $setting as $group => $conds ) {
291291 if ( !is_array( $conds ) ) {
292 - $val[] = "$group: ".wfMessage( "configure-condition-description-$conds" )->text();
 292+ $val[] = "$group: ".$this->msg( "configure-condition-description-$conds" )->text();
293293 continue;
294294 }
295295 if ( count( $conds ) == 0 ) {
296 - $val[] = "$group: ".wfMessage( 'configure-autopromote-noconds' )->text();
 296+ $val[] = "$group: ".$this->msg( 'configure-autopromote-noconds' )->text();
297297 continue;
298298 }
299299
@@ -300,7 +300,7 @@
301301 $boolop = array_shift( $conds );
302302 $boolop = $opToName[$boolop];
303303
304 - $val[] = "$group: " . wfMessage( "configure-boolop-description-$boolop" )->text();
 304+ $val[] = "$group: " . $this->msg( "configure-boolop-description-$boolop" )->text();
305305 } else {
306306 $conds = array( $conds );
307307 }
@@ -308,7 +308,7 @@
309309 // Analyse each individual one...
310310 foreach( $conds as $cond ) {
311311 if ($cond == array( APCOND_AGE, -1 ) ) {
312 - $val[] = "$group: " . wfMessage( 'configure-autopromote-noconds' )->text();
 312+ $val[] = "$group: " . $this->msg( 'configure-autopromote-noconds' )->text();
313313 continue;
314314 }
315315
@@ -321,7 +321,7 @@
322322 $argSummary = implode( ', ', $cond );
323323 $count = count( $cond );
324324
325 - $val[] = "$group: ".wfMessage( "configure-condition-description-$name", $argSummary, $count )->text();
 325+ $val[] = "$group: ".$this->msg( "configure-condition-description-$name", $argSummary, $count )->text();
326326 }
327327 }
328328 } else {

Status & tagging log