Index: trunk/extensions/Configure/Configure.obj.php |
— | — | @@ -79,20 +79,23 @@ |
80 | 80 | } |
81 | 81 | |
82 | 82 | public function snapshotDefaults( /* options */ ) { |
| 83 | + wfProfileIn( __METHOD__ ); |
83 | 84 | $options = func_get_args(); |
84 | | - |
85 | | - if ( !is_array($this->mDefaults) || in_array( 'allow_empty', $options ) ) { |
86 | | - if ( !is_array( $this->mDefaults ) ) |
| 85 | + $noOverride = in_array( 'no_override', $options ); |
| 86 | + if( !is_array($this->mDefaults) || in_array('allow_empty',$options) ) { |
| 87 | + if( !is_array( $this->mDefaults ) ) { |
87 | 88 | $this->mDefaults = array(); |
88 | | - |
89 | | - $allSettings = array_keys( ConfigurationSettings::singleton( CONF_SETTINGS_BOTH )->getAllSettings() ); |
90 | | - |
91 | | - foreach( $allSettings as $setting ) { |
92 | | - if ( array_key_exists( $setting, $GLOBALS ) && !( in_array( 'no_override', $options ) && array_key_exists( $setting, $this->mDefaults ) ) ) { |
| 89 | + } |
| 90 | + $allSettings = ConfigurationSettings::singleton( CONF_SETTINGS_BOTH )->getAllSettings(); |
| 91 | + foreach( $allSettings as $setting => $type ) { |
| 92 | + if( array_key_exists($setting,$GLOBALS) && |
| 93 | + !( $noOverride && array_key_exists($setting,$this->mDefaults) ) ) |
| 94 | + { |
93 | 95 | $this->mDefaults[$setting] = $GLOBALS[$setting]; |
94 | 96 | } |
95 | 97 | } |
96 | 98 | } |
| 99 | + wfProfileOut( __METHOD__ ); |
97 | 100 | } |
98 | 101 | |
99 | 102 | /** |
Index: trunk/extensions/Configure/Configure.settings.php |
— | — | @@ -37,8 +37,7 @@ |
38 | 38 | * Load messages and initialise static variables |
39 | 39 | */ |
40 | 40 | protected function loadSettingsDefs() { |
41 | | - if ( $this->initialized ) |
42 | | - return; |
| 41 | + if ( $this->initialized ) return; |
43 | 42 | $this->initialized = true; |
44 | 43 | |
45 | 44 | require( dirname( __FILE__ ) . '/Configure.settings-core.php' ); |
— | — | @@ -60,19 +59,20 @@ |
61 | 60 | * @return array |
62 | 61 | */ |
63 | 62 | public function getAllExtensionsObjects() { |
64 | | - static $list = array(); |
65 | | - if ( !empty( $list ) ) |
66 | | - return $list; |
| 63 | + static $list; |
| 64 | + if( isset($list) ) return $list; |
| 65 | + wfProfileIn( __METHOD__ ); |
67 | 66 | $this->loadSettingsDefs(); |
68 | 67 | global $wgConfigureAdditionalExtensions; |
69 | 68 | $extensions = array_merge( $this->extensions, $wgConfigureAdditionalExtensions ); |
70 | 69 | usort( $extensions, array( __CLASS__, 'compExt' ) ); |
71 | | - foreach ( $extensions as $ext ) { |
| 70 | + foreach( $extensions as $ext ) { |
72 | 71 | $ext = new WebExtension( $ext ); |
73 | | - if ( $ext->isInstalled() ) { |
| 72 | + if( $ext->isInstalled() ) { |
74 | 73 | $list[] = $ext; |
75 | 74 | } |
76 | 75 | } |
| 76 | + wfProfileOut( __METHOD__ ); |
77 | 77 | return $list; |
78 | 78 | } |
79 | 79 | |
— | — | @@ -91,18 +91,18 @@ |
92 | 92 | public function getSettings() { |
93 | 93 | $this->loadSettingsDefs(); |
94 | 94 | $ret = array(); |
95 | | - if ( ( $this->types & CONF_SETTINGS_CORE ) == CONF_SETTINGS_CORE ) { |
96 | | - $ret += $this->settings; |
| 95 | + if( ( $this->types & CONF_SETTINGS_CORE ) == CONF_SETTINGS_CORE ) { |
| 96 | + $ret = $this->settings; |
97 | 97 | } |
98 | | - if ( ( $this->types & CONF_SETTINGS_EXT ) == CONF_SETTINGS_EXT ) { |
| 98 | + if( ( $this->types & CONF_SETTINGS_EXT ) == CONF_SETTINGS_EXT ) { |
99 | 99 | static $extArr; |
100 | | - if ( !isset( $extArr ) ) { |
| 100 | + if( !isset($extArr) ) { |
101 | 101 | $extArr = array(); |
102 | | - foreach ( $this->getAllExtensionsObjects() as $ext ) { |
| 102 | + foreach( $this->getAllExtensionsObjects() as $ext ) { |
103 | 103 | $extSettings = $ext->getSettings(); |
104 | | - if ( $ext->useVariable() ) |
| 104 | + if( $ext->useVariable() ) |
105 | 105 | $extSettings[$ext->getVariable()] = 'bool'; |
106 | | - if ( count( $extSettings ) ) |
| 106 | + if( count( $extSettings ) ) |
107 | 107 | $extArr['mw-extensions'][$ext->getName()] = $extSettings; |
108 | 108 | } |
109 | 109 | } |
— | — | @@ -117,16 +117,20 @@ |
118 | 118 | * @return array |
119 | 119 | */ |
120 | 120 | public function getAllSettings() { |
121 | | - if ( isset( $this->cache['all'] ) ) |
| 121 | + if( isset( $this->cache['all'] ) ) { |
122 | 122 | return $this->cache['all']; |
| 123 | + } |
123 | 124 | $this->loadSettingsDefs(); |
124 | 125 | $arr = array(); |
125 | | - foreach ( $this->getSettings() as $section ) { |
126 | | - foreach ( $section as $group ) { |
127 | | - $arr = array_merge( $arr, $group ); |
| 126 | + foreach( $this->getSettings() as $section ) { |
| 127 | + foreach( $section as $group ) { |
| 128 | + foreach( $group as $var => $type ) { |
| 129 | + $arr[$var] = $type; |
| 130 | + } |
128 | 131 | } |
129 | 132 | } |
130 | | - return $this->cache['all'] = $arr; |
| 133 | + $this->cache['all'] = $arr; |
| 134 | + return $this->cache['all']; |
131 | 135 | } |
132 | 136 | |
133 | 137 | /** |
Index: trunk/extensions/Configure/Configure.ext.php |
— | — | @@ -131,9 +131,6 @@ |
132 | 132 | */ |
133 | 133 | public function getFile() { |
134 | 134 | global $wgConfigureExtDir; |
135 | | - if ( substr( $wgConfigureExtDir, -1 ) != '/' && substr( $wgConfigureExtDir, -1 ) != '\\' ) { |
136 | | - $wgConfigureExtDir .= '/'; |
137 | | - } |
138 | 135 | return $wgConfigureExtDir . $this->mDir . '/' . $this->mFile; |
139 | 136 | } |
140 | 137 | |
— | — | @@ -223,11 +220,13 @@ |
224 | 221 | * @return bool |
225 | 222 | */ |
226 | 223 | public function isInstalled() { |
227 | | - if( $this->useVariable() ) |
| 224 | + if( $this->useVariable() ) { |
228 | 225 | return true; |
| 226 | + } |
229 | 227 | global $wgConfigureOnlyUseVarForExt; |
230 | | - if( $wgConfigureOnlyUseVarForExt ) |
| 228 | + if( $wgConfigureOnlyUseVarForExt ) { |
231 | 229 | return false; |
| 230 | + } |
232 | 231 | return file_exists( $this->getFile() ); |
233 | 232 | } |
234 | 233 | } |
Index: trunk/extensions/Configure/Configure.func.php |
— | — | @@ -57,7 +57,7 @@ |
58 | 58 | * @param $wiki String |
59 | 59 | */ |
60 | 60 | function efConfigureSetup( $wiki = 'default' ) { |
61 | | - global $wgConf, $wgConfigureFilesPath; |
| 61 | + global $wgConf, $wgConfigureFilesPath, $wgConfigureExtDir; |
62 | 62 | wfProfileIn( __FUNCTION__ ); |
63 | 63 | # Create the new configuration object... |
64 | 64 | $oldConf = $wgConf; |
— | — | @@ -81,6 +81,10 @@ |
82 | 82 | } else { |
83 | 83 | efConfigureInitialise(); |
84 | 84 | } |
| 85 | + # Cleanup $wgConfigureExtDir as needed |
| 86 | + if( substr( $wgConfigureExtDir, -1 ) != '/' && substr( $wgConfigureExtDir, -1 ) != '\\' ) { |
| 87 | + $wgConfigureExtDir .= '/'; |
| 88 | + } |
85 | 89 | wfProfileOut( __FUNCTION__ ); |
86 | 90 | } |
87 | 91 | |