r43960 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43959‎ | r43960 | r43961 >
Date:01:11, 26 November 2008
Author:werdna
Status:ok (Comments)
Tags:
Comment:
Configure extension updates:
* Stopped displaying settings which can't be edited in Special:Configure.
These can be viewed at Special:Configure.
* Introduced explicit whitelisting of settings, rather than blacklisting
of other settings.
Modified paths:
  • /trunk/extensions/Configure/CHANGELOG (modified) (history)
  • /trunk/extensions/Configure/Configure.page.php (modified) (history)
  • /trunk/extensions/Configure/Configure.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Configure/Configure.page.php
@@ -209,7 +209,12 @@
210210 protected function getUneditableSettings() {
211211 static $notEditable;
212212 if ( !isset( $notEditable ) ) {
213 - global $wgConfigureNotEditableSettings;
 213+ global $wgConfigureNotEditableSettings, $wgConfigureEditableSettings;
 214+
 215+ if ( !count($wgConfigureNotEditableSettings) && count($wgConfigureEditableSettings ) ) {
 216+ $wgConfigureNotEditableSettings = array_diff( array_keys( $this->mConfSettings->getAllSettings() ), $wgConfigureEditableSettings );
 217+ }
 218+
214219 $notEditable = array_merge( $this->mConfSettings->getUneditableSettings(),
215220 $wgConfigureNotEditableSettings );
216221 }
@@ -1153,11 +1158,9 @@
11541159 if ( !count( $groups[$name] ) )
11551160 unset( $groups[$name] );
11561161 }
1157 - $ret .= Xml::openElement( 'fieldset' ) . "\n" .
1158 - Xml::element( 'legend', null, wfMsgExt( "configure-section-$title", array( 'parseinline' ) ) ) . "\n";
1159 - if ( $res ) {
1160 - $ret .= wfMsgExt( 'configure-section-' . $title . '-notallowed', array( 'parseinline' ) );
1161 - } else {
 1162+
 1163+ $thisSection = '';
 1164+ if ( !$res ) {
11621165 $first = true;
11631166 if ( !isset( $param['showlink'] ) ) {
11641167 $showlink = true;
@@ -1172,20 +1175,33 @@
11731176 $showlink = (bool)$param['showlink'];
11741177 }
11751178 foreach ( $groups as $group => $settings ) {
1176 - $ret .= $this->buildTableHeading( $group, !$first );
1177 - $first = false;
 1179+ $thisGroup = '';
11781180 foreach ( $settings as $setting => $type ) {
11791181 $params = $perms[$setting] + array(
11801182 'type' => $type,
11811183 'value' => $this->getSettingValue( $setting ),
11821184 'link' => $showlink,
11831185 );
1184 - $ret .= $this->buildTableRow( $setting, $params );
 1186+ $canEdit = isset( $params['edit'] ) ? $params['edit'] : $this->userCanEdit( $setting );
 1187+ if ($canEdit) {
 1188+ $thisGroup .= $this->buildTableRow( $setting, $params );
 1189+ } else {
 1190+ ## Don't even show it.
 1191+ }
11851192 }
 1193+
 1194+ if ($thisGroup) {
 1195+ $thisSection .= $this->buildTableHeading( $group, !$first ) . $thisGroup . Xml::closeElement( 'table' );
 1196+ $first = false;
 1197+ }
11861198 }
1187 - $ret .= Xml::closeElement( 'table' ) . "\n";
 1199+
 1200+ if ($thisSection) {
 1201+ $thisSection = Xml::tags( 'legend', null, wfMsgExt( "configure-section-$title", array( 'parseinline' ) ) ) . $thisSection;
 1202+ $ret .= Xml::tags( 'fieldset', null, $thisSection );
 1203+ }
11881204 }
1189 - $ret .= Xml::closeElement( 'fieldset' );
 1205+
11901206 }
11911207 return $ret;
11921208 }
Index: trunk/extensions/Configure/CHANGELOG
@@ -1,6 +1,12 @@
22 This file lists changes on this extension.
33 Localisation updates are done on betawiki and aren't listed here.
44
 5+0.10.8 - 26 November 2008
 6+ * Stopped displaying settings which can't be edited in Special:Configure.
 7+ These can be viewed at Special:Configure.
 8+ * Introduced explicit whitelisting of settings, rather than blacklisting
 9+ of other settings.
 10+
511 0.10.7 - 25 November 2008
612 * Added diff links for the versions at the top of Special:Configure and
713 Special:Extensions
Index: trunk/extensions/Configure/Configure.php
@@ -17,7 +17,7 @@
1818 'url' => 'http://www.mediawiki.org/wiki/Extension:Configure',
1919 'description' => 'Allow authorised users to configure the wiki via a web-based interface',
2020 'descriptionmsg' => 'configure-desc',
21 - 'version' => '0.10.7',
 21+ 'version' => '0.10.8',
2222 );
2323
2424 # Configuration part
@@ -102,10 +102,24 @@
103103 /**
104104 * Array of not editable settings, by anyone.
105105 * They won't be saved in conf-now.ser.
 106+ * Superseded, use the explicit whitelist.
106107 */
107108 $wgConfigureNotEditableSettings = array();
108109
109110 /**
 111+ * Editable settings
 112+ */
 113+ # Suggested configuration:
 114+$wgConfigureEditableSettings = array(
 115+ 'wgSitename', 'wgLogo', 'wgContentNamespaces', 'wgMetaNamespace', 'wgMetaNamespaceTalk',
 116+ 'wgNamespaceAliases', 'wgNamespaceProtection', 'wgNamespaceRobotPolicies', 'wgNamespacesToBeSearchedDefault',
 117+ 'wgNamespacesToBeSearchedProject', 'wgNamespacesWithSubpages', 'wgNoFollowNsExceptions', 'wgNonincludableNamespaces',
 118+ 'wgSitemapNamespaces', 'wgAutopromote', 'wgGroupPermissions', 'wgAddGroups', 'wgRemoveGroups', 'wgGroupsAddToSelf',
 119+ 'wgGroupsRemoveFromSelf', 'wgArticleRobotPolicies', 'wgCapitalLinks', 'wgDefaultLanguageVariant', 'wgExtraSubtitle',
 120+ 'wgImportSources', 'wgRateLimits', 'wgAutoConfirmAge', 'wgAutoConfirmCount', 'wgMaxSigChars'
 121+);
 122+
 123+/**
110124 * Whether to use the API module
111125 */
112126 $wgConfigureAPI = false;

Comments

#Comment by IAlex (talk | contribs)   11:21, 26 November 2008

Imho, $wgConfigureEditableSettings should be an empty array by default since this extension is meant to allow editing most of the settings. The actual version could be in a comment in this file.

#Comment by Werdna (talk | contribs)   11:24, 26 November 2008

Was thinking of that, actually. I'm not fussed either way – it'll be overridden (probably to that list there) on Wikimedia anyway.

#Comment by IAlex (talk | contribs)   12:19, 26 November 2008

Changed that in r43976.

Status & tagging log