'envCheckCache',
'envCheckDiff3',
'envCheckGraphics',
+ 'envCheckServer',
'envCheckPath',
'envCheckExtension',
'envCheckShellLocale',
'wgDiff3',
'wgImageMagickConvertCommand',
'IP',
+ 'wgServer',
'wgScriptPath',
'wgScriptExtension',
'wgMetaNamespace',
'_UpgradeDone' => false,
'_InstallDone' => false,
'_Caches' => array(),
- '_InstallUser' => 'root',
'_InstallPassword' => '',
'_SameAccount' => true,
'_CreateDBAccount' => false,
*
* @return Array
*/
- public function getExistingLocalSettings() {
+ public static function getExistingLocalSettings() {
global $IP;
wfSuppressWarnings();
}
}
+ /**
+ * Environment check for the server hostname.
+ */
+ protected function envCheckServer() {
+ $server = WebRequest::detectServer();
+ $this->showMessage( 'config-using-server', $server );
+ $this->setVar( 'wgServer', $server );
+ }
+
/**
* Environment check for setting $IP and $wgScriptPath.
*/
// PHP_SELF isn't available sometimes, such as when PHP is CGI but
// cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
// to get the path to the current script... hopefully it's reliable. SIGH
- if ( !empty( $_SERVER['PHP_SELF'] ) ) {
+ if ( $this->getVar( 'wgScriptPath' ) ) {
+ // Some kind soul has set it for us already (e.g. debconf)
+ return true;
+ } elseif ( !empty( $_SERVER['PHP_SELF'] ) ) {
$path = $_SERVER['PHP_SELF'];
} elseif ( !empty( $_SERVER['SCRIPT_NAME'] ) ) {
$path = $_SERVER['SCRIPT_NAME'];
- } elseif ( $this->getVar( 'wgScriptPath' ) ) {
- // Some kind soul has set it for us already (e.g. debconf)
return true;
} else {
$this->showError( 'config-no-uri' );
* TODO: document
*/
protected function envCheckUploadsDirectory() {
- global $IP, $wgServer;
+ global $IP;
$dir = $IP . '/images/';
- $url = $wgServer . $this->getVar( 'wgScriptPath' ) . '/images/';
+ $url = $this->getVar( 'wgServer' ) . $this->getVar( 'wgScriptPath' ) . '/images/';
$safe = !$this->dirIsExecutable( $dir, $url );
if ( $safe ) {
$c = hexdec($c);
if ($c <= 0x7F) {
return chr($c);
- } else if ($c <= 0x7FF) {
+ } elseif ($c <= 0x7FF) {
return chr(0xC0 | $c >> 6) . chr(0x80 | $c & 0x3F);
- } else if ($c <= 0xFFFF) {
+ } elseif ($c <= 0xFFFF) {
return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F)
. chr(0x80 | $c & 0x3F);
- } else if ($c <= 0x10FFFF) {
+ } elseif ($c <= 0x10FFFF) {
return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F)
. chr(0x80 | $c >> 6 & 0x3F)
. chr(0x80 | $c & 0x3F);
global $IP;
$exts = $this->getVar( '_Extensions' );
$IP = $this->getVar( 'IP' );
- $path = $IP . '/extensions';
/**
* We need to include DefaultSettings before including extensions to avoid
require( "$IP/includes/DefaultSettings.php" );
foreach( $exts as $e ) {
- require_once( "$path/$e/$e.php" );
+ require_once( "$IP/extensions/$e/$e.php" );
}
$hooksWeWant = isset( $wgHooks['LoadExtensionSchemaUpdates'] ) ?
protected function createSysop() {
$name = $this->getVar( '_AdminName' );
$user = User::newFromName( $name );
- $status = $this->getDBInstaller()->getConnection();
- if( $status->isOK() ) {
- $db = $status->value;
- } else {
- return Status::newFatal( 'config-admin-error-user', $name );
- }
if ( !$user ) {
// We should've validated this earlier anyway!
return Status::newFatal( 'config-admin-error-user', $name );
}
- if ( $user->idForName( $db ) == 0 ) {
- $user->addToDatabase( $db );
+ if ( $user->idForName() == 0 ) {
+ $user->addToDatabase();
try {
$user->setPassword( $this->getVar( '_AdminPassword' ) );
return Status::newFatal( 'config-admin-error-password', $name, $pwe->getMessage() );
}
- $user->addGroup( 'sysop', $db );
- $user->addGroup( 'bureaucrat', $db );
+ $user->addGroup( 'sysop' );
+ $user->addGroup( 'bureaucrat' );
if( $this->getVar( '_AdminEmail' ) ) {
$user->setEmail( $this->getVar( '_AdminEmail' ) );
}
- $user->saveSettings( $db );
+ $user->saveSettings();
// Update user count
$ssUpdate = new SiteStatsUpdate( 0, 0, 0, 0, 1 );
public function addInstallStep( $callback, $findStep = 'BEGINNING' ) {
$this->extraInstallSteps[$findStep][] = $callback;
}
+
+ /**
+ * Disable the time limit for execution.
+ * Some long-running pages (Install, Upgrade) will want to do this
+ */
+ protected function disableTimeLimit() {
+ wfSuppressWarnings();
+ set_time_limit( 0 );
+ wfRestoreWarnings();
+ }
}