Index: trunk/extensions/Configure/Configure.page.php |
— | — | @@ -218,18 +218,7 @@ |
219 | 219 | * @return array |
220 | 220 | */ |
221 | 221 | protected function getUneditableSettings() { |
222 | | - static $notEditable; |
223 | | - if ( !isset( $notEditable ) ) { |
224 | | - global $wgConfigureNotEditableSettings, $wgConfigureEditableSettings; |
225 | | - |
226 | | - if ( !count($wgConfigureNotEditableSettings) && count($wgConfigureEditableSettings ) ) { |
227 | | - $wgConfigureNotEditableSettings = array_diff( array_keys( $this->mConfSettings->getAllSettings() ), $wgConfigureEditableSettings ); |
228 | | - } |
229 | | - |
230 | | - $notEditable = array_merge( $this->mConfSettings->getUneditableSettings(), |
231 | | - $wgConfigureNotEditableSettings ); |
232 | | - } |
233 | | - return $notEditable; |
| 222 | + return $this->mConfSettings->getUneditableSettings(); |
234 | 223 | } |
235 | 224 | |
236 | 225 | /** |
— | — | @@ -238,11 +227,7 @@ |
239 | 228 | * @return array |
240 | 229 | */ |
241 | 230 | protected function getEditableSettings() { |
242 | | - $notEdit = $this->getUneditableSettings(); |
243 | | - $settings = $this->mConfSettings->getAllSettings(); |
244 | | - foreach ( $notEdit as $setting ) |
245 | | - unset( $settings[$setting] ); |
246 | | - return $settings; |
| 231 | + return $this->mConfSettings->getEditableSettings(); |
247 | 232 | } |
248 | 233 | |
249 | 234 | /** |
— | — | @@ -760,15 +745,11 @@ |
761 | 746 | */ |
762 | 747 | protected function removeDefaults( $settings ) { |
763 | 748 | global $wgConf; |
764 | | - $defaultValues = $wgConf->getDefaultsForWiki( $this->mWiki ); |
| 749 | + $defaultValues = $wgConf->getDefaultsForWiki( $this->mWiki ); |
765 | 750 | foreach ( $defaultValues as $name => $default ) { |
766 | 751 | ## Normalise the two, to avoid false "changes" |
767 | 752 | if ( is_array( $default ) ) { |
768 | | - try { |
769 | | - $default = WebConfiguration::filterVar( $default ); |
770 | | - } catch( Exception $e ) { |
771 | | - throw new MWException( $name ); |
772 | | - } |
| 753 | + $default = WebConfiguration::filterVar( $default ); |
773 | 754 | } |
774 | 755 | |
775 | 756 | if ( isset( $settings[$name] ) ) { |
— | — | @@ -1005,8 +986,11 @@ |
1006 | 987 | if ( !$allowed ) |
1007 | 988 | return '<code>' . htmlspecialchars( $default ) . '</code>'; |
1008 | 989 | $ret = "\n"; |
| 990 | + var_dump( $default ); |
1009 | 991 | foreach ( $type as $val => $name ) { |
1010 | | - $ret .= Xml::radioLabel( $name, 'wp' . $conf, $val, 'wp' . $conf . $val, strval($default) === strval($val) ) . "\n"; |
| 992 | + $checked = is_int( $val ) ? |
| 993 | + $val === (int)$default : strval($default) === strval($val); |
| 994 | + $ret .= Xml::radioLabel( $name, 'wp' . $conf, $val, 'wp' . $conf . $val, $checked ) . "\n"; |
1011 | 995 | } |
1012 | 996 | return $ret; |
1013 | 997 | } |
Index: trunk/extensions/Configure/Configure.settings-core.php |
— | — | @@ -668,18 +668,18 @@ |
669 | 669 | 'wgAutoloadClasses' => 'array', |
670 | 670 | 'wgAvailableRights' => 'array', |
671 | 671 | 'wgDisableInternalSearch' => 'bool', |
672 | | -# 'wgExceptionHooks' => 'array', |
| 672 | + 'wgExceptionHooks' => 'array', |
673 | 673 | 'wgExtensionAliasesFiles' => 'array', |
674 | 674 | 'wgExtensionCredits' => 'array', |
675 | | -# 'wgExtensionFunctions' => 'array', |
| 675 | + 'wgExtensionFunctions' => 'array', |
676 | 676 | 'wgExtensionMessagesFiles' => 'array', |
677 | 677 | 'wgExternalStores' => 'array', |
678 | | -# 'wgHooks' => 'array', |
| 678 | + 'wgHooks' => 'array', |
679 | 679 | 'wgPagePropLinkInvalidations' => 'array', |
680 | | -# 'wgParserOutputHooks' => 'array', |
681 | | -# 'wgSpecialPageCacheUpdates' => 'array', |
| 680 | + 'wgParserOutputHooks' => 'array', |
| 681 | + 'wgSpecialPageCacheUpdates' => 'array', |
682 | 682 | 'wgSpecialPages' => 'array', |
683 | | -# 'wgSkinExtensionFunctions' => 'array', |
| 683 | + 'wgSkinExtensionFunctions' => 'array', |
684 | 684 | ), |
685 | 685 | ), |
686 | 686 | 'search' => array( |
Index: trunk/extensions/Configure/Configure.settings.php |
— | — | @@ -177,20 +177,59 @@ |
178 | 178 | * @return array |
179 | 179 | */ |
180 | 180 | public function getUneditableSettings() { |
| 181 | + if ( isset( $this->cache['uneditable'] ) ) |
| 182 | + return $this->cache['uneditable']; |
| 183 | + |
181 | 184 | $this->loadSettingsDefs(); |
182 | | - $ret = array(); |
| 185 | + $notEditable = array(); |
183 | 186 | if ( ( $this->types & CONF_SETTINGS_CORE ) == CONF_SETTINGS_CORE ) { |
184 | | - $ret += $this->notEditableSettings; |
| 187 | + $notEditable += $this->notEditableSettings; |
185 | 188 | } |
186 | 189 | if ( ( $this->types & CONF_SETTINGS_EXT ) == CONF_SETTINGS_EXT ) { |
187 | | - $ret += array(); // Nothing for extensions |
| 190 | + $notEditable += array(); // Nothing for extensions |
188 | 191 | } |
189 | | - global $wgConf; |
190 | | - $ret = array_merge( $ret, $wgConf->getUneditableSettings() ); |
191 | | - return $ret; |
| 192 | + |
| 193 | + global $wgConf, $wgConfigureNotEditableSettings, $wgConfigureEditableSettings; |
| 194 | + $notEditable = array_merge( $notEditable, $wgConf->getUneditableSettings() ); |
| 195 | + |
| 196 | + if ( !count( $wgConfigureNotEditableSettings ) && count( $wgConfigureEditableSettings ) ) { |
| 197 | + $wgConfigureNotEditableSettings = array_diff( array_keys( $this->getAllSettings() ), $wgConfigureEditableSettings ); |
| 198 | + } |
| 199 | + |
| 200 | + $notEditable = array_merge( $notEditable, |
| 201 | + $wgConfigureNotEditableSettings ); |
| 202 | + |
| 203 | + return $this->cache['uneditable'] = $notEditable; |
192 | 204 | } |
193 | 205 | |
194 | 206 | /** |
| 207 | + * Get a list of editable settings |
| 208 | + * |
| 209 | + * @return array |
| 210 | + */ |
| 211 | + public function getEditableSettings() { |
| 212 | + if ( isset( $this->cache['editable'] ) ) |
| 213 | + return $this->cache['editable']; |
| 214 | + |
| 215 | + $this->cache['editable'] = array(); |
| 216 | + $this->loadSettingsDefs(); |
| 217 | + |
| 218 | + global $wgConfigureEditableSettings; |
| 219 | + if( count( $wgConfigureEditableSettings ) ) { |
| 220 | + foreach( $wgConfigureEditableSettings as $setting ) { |
| 221 | + $this->cache['editable'][$setting] = $this->getSettingType( $setting ); |
| 222 | + } |
| 223 | + return $this->cache['editable']; |
| 224 | + } |
| 225 | + |
| 226 | + $notEdit = $this->getUneditableSettings(); |
| 227 | + $settings = $this->getAllSettings(); |
| 228 | + foreach ( $notEdit as $setting ) |
| 229 | + unset( $settings[$setting] ); |
| 230 | + return $this->cache['editable'] = $settings; |
| 231 | + } |
| 232 | + |
| 233 | + /** |
195 | 234 | * Get the list of all arrays settings, mapping setting name to its type |
196 | 235 | * |
197 | 236 | * @return array |
Index: trunk/extensions/Configure/Configure.obj.php |
— | — | @@ -78,14 +78,14 @@ |
79 | 79 | public function snapshotDefaults( /* options */ ) { |
80 | 80 | $options = func_get_args(); |
81 | 81 | $noOverride = in_array( 'no_override', $options ); |
82 | | - if( !is_array($this->mDefaults) || in_array('allow_empty',$options) ) { |
| 82 | + if( !is_array( $this->mDefaults ) || in_array( 'allow_empty', $options ) ) { |
83 | 83 | if( !is_array( $this->mDefaults ) ) { |
84 | 84 | $this->mDefaults = array(); |
85 | 85 | } |
86 | | - $allSettings = ConfigurationSettings::singleton( CONF_SETTINGS_BOTH )->getAllSettings(); |
| 86 | + $allSettings = ConfigurationSettings::singleton( CONF_SETTINGS_BOTH )->getEditableSettings(); |
87 | 87 | foreach( $allSettings as $setting => $type ) { |
88 | | - if( array_key_exists($setting,$GLOBALS) && |
89 | | - !( $noOverride && array_key_exists($setting,$this->mDefaults) ) ) |
| 88 | + if( array_key_exists( $setting, $GLOBALS ) && |
| 89 | + !( $noOverride && array_key_exists( $setting, $this->mDefaults ) ) ) |
90 | 90 | { |
91 | 91 | $this->mDefaults[$setting] = $GLOBALS[$setting]; |
92 | 92 | } |