/**
* 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
*/
'wgDBmwschema',
);
+ protected $internalDefaults = array(
+ '_InstallUser' => 'db2admin'
+ );
+
/**
* Get the DB2 database extension name
* @return string
*/
- public function getName(){
+ public function getName() {
return 'ibm_db2';
}
$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' ) .
*/
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
elseif ( !preg_match( '/^[a-zA-Z0-9_]*$/', $newValues['wgDBmwschema'] ) ) {
$status->fatal( 'config-invalid-schema', $newValues['wgDBmwschema'] );
}
- if ( !strlen( $newValues['wgDBport'] ) ) {
+ if ( !strlen( $newValues['wgDBport'] ) ) {
$status->fatal( 'config-invalid-port' );
}
elseif ( !preg_match( '/^[0-9_]*$/', $newValues['wgDBport'] ) ) {
return $status;
}
- global $wgDBport;
- $wgDBport = $newValues['wgDBport'];
+ global $wgDBport;
+ $wgDBport = $newValues['wgDBport'];
// Try to connect
$status->merge( $this->getConnection() );
$this->parent->setVar( 'wgDBpassword', $this->getVar( '_InstallPassword' ) );
return $status;
-
}
/**
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__ );
$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__ );
$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 {
- $nRows = $this->db->numRows( $result );
- while ( $row = $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', '' );
}
\$wgDBport = \"{$port}\";";
}
- public function __construct($parent) {
- parent::__construct($parent);
+ public function __construct( $parent ) {
+ parent::__construct( $parent );
}
-}
\ No newline at end of file
+}