Index: trunk/extensions/Configure/Configure.api.php |
— | — | @@ -109,7 +109,7 @@ |
110 | 110 | $conf = ConfigurationSettings::singleton( CONF_SETTINGS_EXT ); |
111 | 111 | $ret = array(); |
112 | 112 | foreach ( $conf->getAllExtensionsObjects() as $ext ) { |
113 | | - if( !$ext->isInstalled() ) continue; // must exist |
| 113 | + if( !$ext->isUsable() ) continue; // must exist |
114 | 114 | $extArr = array(); |
115 | 115 | $extArr['name'] = $ext->getName(); |
116 | 116 | if ( $ext->isActivated() ) |
Index: trunk/extensions/Configure/CHANGELOG |
— | — | @@ -1,6 +1,9 @@ |
2 | 2 | This file lists changes on this extension. |
3 | 3 | Localisation updates are done on betawiki and aren't listed here. |
4 | 4 | |
| 5 | +0.15.8 - 15 February 2010 |
| 6 | + Added $wgConfigureDisabledExtensions to be able to disable some extensions. |
| 7 | + |
5 | 8 | 0.15.7 - 14 February 2010 |
6 | 9 | Updated InspectCache, PurgeCache and Watchers extensions. |
7 | 10 | |
Index: trunk/extensions/Configure/settings/WebExtension.php |
— | — | @@ -177,7 +177,7 @@ |
178 | 178 | * @return String: XHTML |
179 | 179 | */ |
180 | 180 | public function getHtml() { |
181 | | - if ( !$this->isInstalled() ) |
| 181 | + if ( !$this->isUsable() ) |
182 | 182 | return ''; |
183 | 183 | $ret = '<fieldset><legend>' . htmlspecialchars( $this->mName ) . '</legend>'; |
184 | 184 | if ( count( $errors = $this->checkSettingsDependencies() ) ) { |
— | — | @@ -287,25 +287,25 @@ |
288 | 288 | * should be activated |
289 | 289 | */ |
290 | 290 | public function getCheckName() { |
291 | | - if( $this->useVariable() ) |
292 | | - return 'wp'.$this->mExtVar; |
293 | | - else |
294 | | - return 'wpUse'.str_replace( ' ', '_', $this->mName ); |
| 291 | + if( $this->useVariable() ) |
| 292 | + return 'wp'.$this->mExtVar; |
| 293 | + else |
| 294 | + return 'wpUse'.str_replace( ' ', '_', $this->mName ); |
295 | 295 | } |
296 | 296 | |
297 | | - /** |
298 | | - * Whether this extension |
299 | | - */ |
300 | | - public function useVariable(){ |
301 | | - return !is_null( $this->mExtVar ); |
302 | | - } |
| 297 | + /** |
| 298 | + * Whether this extension |
| 299 | + */ |
| 300 | + public function useVariable(){ |
| 301 | + return !is_null( $this->mExtVar ); |
| 302 | + } |
303 | 303 | |
304 | | - /** |
305 | | - * Get the variable for this extension |
306 | | - */ |
307 | | - public function getVariable(){ |
308 | | - return $this->mExtVar; |
309 | | - } |
| 304 | + /** |
| 305 | + * Get the variable for this extension |
| 306 | + */ |
| 307 | + public function getVariable(){ |
| 308 | + return $this->mExtVar; |
| 309 | + } |
310 | 310 | |
311 | 311 | public function setTempActivated( $val = null ) { |
312 | 312 | return wfSetVar( $this->mTempActivated, $val ); |
— | — | @@ -320,11 +320,11 @@ |
321 | 321 | if( $this->mTempActivated !== null ) { |
322 | 322 | return $this->mTempActivated; |
323 | 323 | } else if( $this->useVariable() ) { |
324 | | - return isset( $GLOBALS[$this->getVariable()] ) && $GLOBALS[$this->getVariable()]; |
325 | | - } else { |
326 | | - global $wgConf; |
327 | | - return in_array( $this->getFile(), $wgConf->getIncludedFiles() ); |
328 | | - } |
| 324 | + return isset( $GLOBALS[$this->getVariable()] ) && $GLOBALS[$this->getVariable()]; |
| 325 | + } else { |
| 326 | + global $wgConf; |
| 327 | + return in_array( $this->getFile(), $wgConf->getIncludedFiles() ); |
| 328 | + } |
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
— | — | @@ -333,13 +333,33 @@ |
334 | 334 | * @return Boolean |
335 | 335 | */ |
336 | 336 | public function isInstalled() { |
337 | | - if( $this->useVariable() ) { |
338 | | - return true; |
| 337 | + if( $this->useVariable() ) { |
| 338 | + return true; |
339 | 339 | } |
340 | | - global $wgConfigureOnlyUseVarForExt; |
341 | | - if( $wgConfigureOnlyUseVarForExt ) { |
342 | | - return false; |
| 340 | + global $wgConfigureOnlyUseVarForExt; |
| 341 | + if( $wgConfigureOnlyUseVarForExt ) { |
| 342 | + return false; |
343 | 343 | } |
344 | 344 | return file_exists( $this->getFile() ); |
345 | 345 | } |
| 346 | + |
| 347 | + /** |
| 348 | + * Is this extension disabled? |
| 349 | + * |
| 350 | + * @return Boolean |
| 351 | + */ |
| 352 | + public function isDisabled() { |
| 353 | + global $wgConfigureDisabledExtensions; |
| 354 | + |
| 355 | + return in_array( $this->mName, $wgConfigureDisabledExtensions ); |
| 356 | + } |
| 357 | + |
| 358 | + /** |
| 359 | + * Can this extension be enabled? |
| 360 | + * |
| 361 | + * @return Boolean |
| 362 | + */ |
| 363 | + public function isUsable() { |
| 364 | + return $this->isInstalled() && !$this->isDisabled(); |
| 365 | + } |
346 | 366 | } |
Index: trunk/extensions/Configure/settings/ConfigurationSettings.php |
— | — | @@ -124,7 +124,7 @@ |
125 | 125 | if( is_null( $extArr ) ) { |
126 | 126 | $extArr = array(); |
127 | 127 | foreach( $this->getAllExtensionsObjects() as $ext ) { |
128 | | - if( !$ext->isInstalled() ) |
| 128 | + if( !$ext->isUsable() ) |
129 | 129 | continue; |
130 | 130 | $extSettings = $ext->getSettings(); |
131 | 131 | if( $ext->useVariable() ) |
Index: trunk/extensions/Configure/specials/SpecialExtensions.php |
— | — | @@ -92,7 +92,7 @@ |
93 | 93 | return array(); |
94 | 94 | $arr = array(); |
95 | 95 | foreach ( $this->mConfSettings->getAllExtensionsObjects() as $ext ) { |
96 | | - if( !$ext->isInstalled() ) |
| 96 | + if( !$ext->isUsable() ) |
97 | 97 | continue; // must exist |
98 | 98 | if ( $ext->useVariable() ) |
99 | 99 | continue; |
— | — | @@ -127,8 +127,8 @@ |
128 | 128 | $ret = ''; |
129 | 129 | $globalDone = false; |
130 | 130 | foreach ( $this->mConfSettings->getAllExtensionsObjects() as $wikiExt ) { |
131 | | - if( !$wikiExt->isInstalled() ) |
132 | | - continue; // must exist |
| 131 | + if( !$wikiExt->isUsable() ) |
| 132 | + continue; // must exist and be enabled |
133 | 133 | |
134 | 134 | $wikiExt->setPageObj( $this ); |
135 | 135 | |
Index: trunk/extensions/Configure/Configure.php |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | 'url' => 'http://www.mediawiki.org/wiki/Extension:Configure', |
20 | 20 | 'description' => 'Allow authorised users to configure the wiki via a web-based interface', |
21 | 21 | 'descriptionmsg' => 'configure-desc', |
22 | | - 'version' => '0.15.7', |
| 22 | + 'version' => '0.15.8', |
23 | 23 | ); |
24 | 24 | |
25 | 25 | # Configuration part |
— | — | @@ -99,6 +99,11 @@ |
100 | 100 | $wgConfigureAdditionalExtensions = array(); |
101 | 101 | |
102 | 102 | /** |
| 103 | + * List of disabled extensions |
| 104 | + */ |
| 105 | +$wgConfigureDisabledExtensions = array(); |
| 106 | + |
| 107 | +/** |
103 | 108 | * Allows to enable an extension by setting a variable instead of directly |
104 | 109 | * include the file. |
105 | 110 | * You'll need to handle the variable and include yourself the extension's file. |