Index: trunk/phase3/config/index.php |
— | — | @@ -486,7 +486,7 @@ |
487 | 487 | $wgCommandLineMode = false; |
488 | 488 | chdir( ".." ); |
489 | 489 | eval($local); |
490 | | - if (!in_array($conf->DBtype, array("mysql", "oracle"))) { |
| 490 | + if (!in_array($conf->DBtype, array("mysql", "oracle", "postgres"))) { |
491 | 491 | $errs["DBtype"] = "Unknown database type."; |
492 | 492 | continue; |
493 | 493 | } |
— | — | @@ -505,16 +505,16 @@ |
506 | 506 | require_once( "maintenance/InitialiseMessages.inc" ); |
507 | 507 | |
508 | 508 | $wgTitle = Title::newFromText( "Installation script" ); |
509 | | - $mysqlOldClient = version_compare( mysql_get_client_info(), "4.1.0", "lt" ); |
510 | | - if( $mysqlOldClient ) { |
511 | | - print "<li><b>PHP is linked with old MySQL client libraries. If you are |
512 | | - using a MySQL 4.1 server and have problems connecting to the database, |
513 | | - see <a href='http://dev.mysql.com/doc/mysql/en/old-client.html' |
514 | | - >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b></li>\n"; |
515 | | - } |
516 | 509 | $dbc = new $dbclass; |
517 | | - |
| 510 | + |
518 | 511 | if( $conf->DBtype == 'mysql' ) { |
| 512 | + $mysqlOldClient = version_compare( mysql_get_client_info(), "4.1.0", "lt" ); |
| 513 | + if( $mysqlOldClient ) { |
| 514 | + print "<li><b>PHP is linked with old MySQL client libraries. If you are |
| 515 | + using a MySQL 4.1 server and have problems connecting to the database, |
| 516 | + see <a href='http://dev.mysql.com/doc/mysql/en/old-client.html' |
| 517 | + >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b></li>\n"; |
| 518 | + } |
519 | 519 | $ok = true; # Let's be optimistic |
520 | 520 | |
521 | 521 | # Decide if we're going to use the superuser or the regular database user |
— | — | @@ -575,13 +575,13 @@ |
576 | 576 | if( !$ok ) { continue; } |
577 | 577 | |
578 | 578 | } else /* not mysql */ { |
579 | | - print "<li>Connecting to SQL server..."; |
| 579 | + echo( "<li>Attempting to connect to database server as $wgDBuser..." ); |
580 | 580 | $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1); |
581 | 581 | if (!$wgDatabase->isOpen()) { |
582 | 582 | print " error: " . $wgDatabase->lastError() . "</li>\n"; |
583 | 583 | } else { |
584 | 584 | $wgDatabase->ignoreErrors(true); |
585 | | - $myver = get_db_version(); |
| 585 | + $myver = $wgDatabase->getServerVersion(); |
586 | 586 | } |
587 | 587 | } |
588 | 588 | |
— | — | @@ -591,27 +591,27 @@ |
592 | 592 | } |
593 | 593 | |
594 | 594 | print "<li>Connected to $myver"; |
595 | | - if( version_compare( $myver, "4.0.0" ) < 0 ) { |
596 | | - die( " -- mysql 4.0 or later required. Aborting." ); |
597 | | - } |
598 | | - $mysqlNewAuth = version_compare( $myver, "4.1.0", "ge" ); |
599 | | - if( $mysqlNewAuth && $mysqlOldClient ) { |
600 | | - print "; <b class='error'>You are using MySQL 4.1 server, but PHP is linked |
601 | | - to old client libraries; if you have trouble with authentication, see |
602 | | - <a href='http://dev.mysql.com/doc/mysql/en/old-client.html' |
603 | | - >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b>"; |
604 | | - } |
605 | | - if( $wgDBmysql5 ) { |
606 | | - if( $mysqlNewAuth ) { |
607 | | - print "; enabling MySQL 4.1/5.0 charset mode"; |
608 | | - } else { |
609 | | - print "; <b class='error'>MySQL 4.1/5.0 charset mode enabled, |
610 | | - but older version detected; will likely fail.</b>"; |
| 595 | + if ($conf->DBtype == 'mysql') { |
| 596 | + if( version_compare( $myver, "4.0.0" ) < 0 ) { |
| 597 | + die( " -- mysql 4.0 or later required. Aborting." ); |
611 | 598 | } |
612 | | - } |
613 | | - print "</li>\n"; |
| 599 | + $mysqlNewAuth = version_compare( $myver, "4.1.0", "ge" ); |
| 600 | + if( $mysqlNewAuth && $mysqlOldClient ) { |
| 601 | + print "; <b class='error'>You are using MySQL 4.1 server, but PHP is linked |
| 602 | + to old client libraries; if you have trouble with authentication, see |
| 603 | + <a href='http://dev.mysql.com/doc/mysql/en/old-client.html' |
| 604 | + >http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b>"; |
| 605 | + } |
| 606 | + if( $wgDBmysql5 ) { |
| 607 | + if( $mysqlNewAuth ) { |
| 608 | + print "; enabling MySQL 4.1/5.0 charset mode"; |
| 609 | + } else { |
| 610 | + print "; <b class='error'>MySQL 4.1/5.0 charset mode enabled, |
| 611 | + but older version detected; will likely fail.</b>"; |
| 612 | + } |
| 613 | + } |
| 614 | + print "</li>\n"; |
614 | 615 | |
615 | | - if ($conf->DBtype == 'mysql') { |
616 | 616 | @$sel = mysql_select_db( $wgDBname, $wgDatabase->mConn ); |
617 | 617 | if( $sel ) { |
618 | 618 | print "<li>Database <tt>" . htmlspecialchars( $wgDBname ) . "</tt> exists</li>\n"; |
— | — | @@ -640,7 +640,7 @@ |
641 | 641 | |
642 | 642 | # Create user if required |
643 | 643 | if ( $conf->Root ) { |
644 | | - $conn = Database::newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 ); |
| 644 | + $conn = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 ); |
645 | 645 | if ( $conn->isOpen() ) { |
646 | 646 | print "<li>DB user account ok</li>\n"; |
647 | 647 | $conn->close(); |
— | — | @@ -673,6 +673,9 @@ |
674 | 674 | dbsource( "../maintenance/tables.sql", $wgDatabase ); |
675 | 675 | } |
676 | 676 | dbsource( "../maintenance/interwiki.sql", $wgDatabase ); |
| 677 | + } else if ($conf->DBtype == 'postgres') { |
| 678 | + dbsource( "../maintenance/postgres/tables.sql", $wgDatabase ); |
| 679 | + $wgDatabase->update_interwiki(); |
677 | 680 | } else { |
678 | 681 | dbsource( "../maintenance/oracle/tables.sql", $wgDatabase ); |
679 | 682 | dbsource( "../maintenance/oracle/interwiki.sql", $wgDatabase ); |
— | — | @@ -690,7 +693,7 @@ |
691 | 694 | # Set up the "regular user" account *if we can, and if we need to* |
692 | 695 | if( $conf->Root ) { |
693 | 696 | # See if we need to |
694 | | - $wgDatabase2 = Database::newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 ); |
| 697 | + $wgDatabase2 = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 ); |
695 | 698 | if( $wgDatabase2->isOpen() ) { |
696 | 699 | # Nope, just close the test connection and continue |
697 | 700 | $wgDatabase2->close(); |
— | — | @@ -973,6 +976,7 @@ |
974 | 977 | <ul class='plain'> |
975 | 978 | <li><?php aField( $conf, "DBtype", "MySQL", "radio", "mysql"); ?></li> |
976 | 979 | <li><?php aField( $conf, "DBtype", "Oracle (experimental)", "radio", "oracle" ); ?></li> |
| 980 | + <li><?php aField( $conf, "DBtype", "PostgreSQL", "radio", "postgres" ); ?></li> |
977 | 981 | </ul> |
978 | 982 | </div> |
979 | 983 | |
— | — | @@ -981,7 +985,7 @@ |
982 | 986 | ?></div> |
983 | 987 | <p class="config-desc"> |
984 | 988 | If your database server isn't on your web server, enter the name |
985 | | - or IP address here. MySQL only. |
| 989 | + or IP address here. MySQL and PostgreSQL only. If using a port for PostgreSQL, enter the number here. |
986 | 990 | </p> |
987 | 991 | |
988 | 992 | <div class="config-input"><?php |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -2483,7 +2483,7 @@ |
2484 | 2484 | */ |
2485 | 2485 | function incViewCount( $id ) { |
2486 | 2486 | $id = intval( $id ); |
2487 | | - global $wgHitcounterUpdateFreq; |
| 2487 | + global $wgHitcounterUpdateFreq, $wgDBtype; |
2488 | 2488 | |
2489 | 2489 | $dbw =& wfGetDB( DB_MASTER ); |
2490 | 2490 | $pageTable = $dbw->tableName( 'page' ); |
— | — | @@ -2514,12 +2514,15 @@ |
2515 | 2515 | wfProfileIn( 'Article::incViewCount-collect' ); |
2516 | 2516 | $old_user_abort = ignore_user_abort( true ); |
2517 | 2517 | |
2518 | | - $dbw->query("LOCK TABLES $hitcounterTable WRITE"); |
2519 | | - $dbw->query("CREATE TEMPORARY TABLE $acchitsTable TYPE=HEAP ". |
| 2518 | + if ($wgDBtype == 'mysql') |
| 2519 | + $dbw->query("LOCK TABLES $hitcounterTable WRITE"); |
| 2520 | + $tabletype = $wgDBtype == 'mysql' ? "ENGINE=HEAP " : ''; |
| 2521 | + $dbw->query("CREATE TEMPORARY TABLE $acchitsTable $tabletype". |
2520 | 2522 | "SELECT hc_id,COUNT(*) AS hc_n FROM $hitcounterTable ". |
2521 | 2523 | 'GROUP BY hc_id'); |
2522 | 2524 | $dbw->query("DELETE FROM $hitcounterTable"); |
2523 | | - $dbw->query('UNLOCK TABLES'); |
| 2525 | + if ($wgDBtype == 'mysql') |
| 2526 | + $dbw->query('UNLOCK TABLES'); |
2524 | 2527 | $dbw->query("UPDATE $pageTable,$acchitsTable SET page_counter=page_counter + hc_n ". |
2525 | 2528 | 'WHERE page_id = hc_id'); |
2526 | 2529 | $dbw->query("DROP TABLE $acchitsTable"); |
Index: trunk/phase3/includes/SpecialDisambiguations.php |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | wfDebug("Mediawiki:disambiguationspage message does not refer to a template!\n"); |
49 | 49 | } |
50 | 50 | |
51 | | - $sql = "SELECT 'Disambiguations' AS 'type', pa.page_namespace AS namespace," |
| 51 | + $sql = "SELECT 'Disambiguations' AS \"type\", pa.page_namespace AS namespace," |
52 | 52 | ." pa.page_title AS title, la.pl_from AS value" |
53 | 53 | ." FROM {$templatelinks} AS lb, {$page} AS pa, {$pagelinks} AS la" |
54 | 54 | ." WHERE lb.tl_namespace = $dns AND lb.tl_title = $dtitle" # disambiguation template |
Index: trunk/phase3/includes/SpecialMostrevisions.php |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | FROM $revision |
38 | 38 | LEFT JOIN $page ON page_id = rev_page |
39 | 39 | WHERE page_namespace = " . NS_MAIN . " |
40 | | - GROUP BY rev_page |
| 40 | + GROUP BY rev_page, page_namespace, page_title |
41 | 41 | HAVING COUNT(*) > 1 |
42 | 42 | "; |
43 | 43 | } |
Index: trunk/phase3/includes/SpecialMostcategories.php |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | FROM $categorylinks |
36 | 36 | LEFT JOIN $page ON cl_from = page_id |
37 | 37 | WHERE page_namespace = " . NS_MAIN . " |
38 | | - GROUP BY cl_from |
| 38 | + GROUP BY cl_from, page_namespace, page_title |
39 | 39 | HAVING COUNT(*) > 1 |
40 | 40 | "; |
41 | 41 | } |
Index: trunk/phase3/includes/SpecialRecentchanges.php |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | * Constructor |
18 | 18 | */ |
19 | 19 | function wfSpecialRecentchanges( $par, $specialPage ) { |
20 | | - global $wgUser, $wgOut, $wgRequest, $wgUseRCPatrol; |
| 20 | + global $wgUser, $wgOut, $wgRequest, $wgUseRCPatrol, $wgDBtype; |
21 | 21 | global $wgRCShowWatchingUsers, $wgShowUpdatedMarker; |
22 | 22 | global $wgAllowCategorizedRecentChanges ; |
23 | 23 | $fname = 'wfSpecialRecentchanges'; |
— | — | @@ -162,7 +162,8 @@ |
163 | 163 | $uid = $wgUser->getID(); |
164 | 164 | |
165 | 165 | // Perform query |
166 | | - $sql2 = "SELECT * FROM $recentchanges FORCE INDEX (rc_timestamp) " . |
| 166 | + $forceclause = $dbr->useIndexClause("rc_timestamp"); |
| 167 | + $sql2 = "SELECT * FROM $recentchanges $forceclause". |
167 | 168 | ($uid ? "LEFT OUTER JOIN $watchlist ON wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace " : "") . |
168 | 169 | "WHERE rc_timestamp >= '{$cutoff}' {$hidem} " . |
169 | 170 | "ORDER BY rc_timestamp DESC"; |
Index: trunk/phase3/includes/Export.php |
— | — | @@ -187,8 +187,7 @@ |
188 | 188 | } |
189 | 189 | if( $cond == '' ) { |
190 | 190 | // Optimization hack for full-database dump |
191 | | - $pageindex = 'FORCE INDEX (PRIMARY)'; |
192 | | - $revindex = 'FORCE INDEX (PRIMARY)'; |
| 191 | + $revindex = $pageindex = $this->db->useIndexClause("PRIMARY"); |
193 | 192 | $straight = ' /*! STRAIGHT_JOIN */ '; |
194 | 193 | } else { |
195 | 194 | $pageindex = ''; |
Index: trunk/phase3/includes/SpecialWatchlist.php |
— | — | @@ -269,13 +269,13 @@ |
270 | 270 | } |
271 | 271 | |
272 | 272 | $sql = "SELECT |
273 | | - rc_namespace page_namespace,rc_title page_title, |
274 | | - rc_comment rev_comment, rc_cur_id page_id, |
275 | | - rc_user rev_user,rc_user_text rev_user_text, |
276 | | - rc_timestamp rev_timestamp,rc_minor rev_minor_edit, |
277 | | - rc_this_oldid rev_id, |
| 273 | + rc_namespace AS page_namespace, rc_title AS page_title, |
| 274 | + rc_comment AS rev_comment, rc_cur_id AS page_id, |
| 275 | + rc_user AS rev_user, rc_user_text AS rev_user_text, |
| 276 | + rc_timestamp AS rev_timestamp, rc_minor AS rev_minor_edit, |
| 277 | + rc_this_oldid AS rev_id, |
278 | 278 | rc_last_oldid, |
279 | | - rc_new page_is_new,wl_notificationtimestamp |
| 279 | + rc_new AS page_is_new,wl_notificationtimestamp |
280 | 280 | FROM $watchlist,$recentchanges,$page |
281 | 281 | WHERE wl_user=$uid |
282 | 282 | AND wl_namespace=rc_namespace |
Index: trunk/phase3/includes/SpecialMostlinked.php |
— | — | @@ -34,11 +34,10 @@ |
35 | 35 | pl_namespace AS namespace, |
36 | 36 | pl_title AS title, |
37 | 37 | COUNT(*) AS value, |
38 | | - |
39 | 38 | page_namespace |
40 | 39 | FROM $pagelinks |
41 | 40 | LEFT JOIN $page ON pl_namespace=page_namespace AND pl_title=page_title |
42 | | - GROUP BY pl_namespace,pl_title |
| 41 | + GROUP BY pl_namespace,pl_title,page_namespace |
43 | 42 | HAVING COUNT(*) > 1"; |
44 | 43 | } |
45 | 44 | |
Index: trunk/phase3/includes/Revision.php |
— | — | @@ -644,7 +644,6 @@ |
645 | 645 | ); |
646 | 646 | |
647 | 647 | $this->mId = !is_null($rev_id) ? $rev_id : $dbw->insertId(); |
648 | | - |
649 | 648 | wfProfileOut( $fname ); |
650 | 649 | return $this->mId; |
651 | 650 | } |
Index: trunk/phase3/includes/SpecialBrokenRedirects.php |
— | — | @@ -38,12 +38,10 @@ |
39 | 39 | p1.page_title AS title, |
40 | 40 | pl_namespace, |
41 | 41 | pl_title |
42 | | - FROM ($pagelinks, $page AS p1) |
43 | | - LEFT JOIN $page AS p2 |
44 | | - ON pl_namespace=p2.page_namespace AND pl_title=p2.page_title |
45 | | - WHERE p1.page_is_redirect=1 |
46 | | - AND pl_from=p1.page_id |
47 | | - AND p2.page_namespace IS NULL"; |
| 42 | + FROM $pagelinks AS pl |
| 43 | + JOIN $page p1 ON (p1.page_is_redirect=1 AND pl.pl_from=p1.page_id) |
| 44 | + LEFT JOIN $page AS p2 ON (pl_namespace=p2.page_namespace AND pl_title=p2.page_title |
| 45 | + AND p2.page_namespace IS NULL)"; |
48 | 46 | return $sql; |
49 | 47 | } |
50 | 48 | |
Index: trunk/phase3/includes/LoadBalancer.php |
— | — | @@ -334,6 +334,7 @@ |
335 | 335 | */ |
336 | 336 | function &getConnection( $i, $fail = true, $groups = array() ) |
337 | 337 | { |
| 338 | + global $wgDBtype; |
338 | 339 | $fname = 'LoadBalancer::getConnection'; |
339 | 340 | wfProfileIn( $fname ); |
340 | 341 | |
— | — | @@ -354,8 +355,12 @@ |
355 | 356 | } |
356 | 357 | } |
357 | 358 | |
| 359 | + # For now, only go through all this for mysql databases |
| 360 | + if ($wgDBtype != 'mysql') { |
| 361 | + $i = $this->getWriterIndex(); |
| 362 | + } |
358 | 363 | # Operation-based index |
359 | | - if ( $i == DB_SLAVE ) { |
| 364 | + elseif ( $i == DB_SLAVE ) { |
360 | 365 | $i = $this->getReaderIndex(); |
361 | 366 | } elseif ( $i == DB_MASTER ) { |
362 | 367 | $i = $this->getWriterIndex(); |
Index: trunk/phase3/includes/SpecialShortpages.php |
— | — | @@ -38,12 +38,13 @@ |
39 | 39 | $page = $dbr->tableName( 'page' ); |
40 | 40 | $name = $dbr->addQuotes( $this->getName() ); |
41 | 41 | |
| 42 | + $forceindex = $dbr->useIndexClause("page_len"); |
42 | 43 | return |
43 | 44 | "SELECT $name as type, |
44 | 45 | page_namespace as namespace, |
45 | 46 | page_title as title, |
46 | 47 | page_len AS value |
47 | | - FROM $page FORCE INDEX (page_len) |
| 48 | + FROM $page $forceindex |
48 | 49 | WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0"; |
49 | 50 | } |
50 | 51 | |
Index: trunk/phase3/includes/SpecialListusers.php |
— | — | @@ -135,7 +135,7 @@ |
136 | 136 | "FROM $user ". |
137 | 137 | "LEFT JOIN $user_groups ON user_id=ug_user " . |
138 | 138 | $this->userQueryWhere( $dbr ) . |
139 | | - " GROUP BY user_name"; |
| 139 | + " GROUP BY user_name, user_id"; |
140 | 140 | |
141 | 141 | return $sql; |
142 | 142 | } |
Index: trunk/phase3/includes/SpecialAncientpages.php |
— | — | @@ -28,15 +28,18 @@ |
29 | 29 | function isSyndicated() { return false; } |
30 | 30 | |
31 | 31 | function getSQL() { |
| 32 | + global $wgDBtype; |
32 | 33 | $db =& wfGetDB( DB_SLAVE ); |
33 | 34 | $page = $db->tableName( 'page' ); |
34 | 35 | $revision = $db->tableName( 'revision' ); |
35 | 36 | #$use_index = $db->useIndexClause( 'cur_timestamp' ); # FIXME! this is gone |
| 37 | + $epoch = $wgDBtype == 'mysql' ? 'UNIX_TIMESTAMP(rev_timestamp)' : |
| 38 | + 'EXTRACT(epoch FROM rev_timestamp)'; |
36 | 39 | return |
37 | 40 | "SELECT 'Ancientpages' as type, |
38 | 41 | page_namespace as namespace, |
39 | 42 | page_title as title, |
40 | | - UNIX_TIMESTAMP(rev_timestamp) as value |
| 43 | + $epoch as value |
41 | 44 | FROM $page, $revision |
42 | 45 | WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0 |
43 | 46 | AND page_latest=rev_id"; |
Index: trunk/phase3/includes/Database.php |
— | — | @@ -1687,6 +1687,7 @@ |
1688 | 1688 | |
1689 | 1689 | $cmd = ""; |
1690 | 1690 | $done = false; |
| 1691 | + $dollarquote = false; |
1691 | 1692 | |
1692 | 1693 | while ( ! feof( $fp ) ) { |
1693 | 1694 | $line = trim( fgets( $fp, 1024 ) ); |
— | — | @@ -1695,10 +1696,22 @@ |
1696 | 1697 | if ( $sl < 0 ) { continue; } |
1697 | 1698 | if ( '-' == $line{0} && '-' == $line{1} ) { continue; } |
1698 | 1699 | |
1699 | | - if ( ';' == $line{$sl} && ($sl < 2 || ';' != $line{$sl - 1})) { |
1700 | | - $done = true; |
1701 | | - $line = substr( $line, 0, $sl ); |
| 1700 | + ## Allow dollar quoting for function declarations |
| 1701 | + if (substr($line,0,4) == '$mw$') { |
| 1702 | + if ($dollarquote) { |
| 1703 | + $dollarquote = false; |
| 1704 | + $done = true; |
| 1705 | + } |
| 1706 | + else { |
| 1707 | + $dollarquote = true; |
| 1708 | + } |
1702 | 1709 | } |
| 1710 | + else if (!$dollarquote) { |
| 1711 | + if ( ';' == $line{$sl} && ($sl < 2 || ';' != $line{$sl - 1})) { |
| 1712 | + $done = true; |
| 1713 | + $line = substr( $line, 0, $sl ); |
| 1714 | + } |
| 1715 | + } |
1703 | 1716 | |
1704 | 1717 | if ( '' != $cmd ) { $cmd .= ' '; } |
1705 | 1718 | $cmd .= "$line\n"; |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -52,7 +52,9 @@ |
53 | 53 | * (bug 5537) Add stub language file for Samogitian (bat-smg); inherits Lithuanian (lt) |
54 | 54 | * Don't force edit summaries when a user is editing their own user/talk page |
55 | 55 | * (bug 5510) Warning produced when using {{SUBPAGENAME}} in some namespaces |
| 56 | +* (bug 385) Installer support for PostgreSQL, fixes for PG compatibility |
56 | 57 | |
| 58 | + |
57 | 59 | == Compatibility == |
58 | 60 | |
59 | 61 | Older PHP 4.2 and 4.1 releases are no longer supported; PHP 4 users must |
Index: trunk/phase3/install-utils.inc |
— | — | @@ -15,12 +15,18 @@ |
16 | 16 | die( -1 ); |
17 | 17 | } |
18 | 18 | |
19 | | - if (!extension_loaded('mysql')) { |
20 | | - if (!dl('mysql.so')) { |
21 | | - print 'Could not load MySQL driver! Please compile '. |
22 | | - "php --with-mysql or install the mysql.so module.\n"; |
| 19 | + $gotdatabase = 0; |
| 20 | + ## XXX We should quiet the warnings thrown here |
| 21 | + if (extension_loaded('mysql') or dl('mysql.so')) { |
| 22 | + $gotdatabase = 'mysql'; |
| 23 | + } |
| 24 | + else if (extension_loaded('pgsql') or dl('pgsql.so')) { |
| 25 | + $gotdatabase = 'pg'; |
| 26 | + } |
| 27 | + if (!$gotdatabase) { |
| 28 | + print "Could not load the MySQL or the PostgreSQL driver! Please compile ". |
| 29 | + "php with either --with-mysql or --with-pgsql, or install the mysql.so or pg.so module.\n"; |
23 | 30 | exit; |
24 | | - } |
25 | 31 | } |
26 | 32 | |
27 | 33 | global $wgCommandLineMode; |