r34404 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r34403‎ | r34404 | r34405 >
Date:23:38, 7 May 2008
Author:nad
Status:old
Tags:
Comment:
Add SQLite database class
Modified paths:
  • /trunk/phase3/config/index.php (modified) (history)
  • /trunk/phase3/includes/Database.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Database.php
@@ -2212,7 +2212,7 @@
22132213 */
22142214 class MySQLField {
22152215 private $name, $tablename, $default, $max_length, $nullable,
2216 - $is_pk, $is_unique, $is_key, $type;
 2216+ $is_pk, $is_unique, $is_multiple, $is_key, $type;
22172217 function __construct ($info) {
22182218 $this->name = $info->name;
22192219 $this->tablename = $info->table;
Index: trunk/phase3/config/index.php
@@ -67,6 +67,12 @@
6868 $ourdb['postgres']['bgcolor'] = '#aaccff';
6969 $ourdb['postgres']['rootuser'] = 'postgres';
7070
 71+$ourdb['sqlite']['fullname'] = 'SQLite';
 72+$ourdb['sqlite']['havedriver'] = 0;
 73+$ourdb['sqlite']['compile'] = 'pdo_sqlite';
 74+$ourdb['sqlite']['bgcolor'] = '#b1ebb1';
 75+$ourdb['sqlite']['rootuser'] = 'root';
 76+
7177 ?>
7278 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
7379 <html>
@@ -828,11 +834,11 @@
829835
830836 if( !$ok ) { continue; }
831837
832 - } else /* not mysql */ {
 838+ } else { # not mysql
833839 error_reporting( E_ALL );
834840 $wgSuperUser = '';
835841 ## Possible connect as a superuser
836 - if( $useRoot ) {
 842+ if( $useRoot && $conf->DBtype != 'sqlite' ) {
837843 $wgDBsuperuser = $conf->RootUser;
838844 echo( "<li>Attempting to connect to database \"postgres\" as superuser \"$wgDBsuperuser\"..." );
839845 $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBsuperuser, $conf->RootPW, "postgres", 1);
@@ -852,8 +858,8 @@
853859 } else {
854860 $myver = $wgDatabase->getServerVersion();
855861 }
856 - $wgDatabase->initial_setup('', $wgDBname);
857 - }
 862+ if (is_callable(array($wgDatabase, 'initial_setup'))) $wgDatabase->initial_setup('', $wgDBname);
 863+ }
858864
859865 if ( !$wgDatabase->isOpen() ) {
860866 $errs["DBserver"] = "Couldn't connect to database";
@@ -1006,7 +1012,7 @@
10071013 if ($conf->DBtype == 'mysql') {
10081014 dbsource( "../maintenance/tables.sql", $wgDatabase );
10091015 dbsource( "../maintenance/interwiki.sql", $wgDatabase );
1010 - } else if ($conf->DBtype == 'postgres') {
 1016+ } elseif (is_callable(array($wgDatabase, 'setup_database'))) {
10111017 $wgDatabase->setup_database();
10121018 }
10131019 else {

Status & tagging log