Index: trunk/phase3/maintenance/ibm_db2/tables.sql |
— | — | @@ -48,11 +48,7 @@ |
49 | 49 | -- REFERENCES user(user_id) ON DELETE CASCADE, |
50 | 50 | ug_group VARCHAR(255) NOT NULL |
51 | 51 | ); |
52 | | -CREATE UNIQUE INDEX user_groups_unique ON user_groups (ug_user, ug_group); |
53 | | -CREATE UNIQUE INDEX user_groups_include_idx |
54 | | - ON user_groups(ug_user) |
55 | | - INCLUDE (ug_group); |
| 52 | +CREATE INDEX user_groups_unique ON user_groups (ug_user, ug_group); |
56 | 53 | |
57 | 54 | |
58 | 55 | CREATE TABLE user_newtalk ( |
Index: trunk/phase3/includes/db/DatabaseIbm_db2.php |
— | — | @@ -122,10 +122,8 @@ |
123 | 123 | * |
124 | 124 | */ |
125 | 125 | |
126 | | - /// Server port for uncataloged connections |
| 126 | + /// Server port |
127 | 127 | protected $mPort = null; |
128 | | - /// Whether connection is cataloged |
129 | | - protected $mCataloged = null; |
130 | 128 | /// Schema for tables, stored procedures, triggers |
131 | 129 | protected $mSchema = null; |
132 | 130 | /// Whether the schema has been applied in this session |
— | — | @@ -143,8 +141,6 @@ |
144 | 142 | public $mStmtOptions = array(); |
145 | 143 | |
146 | 144 | |
147 | | - const CATALOGED = "cataloged"; |
148 | | - const UNCATALOGED = "uncataloged"; |
149 | 145 | const USE_GLOBAL = "get from global"; |
150 | 146 | |
151 | 147 | const NONE_OPTION = 0x00; |
— | — | @@ -461,7 +457,7 @@ |
462 | 458 | private function installPrint($string) { |
463 | 459 | wfDebug("$string\n"); |
464 | 460 | if ($this->mMode == self::INSTALL_MODE) { |
465 | | - print "<li>$string</li>"; |
| 461 | + print "<li><pre>$string</pre></li>"; |
466 | 462 | flush(); |
467 | 463 | } |
468 | 464 | } |
— | — | @@ -478,7 +474,7 @@ |
479 | 475 | public function open( $server, $user, $password, $dbName ) |
480 | 476 | { |
481 | 477 | // Load the port number |
482 | | - global $wgDBport, $wgDBcataloged; |
| 478 | + global $wgDBport; |
483 | 479 | wfProfileIn( __METHOD__ ); |
484 | 480 | |
485 | 481 | // Load IBM DB2 driver if missing |
— | — | @@ -503,14 +499,9 @@ |
504 | 500 | $this->mUser = $user; |
505 | 501 | $this->mPassword = $password; |
506 | 502 | $this->mDBname = $dbName; |
507 | | - $this->mCataloged = $cataloged = $wgDBcataloged; |
508 | 503 | |
509 | | - if ( $cataloged == self::CATALOGED ) { |
510 | | - $this->openCataloged($dbName, $user, $password); |
511 | | - } |
512 | | - elseif ( $cataloged == self::UNCATALOGED ) { |
513 | | - $this->openUncataloged($dbName, $user, $password, $server, $port); |
514 | | - } |
| 504 | + $this->openUncataloged($dbName, $user, $password, $server, $port); |
| 505 | + |
515 | 506 | // Apply connection config |
516 | 507 | db2_set_option($this->mConn, $this->mConnOptions, 1); |
517 | 508 | // Not all MediaWiki code is transactional |
— | — | @@ -536,7 +527,7 @@ |
537 | 528 | */ |
538 | 529 | protected function openCataloged( $dbName, $user, $password ) |
539 | 530 | { |
540 | | - @$this->mConn = db2_connect($dbName, $user, $password); |
| 531 | + @$this->mConn = db2_pconnect($dbName, $user, $password); |
541 | 532 | } |
542 | 533 | |
543 | 534 | /** |
— | — | @@ -552,7 +543,7 @@ |
553 | 544 | $str .= "UID=$user;"; |
554 | 545 | $str .= "PWD=$password;"; |
555 | 546 | |
556 | | - @$this->mConn = db2_connect($str, $user, $password); |
| 547 | + @$this->mConn = db2_pconnect($str, $user, $password); |
557 | 548 | } |
558 | 549 | |
559 | 550 | /** |
— | — | @@ -902,11 +893,11 @@ |
903 | 894 | $list .= ", $field = ?"; |
904 | 895 | } |
905 | 896 | else { |
906 | | - $list .= "( $field = ?"; |
| 897 | + $list .= "$field = ?"; |
907 | 898 | $first = false; |
908 | 899 | } |
909 | 900 | } |
910 | | - $list .= ')'; |
| 901 | + $list .= ''; |
911 | 902 | |
912 | 903 | return $list; |
913 | 904 | } |
— | — | @@ -1473,15 +1464,8 @@ |
1474 | 1465 | // db2_ping() doesn't exist |
1475 | 1466 | // Emulate |
1476 | 1467 | $this->close(); |
1477 | | - if ($this->mCataloged == null) { |
1478 | | - return false; |
1479 | | - } |
1480 | | - else if ($this->mCataloged) { |
1481 | | - $this->mConn = $this->openCataloged($this->mDBName, $this->mUser, $this->mPassword); |
1482 | | - } |
1483 | | - else if (!$this->mCataloged) { |
1484 | | - $this->mConn = $this->openUncataloged($this->mDBName, $this->mUser, $this->mPassword, $this->mServer, $this->mPort); |
1485 | | - } |
| 1468 | + $this->mConn = $this->openUncataloged($this->mDBName, $this->mUser, $this->mPassword, $this->mServer, $this->mPort); |
| 1469 | + |
1486 | 1470 | return false; |
1487 | 1471 | } |
1488 | 1472 | ###################################### |
— | — | @@ -1706,6 +1690,9 @@ |
1707 | 1691 | array_shift( $args ); |
1708 | 1692 | } |
1709 | 1693 | $res = db2_execute($prepared, $args); |
| 1694 | + if ( !$res ) { |
| 1695 | + $this->installPrint(db2_stmt_errormsg()); |
| 1696 | + } |
1710 | 1697 | return $res; |
1711 | 1698 | } |
1712 | 1699 | |
Index: trunk/phase3/config/Installer.php |
— | — | @@ -644,9 +644,6 @@ |
645 | 645 | $conf->SQLiteDataDir = importPost( "SQLiteDataDir", "$IP/../data" ); |
646 | 646 | |
647 | 647 | ## DB2 specific: |
648 | | - // New variable in order to have a different default port number |
649 | | - $conf->DBport_db2 = importPost( "DBport_db2", "50000" ); |
650 | | - $conf->DBcataloged = importPost( "DBcataloged", "cataloged" ); |
651 | 648 | $conf->DBdb2schema = importPost( "DBdb2schema", "mediawiki" ); |
652 | 649 | |
653 | 650 | // Oracle specific |
— | — | @@ -837,7 +834,6 @@ |
838 | 835 | } |
839 | 836 | |
840 | 837 | ## DB2 specific: |
841 | | - $wgDBcataloged = $conf->DBcataloged; |
842 | 838 | |
843 | 839 | $wgCommandLineMode = true; |
844 | 840 | if (! defined ( 'STDERR' ) ) |
— | — | @@ -1711,16 +1707,14 @@ |
1712 | 1708 | |
1713 | 1709 | <?php database_switcher($ourdb, 'ibm_db2'); ?> |
1714 | 1710 | <div class="config-input"><?php |
1715 | | - aField( $conf, "DBport_db2", "Database port:" ); |
| 1711 | + aField( $conf, "DBport", "Database port:" ); |
1716 | 1712 | ?></div> |
| 1713 | + <div class="config-desc"> |
| 1714 | + <p>50000 is the usual DB2 port.</p> |
| 1715 | + </div> |
1717 | 1716 | <div class="config-input"><?php |
1718 | 1717 | aField( $conf, "DBdb2schema", "Schema for mediawiki:" ); |
1719 | 1718 | ?></div> |
1720 | | - <div>Select one:</div> |
1721 | | - <ul class="plain"> |
1722 | | - <li><?php aField( $conf, "DBcataloged", "Cataloged (DB2 installed locally)", "radio", "cataloged" ); ?></li> |
1723 | | - <li><?php aField( $conf, "DBcataloged", "Uncataloged (remote DB2 through ODBC)", "radio", "uncataloged" ); ?></li> |
1724 | | - </ul> |
1725 | 1719 | <div class="config-desc"> |
1726 | 1720 | <p>If you need to share one database between multiple wikis, or |
1727 | 1721 | between MediaWiki and another web application, you may specify |
— | — | @@ -1913,9 +1907,8 @@ |
1914 | 1908 | } elseif( $conf->DBtype == 'ibm_db2' ) { |
1915 | 1909 | $dbsettings = |
1916 | 1910 | "# DB2 specific settings |
1917 | | -\$wgDBport = \"{$slconf['DBport_db2']}\"; |
1918 | | -\$wgDBmwschema = \"{$slconf['DBdb2schema']}\"; |
1919 | | -\$wgDBcataloged = \"{$slconf['DBcataloged']}\";"; |
| 1911 | +\$wgDBport = \"{$slconf['DBport']}\"; |
| 1912 | +\$wgDBmwschema = \"{$slconf['DBdb2schema']}\";"; |
1920 | 1913 | } elseif( $conf->DBtype == 'oracle' ) { |
1921 | 1914 | $dbsettings = |
1922 | 1915 | "# Oracle specific settings |