Merge "Lowered the TransactionProfiler threshold"
[lhc/web/wiklou.git] / includes / installer / PostgresInstaller.php
index a7e8462..9e25f47 100644 (file)
@@ -42,8 +42,8 @@ class PostgresInstaller extends DatabaseInstaller {
                '_InstallUser' => 'postgres',
        );
 
-       var $minimumVersion = '8.3';
-       var $maxRoleSearchDepth = 5;
+       public $minimumVersion = '8.3';
+       public $maxRoleSearchDepth = 5;
 
        protected $pgConns = array();
 
@@ -56,20 +56,37 @@ class PostgresInstaller extends DatabaseInstaller {
        }
 
        function getConnectForm() {
-               return $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) .
+               return $this->getTextBox(
+                       'wgDBserver',
+                       'config-db-host',
+                       array(),
+                       $this->parent->getHelpBox( 'config-db-host-help' )
+               ) .
                        $this->getTextBox( 'wgDBport', 'config-db-port' ) .
                        Html::openElement( 'fieldset' ) .
                        Html::element( 'legend', array(), wfMessage( 'config-db-wiki-settings' )->text() ) .
-                       $this->getTextBox( 'wgDBname', 'config-db-name', array(), $this->parent->getHelpBox( 'config-db-name-help' ) ) .
-                       $this->getTextBox( 'wgDBmwschema', 'config-db-schema', array(), $this->parent->getHelpBox( 'config-db-schema-help' ) ) .
+                       $this->getTextBox(
+                               'wgDBname',
+                               'config-db-name',
+                               array(),
+                               $this->parent->getHelpBox( 'config-db-name-help' )
+                       ) .
+                       $this->getTextBox(
+                               'wgDBmwschema',
+                               'config-db-schema',
+                               array(),
+                               $this->parent->getHelpBox( 'config-db-schema-help' )
+                       ) .
                        Html::closeElement( 'fieldset' ) .
                        $this->getInstallUserBox();
        }
 
        function submitConnectForm() {
                // Get variables from the request
-               $newValues = $this->setVarsFromRequest( array( 'wgDBserver', 'wgDBport',
-                       'wgDBname', 'wgDBmwschema' ) );
+               $newValues = $this->setVarsFromRequest( array(
+                       'wgDBserver', 'wgDBport','wgDBname', 'wgDBmwschema',
+                       '_InstallUser', '_InstallPassword'
+               ) );
 
                // Validate them
                $status = Status::newGood();
@@ -81,6 +98,12 @@ class PostgresInstaller extends DatabaseInstaller {
                if ( !preg_match( '/^[a-zA-Z0-9_]*$/', $newValues['wgDBmwschema'] ) ) {
                        $status->fatal( 'config-invalid-schema', $newValues['wgDBmwschema'] );
                }
+               if ( !strlen( $newValues['_InstallUser'] ) ) {
+                       $status->fatal( 'config-db-username-empty' );
+               }
+               if ( !strlen( $newValues['_InstallPassword'] ) ) {
+                       $status->fatal( 'config-db-password-empty', $newValues['_InstallUser'] );
+               }
 
                // Submit user box
                if ( $status->isOK() ) {
@@ -195,8 +218,7 @@ class PostgresInstaller extends DatabaseInstaller {
         *    - create-tables: A connection with a role suitable for creating tables.
         *
         * @throws MWException
-        * @return Status object. On success, a connection object will be in the
-        *   value member.
+        * @return Status On success, a connection object will be in the value member.
         */
        protected function openPgConnection( $type ) {
                switch ( $type ) {
@@ -391,7 +413,7 @@ class PostgresInstaller extends DatabaseInstaller {
 
        /**
         * Recursive helper for canCreateObjectsForWebUser().
-        * @param $conn DatabaseBase object
+        * @param DatabaseBase $conn
         * @param int $targetMember Role ID of the member to look for
         * @param int $group Role ID of the group to look for
         * @param int $maxDepth Maximum recursive search depth