* DatabaseOracle - throw connection exception instead of debug+false
authorJure Kajzer <freakolowsky@users.mediawiki.org>
Mon, 25 Oct 2010 16:49:59 +0000 (16:49 +0000)
committerJure Kajzer <freakolowsky@users.mediawiki.org>
Mon, 25 Oct 2010 16:49:59 +0000 (16:49 +0000)
* DatabaseOracle - fixed $wgContLang local usage in update
* Installer - added Main Page insertion as a new installation step (fixes bug 22308)

includes/db/DatabaseOracle.php
includes/installer/CoreInstaller.php
includes/installer/DatabaseInstaller.php
includes/installer/Installer.i18n.php
includes/installer/Installer.php
includes/installer/OracleInstaller.php

index 3ea3728..e91e2c3 100644 (file)
@@ -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 ";
index 60d5acc..2024418 100644 (file)
@@ -96,6 +96,7 @@ abstract class CoreInstaller extends Installer {
                'interwiki',
                'secretkey',
                'sysop',
+               'mainpage',
        );
 
        /**
index b637495..a1f9c93 100644 (file)
@@ -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.
         * 
index eb0755b..099526a 100644 (file)
@@ -481,6 +481,8 @@ Skipping default list.",
        'config-insecure-secretkey'       => "'''Warning:''' Unable to create secure <code>\$wgSecretKey</code>.
 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.
 
index be5d85f..f11f091 100644 (file)
@@ -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.
         */
index 8146776..5c3ec18 100644 (file)
@@ -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' )
                                );