* Make sure output only happens in the top-level Installer implementations.
* Differentiate Status warning messages from Status error messages in the Installer.
* Change abstract method from Install::showStatusError() to Install::showStatusMessage() since we'll use it to show warnings now, too.
* TODO Need a better way to extract/display Status warning messages since, from my look at the Status class, it looks like warnings are implemented, but not really used.
# includes/installer
'CliInstaller' => 'includes/installer/CliInstaller.php',
- 'CliInstallerOutput' => 'includes/installer/CliInstallerOutput.php',
'Installer' => 'includes/installer/Installer.php',
'InstallerDBType' => 'includes/installer/InstallerDBType.php',
'LBFactory_InstallerFake' => 'includes/installer/Installer.php',
if ( isset( $option['pass'] ) ) {
$this->setVar( '_AdminPassword', $option['pass'] );
}
-
- $this->output = new CliInstallerOutput( $this );
}
/**
$this->showMessage("Installing $step... ");
$func = 'install' . ucfirst( $step );
$status = $this->{$func}();
- $ok = $status->isGood();
- if ( !$ok ) {
- $this->showStatusError( $status );
+ if ( !$status->isOk() ) {
+ $this->showStatusMessage( $status );
exit;
+ } elseif ( !$status->isGood() ) {
+ $this->showStatusMessage( $status );
}
$this->showMessage("done\n");
}
}
function showMessage( $msg /*, ... */ ) {
- $this->output->addHTML($msg);
- $this->output->output();
+ echo html_entity_decode( strip_tags( $msg ), ENT_QUOTES );
+ flush();
}
- function showStatusError( $status ) {
- $this->output->addHTML($status->getWikiText()."\n");
- $this->output->flush();
+ function showStatusMessage( $status ) {
+ $this->showMessage( $status->getWikiText() );
}
+
}
*/
abstract function showMessage( $msg /*, ... */ );
- abstract function showStatusError( $status );
+ abstract function showStatusMessage( $status );
/**
* Get a list of known DB types
public function installTables() {
$installer = $this->getDBInstaller();
$status = $installer->createTables();
- if( $status->isGood() ) {
+ if( $status->isOK() ) {
LBFactory::enableBackend();
}
return $status;
$file = fopen( "/dev/urandom", "r" );
wfRestoreWarnings();
}
+
+ $status = Status::newGood();
+
if ( $file ) {
$secretKey = bin2hex( fread( $file, 32 ) );
fclose( $file );
for ( $i=0; $i<8; $i++ ) {
$secretKey .= dechex(mt_rand(0, 0x7fffffff));
}
- $this->output->addWarningMsg( 'config-insecure-secretkey' );
+ $status->warning( 'config-insecure-secretkey' );
}
$this->setVar( 'wgSecretKey', $secretKey );
- return Status::newGood();
+
+ return $status;
}
public function installSysop() {
//@todo or...?
$this->db->reportQueryError( $err, 0, $sql, __FUNCTION__ );
}
- $this->setupSearchIndex();
- // Create default interwikis
- return Status::newGood();
+ return $this->setupSearchIndex();
}
function setupSearchIndex() {
global $IP;
+ $status = Status::newGood();
+
$module = $this->db->getFulltextSearchModule();
$fts3tTable = $this->db->checkForEnabledSearch();
if ( $fts3tTable && !$module ) {
- $this->parent->output->addHtml
- ( wfMsgHtml( 'word-separator' ) . wfMsgHtml( 'config-sqlite-fts3-downgrade' ) . wfMsgHtml( 'ellipsis' ) );
- $this->parent->output->flush();
+ $status->warning( 'config-sqlite-fts3-downgrade' );
$this->db->sourceFile( "$IP/maintenance/sqlite/archives/searchindex-no-fts.sql" );
} elseif ( !$fts3tTable && $module == 'FTS3' ) {
- $this->parent->output->addHtml
- ( wfMsgHtml( 'word-separator' ) . wfMsgHtml( 'config-sqlite-fts3-add' ) . wfMsg( 'ellipsis' ) );
- $this->parent->output->flush();
+ $status->warning( 'config-sqlite-fts3-add' );
$this->db->sourceFile( "$IP/maintenance/sqlite/archives/searchindex-fts3.sql" );
} else {
- $this->parent->output->addHtml
- ( wfMsgHtml( 'word-separator' ) . wfMsgHtml( 'config-sqlite-fts3-ok' ) . wfMsgHtml( 'ellipsis' ) );
- $this->parent->output->flush();
+ $status->warning( 'config-sqlite-fts3-ok' );
}
+
+ return $status;
}
function doUpgrade() {
$this->output->addHTML( $this->getErrorBox( $text ) );
}
- function showStatusError( $status ) {
+ function showStatusMessage( $status ) {
$text = $status->getWikiText();
$this->output->addWikiText(
"<div class=\"config-message\">\n" .