r62524 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62523‎ | r62524 | r62525 >
Date:16:14, 15 February 2010
Author:ialex
Status:deferred
Tags:
Comment:
* Added $wgConfigureDisabledExtensions to be able to disable some extensions
Modified paths:
  • /trunk/extensions/Configure/CHANGELOG (modified) (history)
  • /trunk/extensions/Configure/Configure.api.php (modified) (history)
  • /trunk/extensions/Configure/Configure.php (modified) (history)
  • /trunk/extensions/Configure/settings/ConfigurationSettings.php (modified) (history)
  • /trunk/extensions/Configure/settings/WebExtension.php (modified) (history)
  • /trunk/extensions/Configure/specials/SpecialExtensions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Configure/Configure.api.php
@@ -109,7 +109,7 @@
110110 $conf = ConfigurationSettings::singleton( CONF_SETTINGS_EXT );
111111 $ret = array();
112112 foreach ( $conf->getAllExtensionsObjects() as $ext ) {
113 - if( !$ext->isInstalled() ) continue; // must exist
 113+ if( !$ext->isUsable() ) continue; // must exist
114114 $extArr = array();
115115 $extArr['name'] = $ext->getName();
116116 if ( $ext->isActivated() )
Index: trunk/extensions/Configure/CHANGELOG
@@ -1,6 +1,9 @@
22 This file lists changes on this extension.
33 Localisation updates are done on betawiki and aren't listed here.
44
 5+0.15.8 - 15 February 2010
 6+ Added $wgConfigureDisabledExtensions to be able to disable some extensions.
 7+
58 0.15.7 - 14 February 2010
69 Updated InspectCache, PurgeCache and Watchers extensions.
710
Index: trunk/extensions/Configure/settings/WebExtension.php
@@ -177,7 +177,7 @@
178178 * @return String: XHTML
179179 */
180180 public function getHtml() {
181 - if ( !$this->isInstalled() )
 181+ if ( !$this->isUsable() )
182182 return '';
183183 $ret = '<fieldset><legend>' . htmlspecialchars( $this->mName ) . '</legend>';
184184 if ( count( $errors = $this->checkSettingsDependencies() ) ) {
@@ -287,25 +287,25 @@
288288 * should be activated
289289 */
290290 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 );
295295 }
296296
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+ }
303303
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+ }
310310
311311 public function setTempActivated( $val = null ) {
312312 return wfSetVar( $this->mTempActivated, $val );
@@ -320,11 +320,11 @@
321321 if( $this->mTempActivated !== null ) {
322322 return $this->mTempActivated;
323323 } 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+ }
329329 }
330330
331331 /**
@@ -333,13 +333,33 @@
334334 * @return Boolean
335335 */
336336 public function isInstalled() {
337 - if( $this->useVariable() ) {
338 - return true;
 337+ if( $this->useVariable() ) {
 338+ return true;
339339 }
340 - global $wgConfigureOnlyUseVarForExt;
341 - if( $wgConfigureOnlyUseVarForExt ) {
342 - return false;
 340+ global $wgConfigureOnlyUseVarForExt;
 341+ if( $wgConfigureOnlyUseVarForExt ) {
 342+ return false;
343343 }
344344 return file_exists( $this->getFile() );
345345 }
 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+ }
346366 }
Index: trunk/extensions/Configure/settings/ConfigurationSettings.php
@@ -124,7 +124,7 @@
125125 if( is_null( $extArr ) ) {
126126 $extArr = array();
127127 foreach( $this->getAllExtensionsObjects() as $ext ) {
128 - if( !$ext->isInstalled() )
 128+ if( !$ext->isUsable() )
129129 continue;
130130 $extSettings = $ext->getSettings();
131131 if( $ext->useVariable() )
Index: trunk/extensions/Configure/specials/SpecialExtensions.php
@@ -92,7 +92,7 @@
9393 return array();
9494 $arr = array();
9595 foreach ( $this->mConfSettings->getAllExtensionsObjects() as $ext ) {
96 - if( !$ext->isInstalled() )
 96+ if( !$ext->isUsable() )
9797 continue; // must exist
9898 if ( $ext->useVariable() )
9999 continue;
@@ -127,8 +127,8 @@
128128 $ret = '';
129129 $globalDone = false;
130130 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
133133
134134 $wikiExt->setPageObj( $this );
135135
Index: trunk/extensions/Configure/Configure.php
@@ -18,7 +18,7 @@
1919 'url' => 'http://www.mediawiki.org/wiki/Extension:Configure',
2020 'description' => 'Allow authorised users to configure the wiki via a web-based interface',
2121 'descriptionmsg' => 'configure-desc',
22 - 'version' => '0.15.7',
 22+ 'version' => '0.15.8',
2323 );
2424
2525 # Configuration part
@@ -99,6 +99,11 @@
100100 $wgConfigureAdditionalExtensions = array();
101101
102102 /**
 103+ * List of disabled extensions
 104+ */
 105+$wgConfigureDisabledExtensions = array();
 106+
 107+/**
103108 * Allows to enable an extension by setting a variable instead of directly
104109 * include the file.
105110 * You'll need to handle the variable and include yourself the extension's file.

Status & tagging log