From: Jure Kajzer Date: Mon, 25 Oct 2010 16:49:59 +0000 (+0000) Subject: * DatabaseOracle - throw connection exception instead of debug+false X-Git-Tag: 1.31.0-rc.0~34320 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=1eede8e88b26ebfae9b81cd9894f61bc04bcf5a8;p=lhc%2Fweb%2Fwiklou.git * DatabaseOracle - throw connection exception instead of debug+false * DatabaseOracle - fixed $wgContLang local usage in update * Installer - added Main Page insertion as a new installation step (fixes bug 22308) --- diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index 3ea3728a9b..e91e2c3a0e 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -268,10 +268,7 @@ class DatabaseOracle extends DatabaseBase { } if ( !$this->mConn ) { - wfDebug( "DB connection error\n" ); - wfDebug( "Server: $server, Database: $dbName, User: $user, Password: " . substr( $password, 0, 3 ) . "...\n" ); - wfDebug( $this->lastError() . "\n" ); - return false; + throw new DBConnectionError( $this, $this->lastError() ); } $this->mOpened = true; @@ -1198,6 +1195,8 @@ class DatabaseOracle extends DatabaseBase { } function update( $table, $values, $conds, $fname = 'DatabaseOracle::update', $options = array() ) { + global $wgContLang; + $table = $this->tableName( $table ); $opts = $this->makeUpdateOptions( $options ); $sql = "UPDATE $opts $table SET "; diff --git a/includes/installer/CoreInstaller.php b/includes/installer/CoreInstaller.php index 60d5acc691..2024418fe2 100644 --- a/includes/installer/CoreInstaller.php +++ b/includes/installer/CoreInstaller.php @@ -96,6 +96,7 @@ abstract class CoreInstaller extends Installer { 'interwiki', 'secretkey', 'sysop', + 'mainpage', ); /** diff --git a/includes/installer/DatabaseInstaller.php b/includes/installer/DatabaseInstaller.php index b63749520e..a1f9c9332f 100644 --- a/includes/installer/DatabaseInstaller.php +++ b/includes/installer/DatabaseInstaller.php @@ -136,6 +136,27 @@ abstract class DatabaseInstaller { return $status; } + /** + * Insert Main Page with default content. + * + * @return Status + */ + public function createMainpage() { + $status = Status::newGood(); + try { + $titleobj = Title::newFromText( wfMsgNoDB( "mainpage" ) ); + $article = new Article( $titleobj ); + $article->doEdit( wfMsg( 'mainpagetext' ) . "\n\n" . wfMsgNoTrans( 'mainpagedocfooter' ), + '', + EDIT_NEW ); + } catch (MWException $e) { + //using raw, because $wgShowExceptionDetails can not be set yet + $status->fatal( 'config-install-mainpage-failed', $e->getMessage() ); + } + + return $status; + } + /** * Get the DBMS-specific options for LocalSettings.php generation. * diff --git a/includes/installer/Installer.i18n.php b/includes/installer/Installer.i18n.php index eb0755be0c..099526ad9e 100644 --- a/includes/installer/Installer.i18n.php +++ b/includes/installer/Installer.i18n.php @@ -481,6 +481,8 @@ Skipping default list.", 'config-insecure-secretkey' => "'''Warning:''' Unable to create secure \$wgSecretKey. Consider changing it manually.", 'config-install-sysop' => 'Creating administrator user account', + 'config-install-mainpage' => 'Creating main page with default content', + 'config-install-mainpage-failed' => 'Could not insert main page.', 'config-install-done' => "'''Congratulations!''' You have successfully installed MediaWiki. diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index be5d85face..f11f091443 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -357,6 +357,8 @@ abstract class Installer { if( $status->isOK() ) { LBFactory::enableBackend(); } + + return $status; } /** @@ -370,6 +372,17 @@ abstract class Installer { return $installer->populateInterwikiTable(); } + /** + * TODO: document + * + * @param $installer DatabaseInstaller + * + * @return Status + */ + public function installMainpage( DatabaseInstaller &$installer ) { + return $installer->createMainpage(); + } + /** * Exports all wg* variables stored by the installer into global scope. */ diff --git a/includes/installer/OracleInstaller.php b/includes/installer/OracleInstaller.php index 8146776bec..5c3ec18aec 100644 --- a/includes/installer/OracleInstaller.php +++ b/includes/installer/OracleInstaller.php @@ -120,7 +120,6 @@ class OracleInstaller extends DatabaseInstaller { $this->getVar( '_InstallUser' ), $this->getVar( '_InstallPassword' ), $this->getVar( 'wgDBname' ), - false, DBO_SYSDBA, $this->getVar( 'wgDBprefix' ) ); @@ -130,7 +129,6 @@ class OracleInstaller extends DatabaseInstaller { $this->getVar( 'wgDBuser' ), $this->getVar( 'wgDBpassword' ), $this->getVar( 'wgDBname' ), - false, 0, $this->getVar( 'wgDBprefix' ) );