Index: trunk/extensions/Configure/Configure.obj.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | * @ingroup Extensions |
9 | 9 | */ |
10 | 10 | class WebConfiguration extends SiteConfiguration { |
11 | | - protected $mHandler; // Configuration handler |
| 11 | + protected $mHandler = null; // Configuration handler |
12 | 12 | protected $mWiki; // Wiki name |
13 | 13 | protected $mConf = array(); // Our array of settings |
14 | 14 | protected $mOldSettings = null; // Old settings (before applying our overrides) |
— | — | @@ -20,9 +20,6 @@ |
21 | 21 | * files |
22 | 22 | */ |
23 | 23 | public function __construct( $wiki = 'default' ) { |
24 | | - global $wgConfigureHandler; |
25 | | - $class = 'ConfigureHandler' . ucfirst( $wgConfigureHandler ); |
26 | | - $this->mHandler = new $class(); |
27 | 24 | $this->mWiki = $wiki; |
28 | 25 | } |
29 | 26 | |
— | — | @@ -38,7 +35,7 @@ |
39 | 36 | if ( defined( 'EXT_CONFIGURE_NO_EXTRACT' ) ) |
40 | 37 | return; |
41 | 38 | |
42 | | - $this->mConf = $this->mHandler->getCurrent( $useCache ); |
| 39 | + $this->mConf = $this->getHandler()->getCurrent( $useCache ); |
43 | 40 | |
44 | 41 | # Restore first version of $this->settings if called a second time so |
45 | 42 | # that it doesn't duplicate arrays |
— | — | @@ -155,6 +152,21 @@ |
156 | 153 | } |
157 | 154 | |
158 | 155 | /** |
| 156 | + * Get the configuration handler |
| 157 | + * Used for lasy-loading |
| 158 | + * |
| 159 | + * @return ConfigureHandler object |
| 160 | + */ |
| 161 | + public function getHandler() { |
| 162 | + if ( !is_object( $this->mHandler ) ) { |
| 163 | + global $wgConfigureHandler; |
| 164 | + $class = 'ConfigureHandler' . ucfirst( $wgConfigureHandler ); |
| 165 | + $this->mHandler = new $class(); |
| 166 | + } |
| 167 | + return $this->mHandler; |
| 168 | + } |
| 169 | + |
| 170 | + /** |
159 | 171 | * Return the old configuration from $ts timestamp |
160 | 172 | * Does *not* return site specific settings but *all* settings |
161 | 173 | * |
— | — | @@ -164,7 +176,7 @@ |
165 | 177 | public function getOldSettings( $ts ) { |
166 | 178 | if ( $ts == 'default' ) |
167 | 179 | return array( 'default' => $this->getDefaults() ); |
168 | | - return $this->mHandler->getOldSettings( $ts ); |
| 180 | + return $this->getHandler()->getOldSettings( $ts ); |
169 | 181 | } |
170 | 182 | |
171 | 183 | /** |
— | — | @@ -174,7 +186,7 @@ |
175 | 187 | * @return array |
176 | 188 | */ |
177 | 189 | public function getWikisInVersion( $ts ) { |
178 | | - return $this->mHandler->getWikisInVersion( $ts ); |
| 190 | + return $this->getHandler()->getWikisInVersion( $ts ); |
179 | 191 | } |
180 | 192 | |
181 | 193 | /** Recursive doohicky for normalising variables so we can compare them. */ |
— | — | @@ -196,7 +208,7 @@ |
197 | 209 | * @return Pager |
198 | 210 | */ |
199 | 211 | public function getPager() { |
200 | | - return $this->mHandler->getPager(); |
| 212 | + return $this->getHandler()->getPager(); |
201 | 213 | } |
202 | 214 | |
203 | 215 | /** |
— | — | @@ -284,7 +296,7 @@ |
285 | 297 | $this->mConf[$wiki] = $settings; |
286 | 298 | } |
287 | 299 | |
288 | | - return $this->mHandler->saveNewSettings( $this->mConf, $wiki, false, $reason ); |
| 300 | + return $this->getHandler()->saveNewSettings( $this->mConf, $wiki, false, $reason ); |
289 | 301 | } |
290 | 302 | |
291 | 303 | /** |
— | — | @@ -294,7 +306,7 @@ |
295 | 307 | * @return array of timestamps |
296 | 308 | */ |
297 | 309 | public function listArchiveVersions( $options = array() ) { |
298 | | - return $this->mHandler->listArchiveVersions( $options ); |
| 310 | + return $this->getHandler()->listArchiveVersions( $options ); |
299 | 311 | } |
300 | 312 | |
301 | 313 | /** |
— | — | @@ -305,14 +317,14 @@ |
306 | 318 | * @return Array of versions |
307 | 319 | */ |
308 | 320 | public function getArchiveVersions( $options = array() ) { |
309 | | - return $this->mHandler->getArchiveVersions( $options ); |
| 321 | + return $this->getHandler()->getArchiveVersions( $options ); |
310 | 322 | } |
311 | 323 | |
312 | 324 | /** |
313 | 325 | * Do some checks |
314 | 326 | */ |
315 | 327 | public function doChecks() { |
316 | | - return $this->mHandler->doChecks(); |
| 328 | + return $this->getHandler()->doChecks(); |
317 | 329 | } |
318 | 330 | |
319 | 331 | /** |
— | — | @@ -320,7 +332,7 @@ |
321 | 333 | * @return array |
322 | 334 | */ |
323 | 335 | public function getUneditableSettings() { |
324 | | - return $this->mHandler->getUneditableSettings(); |
| 336 | + return $this->getHandler()->getUneditableSettings(); |
325 | 337 | } |
326 | 338 | |
327 | 339 | /** |
— | — | @@ -330,7 +342,7 @@ |
331 | 343 | * @return bool |
332 | 344 | */ |
333 | 345 | public function versionExists( $ts ) { |
334 | | - return $this->mHandler->versionExists( $ts ); |
| 346 | + return $this->getHandler()->versionExists( $ts ); |
335 | 347 | } |
336 | 348 | |
337 | 349 | /** |
— | — | @@ -343,14 +355,6 @@ |
344 | 356 | } |
345 | 357 | |
346 | 358 | /** |
347 | | - * Get the configuration handler |
348 | | - * @return ConfigurationHandler |
349 | | - */ |
350 | | - public function getHandler() { |
351 | | - return $this->mHandler; |
352 | | - } |
353 | | - |
354 | | - /** |
355 | 359 | * Merge array settings |
356 | 360 | * TODO: document! |
357 | 361 | * @return Array |