Localisation updates for core and extension messages from translatewiki.net (2011...
[lhc/web/wiklou.git] / includes / installer / DatabaseInstaller.php
index 957ee51..3594f35 100644 (file)
@@ -19,7 +19,7 @@ abstract class DatabaseInstaller {
         *
         * TODO: naming this parent is confusing, 'installer' would be clearer.
         *
-        * @var Installer
+        * @var WebInstaller
         */
        public $parent;
 
@@ -96,7 +96,7 @@ abstract class DatabaseInstaller {
 
        /**
         * Open a connection to the database using the administrative user/password
-        * currently defined in the session, without any caching. Returns a status 
+        * currently defined in the session, without any caching. Returns a status
         * object. On success, the status object will contain a Database object in
         * its value member.
         *
@@ -114,9 +114,9 @@ abstract class DatabaseInstaller {
 
        /**
         * Connect to the database using the administrative user/password currently
-        * defined in the session. Returns a status object. On success, the status 
+        * defined in the session. Returns a status object. On success, the status
         * object will contain a Database object in its value member.
-        * 
+        *
         * This will return a cached connection if one is available.
         *
         * @return Status
@@ -149,6 +149,7 @@ abstract class DatabaseInstaller {
 
                if( $this->db->tableExists( 'user' ) ) {
                        $status->warning( 'config-install-tables-exist' );
+                       $this->enableLB();
                        return $status;
                }
 
@@ -201,6 +202,10 @@ abstract class DatabaseInstaller {
                                }
                        }
                }
+
+               // Now run updates to create tables for old extensions
+               $updater->doUpdates( array( 'extensions' ) );
+
                return $status;
        }
 
@@ -212,7 +217,7 @@ abstract class DatabaseInstaller {
        public abstract function getLocalSettings();
 
        /**
-        * Override this to provide DBMS-specific schema variables, to be 
+        * Override this to provide DBMS-specific schema variables, to be
         * substituted into tables.sql and other schema files.
         */
        public function getSchemaVars() {
@@ -236,7 +241,7 @@ abstract class DatabaseInstaller {
 
        /**
         * Set up LBFactory so that wfGetDB() etc. works.
-        * We set up a special LBFactory instance which returns the current 
+        * We set up a special LBFactory instance which returns the current
         * installer connection.
         */
        public function enableLB() {
@@ -493,13 +498,14 @@ abstract class DatabaseInstaller {
         * @return String
         */
        public function getWebUserBox( $noCreateMsg = false ) {
+               $wrapperStyle = $this->getVar( '_SameAccount' ) ? 'display: none' : '';
                $s = Html::openElement( 'fieldset' ) .
                        Html::element( 'legend', array(), wfMsg( 'config-db-web-account' ) ) .
                        $this->getCheckBox(
                                '_SameAccount', 'config-db-web-account-same',
                                array( 'class' => 'hideShowRadio', 'rel' => 'dbOtherAccount' )
                        ) .
-                       Html::openElement( 'div', array( 'id' => 'dbOtherAccount', 'style' => 'display: none;' ) ) .
+                       Html::openElement( 'div', array( 'id' => 'dbOtherAccount', 'style' => $wrapperStyle ) ) .
                        $this->getTextBox( 'wgDBuser', 'config-db-username' ) .
                        $this->getPasswordBox( 'wgDBpassword', 'config-db-password' ) .
                        $this->parent->getHelpBox( 'config-db-web-help' );
@@ -527,6 +533,10 @@ abstract class DatabaseInstaller {
                        $this->setVar( 'wgDBpassword', $this->getVar( '_InstallPassword' ) );
                }
 
+               if( $this->getVar( '_CreateDBAccount' ) && strval( $this->getVar( 'wgDBpassword' ) ) == '' ) {
+                       return Status::newFatal( 'config-db-password-empty', $this->getVar( 'wgDBuser' ) );
+               }
+
                return Status::newGood();
        }
 
@@ -547,11 +557,13 @@ abstract class DatabaseInstaller {
                        return $status;
                }
                global $IP;
+               wfSuppressWarnings();
                $rows = file( "$IP/maintenance/interwiki.list",
                        FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES );
+               wfRestoreWarnings();
                $interwikis = array();
                if ( !$rows ) {
-                       return Status::newFatal( 'config-install-interwiki-sql' );
+                       return Status::newFatal( 'config-install-interwiki-list' );
                }
                foreach( $rows as $row ) {
                        $row = preg_replace( '/^\s*([^#]*?)\s*(#.*)?$/', '\\1', $row ); // strip comments - whee