From 921fb9eb40da1a063e08429cb25a96ff83622d8e Mon Sep 17 00:00:00 2001 From: Aran Dunkley Date: Wed, 7 May 2008 23:38:37 +0000 Subject: [PATCH] Add SQLite database class --- config/index.php | 16 +++++++++++----- includes/Database.php | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/config/index.php b/config/index.php index 1ca13b40f8..3bf95c11d5 100644 --- a/config/index.php +++ b/config/index.php @@ -67,6 +67,12 @@ $ourdb['postgres']['compile'] = 'pgsql'; $ourdb['postgres']['bgcolor'] = '#aaccff'; $ourdb['postgres']['rootuser'] = 'postgres'; +$ourdb['sqlite']['fullname'] = 'SQLite'; +$ourdb['sqlite']['havedriver'] = 0; +$ourdb['sqlite']['compile'] = 'pdo_sqlite'; +$ourdb['sqlite']['bgcolor'] = '#b1ebb1'; +$ourdb['sqlite']['rootuser'] = 'root'; + ?> @@ -828,11 +834,11 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) { if( !$ok ) { continue; } - } else /* not mysql */ { + } else { # not mysql error_reporting( E_ALL ); $wgSuperUser = ''; ## Possible connect as a superuser - if( $useRoot ) { + if( $useRoot && $conf->DBtype != 'sqlite' ) { $wgDBsuperuser = $conf->RootUser; echo( "
  • Attempting to connect to database \"postgres\" as superuser \"$wgDBsuperuser\"..." ); $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBsuperuser, $conf->RootPW, "postgres", 1); @@ -852,8 +858,8 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) { } else { $myver = $wgDatabase->getServerVersion(); } - $wgDatabase->initial_setup('', $wgDBname); - } + if (is_callable(array($wgDatabase, 'initial_setup'))) $wgDatabase->initial_setup('', $wgDBname); + } if ( !$wgDatabase->isOpen() ) { $errs["DBserver"] = "Couldn't connect to database"; @@ -1006,7 +1012,7 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) { if ($conf->DBtype == 'mysql') { dbsource( "../maintenance/tables.sql", $wgDatabase ); dbsource( "../maintenance/interwiki.sql", $wgDatabase ); - } else if ($conf->DBtype == 'postgres') { + } elseif (is_callable(array($wgDatabase, 'setup_database'))) { $wgDatabase->setup_database(); } else { diff --git a/includes/Database.php b/includes/Database.php index 9b79ad6c0d..a63f0a19ab 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -2212,7 +2212,7 @@ class Blob { */ class MySQLField { private $name, $tablename, $default, $max_length, $nullable, - $is_pk, $is_unique, $is_key, $type; + $is_pk, $is_unique, $is_multiple, $is_key, $type; function __construct ($info) { $this->name = $info->name; $this->tablename = $info->table; -- 2.20.1