r46550 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46549‎ | r46550 | r46551 >
Date:21:06, 29 January 2009
Author:ialex
Status:deferred (Comments)
Tags:
Comment:
Use $wgConf->getDefaultsForWiki() to get default values (version=default) rather than $wgConf->getOldSettings( 'default' )
Modified paths:
  • /trunk/extensions/Configure/Configure.page.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Configure/Configure.page.php
@@ -311,18 +311,19 @@
312312
313313 if ( $version = $wgRequest->getVal( 'version' ) ) {
314314 if ( $version == 'default' || $wgConf->versionExists( $version ) ) {
315 - $conf = $wgConf->getOldSettings( $version );
 315+ if ( $version == 'default' ) { ## Hacky special case.
 316+ $this->conf = $wgConf->getDefaultsForWiki( $this->mWiki );
 317+ } else {
 318+ $conf = $wgConf->getOldSettings( $version );
316319
317 - if ( $version == 'default' ) { ## Hacky special case.
318 - $conf[$this->mWiki] = $conf['default'];
 320+ if ( !isset( $conf[$this->mWiki] ) ) {
 321+ $wgOut->wrapWikiMsg( '<div class="errorbox">$1</div>',
 322+ array( 'configure-old-not-available', $version ) );
 323+ return false;
 324+ }
 325+ $this->conf = $conf[$this->mWiki];
319326 }
320327
321 - if ( !isset( $conf[$this->mWiki] ) ) {
322 - $wgOut->wrapWikiMsg( '<div class="errorbox">$1</div>',
323 - array( 'configure-old-not-available', $version ) );
324 - return false;
325 - }
326 - $this->conf = $conf[$this->mWiki];
327328 $current = null;
328329 foreach ( $this->conf as $name => $value ) {
329330 if ( $this->canBeMerged( $name, $value ) ) {
@@ -405,8 +406,8 @@
406407 $text .= "</li>\n</ul>\n";
407408 }
408409 $link = SpecialPage::getTitleFor( 'ViewConfig' );
409 - $text .= Xml::tags( 'p', null, $skin->makeKnownLinkObj( $link, wfMsgHtml( 'configure-view-all-versions' ) ) );
410 - $text .= Xml::tags( 'p', null, $skin->makeKnownLinkObj( $link, wfMsgHtml( 'configure-view-default' ), 'version=default' ) );
 410+ $text .= Xml::tags( 'p', null, $skin->link( $link, wfMsgHtml( 'configure-view-all-versions' ), array(), array(), array( 'known' ) ) );
 411+ $text .= Xml::tags( 'p', null, $skin->link( $link, wfMsgHtml( 'configure-view-default' ), array(), array( 'version' => 'default' ), array( 'known' ) ) );
411412
412413 $text .= '</fieldset>';
413414 return $text;
@@ -566,7 +567,7 @@
567568 } else {
568569 $val = $wgRequest->getCheck( $id );
569570 }
570 - if ($val)
 571+ if ( $val )
571572 $settings[$name][$group][$right] = true;
572573 } else if ( $wgRequest->getCheck( $id ) ) {
573574 $settings[$name][$group][] = $right;

Comments

#Comment by Werdna (talk | contribs)   23:22, 11 February 2009

Some code style tweaks, too, down the bottom.

Looks good.

Status & tagging log