Index: trunk/extensions/Configure/CHANGELOG |
— | — | @@ -1,14 +1,19 @@ |
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.10.9 - 27 November 2008 |
| 6 | + Added $wgConfigureExtensionsVar and $wgConfigureOnlyUseVarForExt to allow |
| 7 | + enabling extensions by setting a variable rather than directly include the |
| 8 | + file. |
| 9 | + |
5 | 10 | 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:ViewConfig. |
8 | | - * Introduced explicit whitelisting of settings, rather than blacklisting |
9 | | - of other settings. |
10 | | - * Some usability cleanup. |
11 | | - * Fixed javascript bug with 'Delete this entry' buttons in previous version. |
12 | | - * Fixed type of $wgRightsUrl |
| 11 | + * Stopped displaying settings which can't be edited in Special:Configure. |
| 12 | + These can be viewed at Special:ViewConfig. |
| 13 | + * Introduced explicit whitelisting of settings, rather than blacklisting |
| 14 | + of other settings. |
| 15 | + * Some usability cleanup. |
| 16 | + * Fixed javascript bug with 'Delete this entry' buttons in previous version. |
| 17 | + * Fixed type of $wgRightsUrl |
13 | 18 | |
14 | 19 | 0.10.7 - 25 November 2008 |
15 | 20 | * Added diff links for the versions at the top of Special:Configure and |
Index: trunk/extensions/Configure/Configure.settings.php |
— | — | @@ -97,9 +97,11 @@ |
98 | 98 | if ( !isset( $extArr ) ) { |
99 | 99 | $extArr = array(); |
100 | 100 | foreach ( $this->getAllExtensionsObjects() as $ext ) { |
101 | | - $name = $ext->getName(); |
102 | | - if ( count( $ext->getSettings() ) ) |
103 | | - $extArr['mw-extensions'][$name] = $ext->getSettings(); |
| 101 | + $extSettings = $ext->getSettings(); |
| 102 | + if ( $ext->useVariable() ) |
| 103 | + $extSettings[$ext->getVariable()] = 'bool'; |
| 104 | + if ( count( $extSettings ) ) |
| 105 | + $extArr['mw-extensions'][$ext->getName()] = $extSettings; |
104 | 106 | } |
105 | 107 | } |
106 | 108 | $ret += $extArr; |
Index: trunk/extensions/Configure/Configure.ext.php |
— | — | @@ -18,6 +18,7 @@ |
19 | 19 | protected $mDir; |
20 | 20 | protected $mFile; |
21 | 21 | protected $mDoc; |
| 22 | + protected $mExtVar = null; |
22 | 23 | |
23 | 24 | /** |
24 | 25 | * Construct a new object. |
— | — | @@ -25,6 +26,8 @@ |
26 | 27 | * @param array $conf |
27 | 28 | */ |
28 | 29 | public function __construct( /*array*/ $conf ) { |
| 30 | + global $wgConfigureExtensionsVar; |
| 31 | + |
29 | 32 | $this->mName = $conf['name']; |
30 | 33 | $this->mSettings = isset( $conf['settings'] ) ? $conf['settings'] : array(); |
31 | 34 | $this->mDbChange = isset( $conf['schema'] ) && $conf['schema']; |
— | — | @@ -35,6 +38,9 @@ |
36 | 39 | $this->mViewRestricted = isset( $conf['view-restricted'] ) ? $conf['view-restricted'] : array(); |
37 | 40 | $this->mEditRestricted = isset( $conf['edit-restricted'] ) ? $conf['edit-restricted'] : array(); |
38 | 41 | $this->mDoc = isset( $conf['url'] ) ? $conf['url'] : null; |
| 42 | + if ( isset( $wgConfigureExtensionsVar[$this->mName] ) ) { |
| 43 | + $this->mExtVar = $wgConfigureExtensionsVar[$this->mName]; |
| 44 | + } |
39 | 45 | } |
40 | 46 | |
41 | 47 | /** |
— | — | @@ -177,17 +183,38 @@ |
178 | 184 | * should be activated |
179 | 185 | */ |
180 | 186 | public function getCheckName() { |
181 | | - return 'wpUse' . $this->mName; |
| 187 | + if( $this->useVariable() ) |
| 188 | + return 'wp'.$this->mExtVar; |
| 189 | + else |
| 190 | + return 'wpUse'.$this->mName; |
182 | 191 | } |
183 | 192 | |
| 193 | + /** |
| 194 | + * Whether this extension |
| 195 | + */ |
| 196 | + public function useVariable(){ |
| 197 | + return !is_null( $this->mExtVar ); |
| 198 | + } |
| 199 | + |
| 200 | + /** |
| 201 | + * Get the varibale for this extension |
| 202 | + */ |
| 203 | + public function getVariable(){ |
| 204 | + return $this->mExtVar; |
| 205 | + } |
| 206 | + |
184 | 207 | /** |
185 | 208 | * Is this extension activated? |
186 | 209 | * |
187 | 210 | * @return bool |
188 | 211 | */ |
189 | 212 | public function isActivated() { |
190 | | - global $wgConf; |
191 | | - return in_array( $this->getFile(), $wgConf->getIncludedFiles() ); |
| 213 | + if( $this->useVariable() ) { |
| 214 | + return isset( $GLOBALS[$this->getVariable()] ) && $GLOBALS[$this->getVariable()]; |
| 215 | + } else { |
| 216 | + global $wgConf; |
| 217 | + return in_array( $this->getFile(), $wgConf->getIncludedFiles() ); |
| 218 | + } |
192 | 219 | } |
193 | 220 | |
194 | 221 | /** |
— | — | @@ -196,6 +223,11 @@ |
197 | 224 | * @return bool |
198 | 225 | */ |
199 | 226 | public function isInstalled() { |
| 227 | + if( $this->useVariable() ) |
| 228 | + return true; |
| 229 | + global $wgConfigureOnlyUseVarForExt; |
| 230 | + if( $wgConfigureOnlyUseVarForExt ) |
| 231 | + return false; |
200 | 232 | return file_exists( $this->getFile() ); |
201 | 233 | } |
202 | 234 | } |
Index: trunk/extensions/Configure/Configure.php |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | if ( !defined( 'MEDIAWIKI' ) ) die(); |
4 | 4 | |
5 | 5 | /** |
6 | | - * Special page to allow users to configure the wiki by a web based interface |
| 6 | + * Special page to allow users to configure the wiki via a web based interface |
7 | 7 | * Require MediaWiki version 1.13.0 or greater |
8 | 8 | * |
9 | 9 | * @file |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | 'url' => 'http://www.mediawiki.org/wiki/Extension:Configure', |
19 | 19 | 'description' => 'Allow authorised users to configure the wiki via a web-based interface', |
20 | 20 | 'descriptionmsg' => 'configure-desc', |
21 | | - 'version' => '0.10.8', |
| 21 | + 'version' => '0.10.9', |
22 | 22 | ); |
23 | 23 | |
24 | 24 | # Configuration part |
— | — | @@ -84,6 +84,21 @@ |
85 | 85 | $wgConfigureAdditionalExtensions = array(); |
86 | 86 | |
87 | 87 | /** |
| 88 | + * Allows to enable an extension by setting a variable instead of directly |
| 89 | + * include the file. |
| 90 | + * You'll need to handle the variable and include yourself the extension's file. |
| 91 | + * Format is $wgConfigureExtensionsVar['ExtensionName'] = 'VarName'; |
| 92 | + */ |
| 93 | +$wgConfigureExtensionsVar = array(); |
| 94 | + |
| 95 | +/** |
| 96 | + * If this true, extensions will be considered as installed *only* if they are |
| 97 | + * defined in $wgConfigureExtensionsVar, Configure won't check anymore for |
| 98 | + * extensions in the file system. |
| 99 | + */ |
| 100 | +$wgConfigureOnlyUseVarForExt = false; |
| 101 | + |
| 102 | +/** |
88 | 103 | * Array of supplementary view restrictions. Format is |
89 | 104 | * $wgConfigureViewRestrictions['wgSetting'] = array( 'right1', 'right2' ); |
90 | 105 | * if multiple rights are given, the user must have *all* of them to see the |
Index: trunk/extensions/Configure/SpecialExtensions.php |
— | — | @@ -54,9 +54,13 @@ |
55 | 55 | * @return array |
56 | 56 | */ |
57 | 57 | protected function getRequiredFiles() { |
58 | | - global $wgRequest; |
| 58 | + global $wgRequest, $wgConfigureOnlyUseVarForExt; |
| 59 | + if ( $wgConfigureOnlyUseVarForExt ) |
| 60 | + return array(); |
59 | 61 | $arr = array(); |
60 | 62 | foreach ( $this->mConfSettings->getAllExtensionsObjects() as $ext ) { |
| 63 | + if ( $ext->useVariable() ) |
| 64 | + continue; |
61 | 65 | if ( $wgRequest->getCheck( $ext->getCheckName() ) ) |
62 | 66 | $arr[] = $ext->getFile(); |
63 | 67 | } |
— | — | @@ -88,7 +92,7 @@ |
89 | 93 | foreach ( $this->mConfSettings->getAllExtensionsObjects() as $ext ) { |
90 | 94 | $settings = $ext->getSettings(); |
91 | 95 | foreach ( $settings as $setting => $type ) { |
92 | | - if ( !isset( $GLOBALS[$setting] ) && !isset( $this->conf[$setting] ) ) { |
| 96 | + if ( !isset( $GLOBALS[$setting] ) && !isset( $this->conf[$setting] ) && file_exists( $ext->getFile() ) ) { |
93 | 97 | if ( !$globalDone ) { |
94 | 98 | extract( $GLOBALS, EXTR_REFS ); |
95 | 99 | $__hooks__ = $wgHooks; |