misc style fix
[lhc/web/wiklou.git] / includes / installer / Ibm_db2Installer.php
index 0e24773..bf19055 100644 (file)
@@ -2,6 +2,21 @@
 /**
  * IBM_DB2-specific installer.
  *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
  * @file
  * @ingroup Deployment
  */
@@ -24,11 +39,15 @@ class Ibm_db2Installer extends DatabaseInstaller {
                'wgDBmwschema',
        );
 
+       protected $internalDefaults = array(
+               '_InstallUser' => 'db2admin'
+       );
+
        /**
         * Get the DB2 database extension name
         * @return string
         */
-       public function getName(){
+       public function getName() {
                return 'ibm_db2';
        }
 
@@ -49,7 +68,7 @@ class Ibm_db2Installer extends DatabaseInstaller {
                        $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) .
                        $this->getTextBox( 'wgDBport', 'config-db-port', array(), $this->parent->getHelpBox( 'config-db-port' ) ) .
                        Html::openElement( 'fieldset' ) .
-                       Html::element( 'legend', array(), wfMsg( 'config-db-wiki-settings' ) ) .
+                       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' ) ) .
                        Html::closeElement( 'fieldset' ) .
@@ -62,8 +81,8 @@ class Ibm_db2Installer extends DatabaseInstaller {
         */
        public function submitConnectForm() {
                // Get variables from the request
-               $newValues = $this->setVarsFromRequest( 
-                       array( 'wgDBserver', 'wgDBport', 'wgDBname', 
+               $newValues = $this->setVarsFromRequest(
+                       array( 'wgDBserver', 'wgDBport', 'wgDBname',
                                'wgDBmwschema', 'wgDBuser', 'wgDBpassword' ) );
 
                // Validate them
@@ -140,11 +159,14 @@ class Ibm_db2Installer extends DatabaseInstaller {
                if ( !$status->isOK() ) {
                        return $status;
                }
+               /**
+                * @var $conn DatabaseBase
+                */
                $conn = $status->value;
                $dbName = $this->getVar( 'wgDBname' );
                if( !$conn->selectDB( $dbName ) ) {
                        $conn->query( "CREATE DATABASE "
-                               . $conn->addIdentifierQuotes( $dbName ) 
+                               . $conn->addIdentifierQuotes( $dbName )
                                . " AUTOMATIC STORAGE YES"
                                . " USING CODESET UTF-8 TERRITORY US COLLATE USING SYSTEM"
                                . " PAGESIZE 32768", __METHOD__ );
@@ -181,7 +203,7 @@ class Ibm_db2Installer extends DatabaseInstaller {
                $this->db->setFlag( DBO_DDLMODE ); // For Oracle's handling of schema files
                $this->db->begin( __METHOD__ );
 
-               $error = $this->db->sourceFile( $this->db->getSchema() );
+               $error = $this->db->sourceFile( $this->db->getSchemaPath() );
                if( $error !== true ) {
                        $this->db->reportQueryError( $error, 0, '', __METHOD__ );
                        $this->db->rollback( __METHOD__ );
@@ -209,15 +231,16 @@ class Ibm_db2Installer extends DatabaseInstaller {
                $this->db->selectDB( $this->getVar( 'wgDBname' ) );
 
                try {
-                       $result = $this->db->query( 'SELECT PAGESIZE FROM SYSCAT.TABLESPACES' );
+                       $result = $this->db->query( 'SELECT PAGESIZE FROM SYSCAT.TABLESPACES FOR READ ONLY' );
                        if( $result == false ) {
                                $status->fatal( 'config-connection-error', '' );
-                       }
-                       else {
-                               while ( $row = $this->db->fetchRow( $result ) ) {
+                       } else {
+                               $row = $this->db->fetchRow( $result );
+                               while ( $row ) {
                                        if( $row[0] >= 32768 ) {
                                                return $status;
                                        }
+                                       $row = $this->db->fetchRow( $result );
                                }
                                $status->fatal( 'config-ibm_db2-low-db-pagesize', '' );
                        }
@@ -241,7 +264,7 @@ class Ibm_db2Installer extends DatabaseInstaller {
 \$wgDBport             = \"{$port}\";";
        }
 
-       public function __construct($parent) {
-               parent::__construct($parent);
+       public function __construct( $parent ) {
+               parent::__construct( $parent );
        }
-}
\ No newline at end of file
+}