Index: trunk/phase3/includes/installer/LocalSettingsGenerator.php |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | 'wgDBtype', 'wgSecretKey', 'wgRightsUrl', 'wgSitename', 'wgRightsIcon', |
47 | 47 | 'wgRightsText', 'wgRightsCode', 'wgMainCacheType', 'wgEnableUploads', |
48 | 48 | 'wgMainCacheType', '_MemCachedServers', 'wgDBserver', 'wgDBuser', |
49 | | - 'wgDBpassword', 'wgUseInstantCommons' |
| 49 | + 'wgDBpassword', 'wgUseInstantCommons', 'wgUpgradeKey' |
50 | 50 | ), |
51 | 51 | $db->getGlobalNames() |
52 | 52 | ); |
— | — | @@ -291,6 +291,10 @@ |
292 | 292 | |
293 | 293 | \$wgSecretKey = \"{$this->values['wgSecretKey']}\"; |
294 | 294 | |
| 295 | +# Site upgrade key. Must be set to a string (default provided) to turn on the |
| 296 | +# web installer while LocalSettings.php is in place |
| 297 | +#\$wgUpgradeKey = \"{$this->values['wgUpgradeKey']}\"; |
| 298 | + |
295 | 299 | ## Default skin: you can change the default skin. Use the internal symbolic |
296 | 300 | ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook', 'vector': |
297 | 301 | \$wgDefaultSkin = 'vector'; |
Index: trunk/phase3/includes/installer/CoreInstaller.php |
— | — | @@ -48,6 +48,7 @@ |
49 | 49 | 'wgShellLocale', |
50 | 50 | 'wgSecretKey', |
51 | 51 | 'wgUseInstantCommons', |
| 52 | + 'wgUpgradeKey', |
52 | 53 | ); |
53 | 54 | |
54 | 55 | /** |
— | — | @@ -307,6 +308,7 @@ |
308 | 309 | array( 'name' => 'tables', 'callback' => array( $this, 'installTables' ) ), |
309 | 310 | array( 'name' => 'interwiki', 'callback' => array( $installer, 'populateInterwikiTable' ) ), |
310 | 311 | array( 'name' => 'secretkey', 'callback' => array( $this, 'generateSecretKey' ) ), |
| 312 | + array( 'name' => 'upgradekey', 'callback' => array( $this, 'generateUpgradeKey' ) ), |
311 | 313 | array( 'name' => 'sysop', 'callback' => array( $this, 'createSysop' ) ), |
312 | 314 | array( 'name' => 'mainpage', 'callback' => array( $this, 'createMainpage' ) ), |
313 | 315 | ); |
— | — | @@ -397,6 +399,19 @@ |
398 | 400 | } |
399 | 401 | |
400 | 402 | /** |
| 403 | + * Generate a default $wgUpradeKey, using a semi-random 8 character portion |
| 404 | + * of md5($wgSecretKey) |
| 405 | + * |
| 406 | + * @return Status |
| 407 | + */ |
| 408 | + protected function generateUpgradeKey() { |
| 409 | + $secret = md5( $this->getVar( 'wgSecretKey' ) ); |
| 410 | + $randPos = mt_rand( 0, strlen( $secret ) - 8 ); |
| 411 | + $this->setVar( 'wgUpgradeKey', substr( $secret, $randPos, $randPos + 8 ) ); |
| 412 | + return Status::newGood(); |
| 413 | + } |
| 414 | + |
| 415 | + /** |
401 | 416 | * Create the first user account, grant it sysop and bureaucrat rights |
402 | 417 | * |
403 | 418 | * @return Status |
Index: trunk/phase3/includes/installer/Installer.i18n.php |
— | — | @@ -474,6 +474,7 @@ |
475 | 475 | 'config-install-secretkey' => 'Generating secret key', |
476 | 476 | 'config-insecure-secretkey' => "'''Warning:''' Unable to create secure <code>\$wgSecretKey</code>. |
477 | 477 | Consider changing it manually.", |
| 478 | + 'config-install-upgradekey' => 'Generating default upgrade key', |
478 | 479 | 'config-install-sysop' => 'Creating administrator user account', |
479 | 480 | 'config-install-mainpage' => 'Creating main page with default content', |
480 | 481 | 'config-install-mainpage-failed' => 'Could not insert main page.', |