* MediaWiki configuration globals that will eventually be passed through
* to LocalSettings.php. The names only are given here, the defaults
* typically come from DefaultSettings.php.
- * @protected
*/
- var $defaultVarNames = array(
+ protected $defaultVarNames = array(
'wgSitename',
'wgPasswordSender',
'wgLanguageCode',
* Variables that are stored alongside globals, and are used for any
* configuration of the installation process aside from the MediaWiki
* configuration. Map of names to defaults.
- * @protected
*/
- var $internalDefaults = array(
+ protected $internalDefaults = array(
'_UserLang' => 'en',
'_Environment' => false,
'_CompiledDBs' => array(),
*
* To add a new type, create a <type>Installer class and a Database<type>
* class, and add a config-type-<type> message to MessagesEn.php.
- * @private
*/
- var $dbTypes = array(
+ private $dbTypes = array(
'mysql',
'postgres',
'sqlite',
/**
* Cached DB installer instances, access using getDBInstaller()
- * @private
*/
- var $dbInstallers = array();
+ private $dbInstallers = array();
/**
* A list of environment check methods called by doEnvironmentChecks().
* These may output warnings using showMessage(), and/or abort the
* installation process by returning false.
- * @protected
*/
- var $envChecks = array(
+ protected $envChecks = array(
'envLatestVersion',
'envCheckDB',
'envCheckRegisterGlobals',
'envCheckUploadsDirectory',
);
+ /**
+ * Steps for installation.
+ * @TODO Should be protected...
+ */
var $installSteps = array(
'database',
'tables',
/**
* Known object cache types and the functions used to test for their existence
- * @protected
*/
- var $objectCaches = array(
+ protected $objectCaches = array(
'xcache' => 'xcache_get',
'apc' => 'apc_fetch',
'eaccel' => 'eaccelerator_get',
);
/**
* Cached Title and ParserOptions used by parse()
- * @private
*/
- var $parserTitle, $parserOptions;
+ private $parserTitle, $parserOptions;
/**
* Constructor, always call this from child classes
$wgExtensionMessagesFiles['MediawikiInstaller'] =
'./includes/installer/Installer.i18n.php';
+ global $wgUser;
+ $wgUser = User::newFromId( 0 );
+ // Having a user with id = 0 safeguards us from DB access via User::loadOptions()
+
// Set our custom <doclink> hook
global $wgHooks;
$wgHooks['ParserFirstCallInit'][] = array( $this, 'registerDocLink' );
return $command;
$file = str_replace( '$1', $command, $versionInfo[0] );
- if ( strstr( wfShellExec( $file ), $versionInfo[1]) !== false )
+ # Should maybe be wfShellExec( $file), but runs into a ulimit, see
+ # http://www.mediawiki.org/w/index.php?title=New-installer_issues&diff=prev&oldid=335456
+ if ( strstr( `$file`, $versionInfo[1]) !== false )
return $command;
}
}
return $status;
}
+ public function installUser() {
+ $installer = $this->getDBInstaller( $this->getVar( 'wgDBtype' ) );
+ $status = $installer->setupUser();
+ return $status;
+ }
+
public function installTables() {
$installer = $this->getDBInstaller();
$status = $installer->createTables();
return $localSettings->writeLocalSettings();
}
+ /**
+ * Determine if LocalSettings exists. If it does, return an appropriate
+ * status for whether we should can upgrade or not
+ * @return Status
+ */
+ function getLocalSettingsStatus() {
+ global $IP;
+
+ $status = Status::newGood();
+
+ wfSuppressWarnings();
+ $ls = file_exists( "$IP/LocalSettings.php" );
+ wfRestoreWarnings();
+
+ if( $ls ) {
+ if( $this->getDBInstaller()->needsUpgrade() ) {
+ $status->warning( 'config-localsettings-upgrade' );
+ }
+ else {
+ $status->fatal( 'config-localsettings-noupgrade' );
+ }
+ }
+ return $status;
+ }
+
/**
* On POSIX systems return the primary group of the webserver we're running under.
* On other systems just returns null.