$conf->SQLiteDataDir = importPost( "SQLiteDataDir", "$IP/../data" );
## DB2 specific:
- // New variable in order to have a different default port number
- $conf->DBport_db2 = importPost( "DBport_db2", "50000" );
- $conf->DBcataloged = importPost( "DBcataloged", "cataloged" );
$conf->DBdb2schema = importPost( "DBdb2schema", "mediawiki" );
// Oracle specific
}
## DB2 specific:
- $wgDBcataloged = $conf->DBcataloged;
$wgCommandLineMode = true;
if (! defined ( 'STDERR' ) )
<?php database_switcher($ourdb, 'ibm_db2'); ?>
<div class="config-input"><?php
- aField( $conf, "DBport_db2", "Database port:" );
+ aField( $conf, "DBport", "Database port:" );
?></div>
+ <div class="config-desc">
+ <p>50000 is the usual DB2 port.</p>
+ </div>
<div class="config-input"><?php
aField( $conf, "DBdb2schema", "Schema for mediawiki:" );
?></div>
- <div>Select one:</div>
- <ul class="plain">
- <li><?php aField( $conf, "DBcataloged", "Cataloged (DB2 installed locally)", "radio", "cataloged" ); ?></li>
- <li><?php aField( $conf, "DBcataloged", "Uncataloged (remote DB2 through ODBC)", "radio", "uncataloged" ); ?></li>
- </ul>
<div class="config-desc">
<p>If you need to share one database between multiple wikis, or
between MediaWiki and another web application, you may specify
} elseif( $conf->DBtype == 'ibm_db2' ) {
$dbsettings =
"# DB2 specific settings
-\$wgDBport = \"{$slconf['DBport_db2']}\";
-\$wgDBmwschema = \"{$slconf['DBdb2schema']}\";
-\$wgDBcataloged = \"{$slconf['DBcataloged']}\";";
+\$wgDBport = \"{$slconf['DBport']}\";
+\$wgDBmwschema = \"{$slconf['DBdb2schema']}\";";
} elseif( $conf->DBtype == 'oracle' ) {
$dbsettings =
"# Oracle specific settings
*
*/
- /// Server port for uncataloged connections
+ /// Server port
protected $mPort = null;
- /// Whether connection is cataloged
- protected $mCataloged = null;
/// Schema for tables, stored procedures, triggers
protected $mSchema = null;
/// Whether the schema has been applied in this session
public $mStmtOptions = array();
- const CATALOGED = "cataloged";
- const UNCATALOGED = "uncataloged";
const USE_GLOBAL = "get from global";
const NONE_OPTION = 0x00;
private function installPrint($string) {
wfDebug("$string\n");
if ($this->mMode == self::INSTALL_MODE) {
- print "<li>$string</li>";
+ print "<li><pre>$string</pre></li>";
flush();
}
}
public function open( $server, $user, $password, $dbName )
{
// Load the port number
- global $wgDBport, $wgDBcataloged;
+ global $wgDBport;
wfProfileIn( __METHOD__ );
// Load IBM DB2 driver if missing
$this->mUser = $user;
$this->mPassword = $password;
$this->mDBname = $dbName;
- $this->mCataloged = $cataloged = $wgDBcataloged;
- if ( $cataloged == self::CATALOGED ) {
- $this->openCataloged($dbName, $user, $password);
- }
- elseif ( $cataloged == self::UNCATALOGED ) {
- $this->openUncataloged($dbName, $user, $password, $server, $port);
- }
+ $this->openUncataloged($dbName, $user, $password, $server, $port);
+
// Apply connection config
db2_set_option($this->mConn, $this->mConnOptions, 1);
// Not all MediaWiki code is transactional
*/
protected function openCataloged( $dbName, $user, $password )
{
- @$this->mConn = db2_connect($dbName, $user, $password);
+ @$this->mConn = db2_pconnect($dbName, $user, $password);
}
/**
$str .= "UID=$user;";
$str .= "PWD=$password;";
- @$this->mConn = db2_connect($str, $user, $password);
+ @$this->mConn = db2_pconnect($str, $user, $password);
}
/**
$list .= ", $field = ?";
}
else {
- $list .= "( $field = ?";
+ $list .= "$field = ?";
$first = false;
}
}
- $list .= ')';
+ $list .= '';
return $list;
}
// db2_ping() doesn't exist
// Emulate
$this->close();
- if ($this->mCataloged == null) {
- return false;
- }
- else if ($this->mCataloged) {
- $this->mConn = $this->openCataloged($this->mDBName, $this->mUser, $this->mPassword);
- }
- else if (!$this->mCataloged) {
- $this->mConn = $this->openUncataloged($this->mDBName, $this->mUser, $this->mPassword, $this->mServer, $this->mPort);
- }
+ $this->mConn = $this->openUncataloged($this->mDBName, $this->mUser, $this->mPassword, $this->mServer, $this->mPort);
+
return false;
}
######################################
array_shift( $args );
}
$res = db2_execute($prepared, $args);
+ if ( !$res ) {
+ $this->installPrint(db2_stmt_errormsg());
+ }
return $res;
}