'wgSecretKey',
'wgUseInstantCommons',
'wgUpgradeKey',
+ 'wgDefaultSkin',
);
/**
'_CCDone' => false,
'_Extensions' => array(),
'_MemCachedServers' => '',
- '_ExternalHTTP' => false,
- '_LocalSettingsLocked' => true,
- '_UpgradeKey' => '',
+ '_UpgradeKeySupplied' => false,
+ '_ExistingDBSettings' => false,
);
/**
/**
* Get an array of install steps. These could be a plain key like the defaults
* in $installSteps, or could be an array with a name and a specific callback
- * There must be a config-install-$step message defined per step, which are
- * shown by the CliInstaller.
+ * There must be a config-install-$step message defined per step, which will
+ * be shown on install.
*
* @param $installer DatabaseInstaller so we can make callbacks
* @return array
array( 'name' => 'mainpage', 'callback' => array( $this, 'createMainpage' ) ),
);
if( count( $this->getVar( '_Extensions' ) ) ) {
- array_unshift( $installSteps,
+ array_unshift( $installSteps,
array( 'name' => 'extensions', 'callback' => array( $this, 'includeExtensions' ) )
);
}
protected function generateSecretKey() {
return $this->generateSecret( 'wgSecretKey' );
}
-
+
/**
- * Generate a secret value for a variable using either
+ * Generate a secret value for a variable using either
* /dev/urandom or mt_rand() Produce a warning in the later case.
*
* @return Status
*/
- protected function generateSecret( $secretName ) {
+ protected function generateSecret( $secretName, $length = 64 ) {
if ( wfIsWindows() ) {
$file = null;
} else {
$status = Status::newGood();
if ( $file ) {
- $secretKey = bin2hex( fread( $file, 32 ) );
+ $secretKey = bin2hex( fread( $file, $length / 2 ) );
fclose( $file );
} else {
$secretKey = '';
- for ( $i=0; $i<8; $i++ ) {
+ for ( $i = 0; $i < $length / 8; $i++ ) {
$secretKey .= dechex( mt_rand( 0, 0x7fffffff ) );
}
}
/**
- * Generate a default $wgUpradeKey, Will warn if we had to use
+ * Generate a default $wgUpgradeKey. Will warn if we had to use
* mt_rand() instead of /dev/urandom
*
* @return Status
*/
- protected function generateUpgradeKey() {
- return $this->generateSecret( 'wgUpgradeKey' );
+ public function generateUpgradeKey() {
+ if ( strval( $this->getVar( 'wgUpgradeKey' ) ) === '' ) {
+ return $this->generateSecret( 'wgUpgradeKey', 16 );
+ }
}
/**
/**
* Insert Main Page with default content.
- *
+ *
* @return Status
*/
protected function createMainpage( DatabaseInstaller &$installer ) {
User::newFromName( 'MediaWiki Default' ) );
} catch (MWException $e) {
//using raw, because $wgShowExceptionDetails can not be set yet
- $status->fatal( 'config-install-mainpage-failed', $e->getMessage() );
+ $status->fatal( 'config-install-mainpage-failed', $e->getMessage() );
}
-
+
return $status;
}
// Allow multiple ob_flush() calls
$GLOBALS['wgDisableOutputCompression'] = true;
+ // Use a sensible cookie prefix (not my_wiki)
+ $GLOBALS['wgCookiePrefix'] = 'mw_installer';
+
// Some of the environment checks make shell requests, remove limits
$GLOBALS['wgMaxShellMemory'] = 0;
}