summaryrefslogtreecommitdiff
path: root/installer/rcube_install.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-06-19 11:33:23 +0200
committerAleksander Machniak <alec@alec.pl>2012-06-19 11:33:23 +0200
commit398bff59254590cbaebec7d62b1f000f271648aa (patch)
treebf19440568e83a8cab1171532a549b7f56d87094 /installer/rcube_install.php
parent0d94fd45f422fe0d0460f5db7a7761f56bc18236 (diff)
Replace rcube_mdb2/PEAR::MDB2 with rcube_db
Diffstat (limited to 'installer/rcube_install.php')
-rw-r--r--installer/rcube_install.php94
1 files changed, 13 insertions, 81 deletions
diff --git a/installer/rcube_install.php b/installer/rcube_install.php
index 01238596b..331e29625 100644
--- a/installer/rcube_install.php
+++ b/installer/rcube_install.php
@@ -50,6 +50,17 @@ class rcube_install
'des_key', 'session_lifetime', 'support_url',
);
+ // list of supported database drivers
+ var $supported_dbs = array(
+ 'MySQL' => 'pdo_mysql',
+ 'PostgreSQL' => 'pdo_pgsql',
+ 'SQLite' => 'pdo_sqlite',
+ 'SQLite (v2)' => 'pdo_sqlite2',
+ 'SQL Server (SQLSRV)' => 'pdo_sqlsrv',
+ 'SQL Server (DBLIB)' => 'pdo_dblib',
+ );
+
+
/**
* Constructor
*/
@@ -371,7 +382,7 @@ class rcube_install
$errors[] = "Missing columns in table '$table': " . join(',', $diff);
}
}
-
+
return !empty($errors) ? $errors : false;
}
@@ -394,87 +405,8 @@ class rcube_install
}
}
}
-
- return $schema;
- }
-
-
- /**
- * Compare the local database schema with the reference schema
- * required for this version of Roundcube
- *
- * @param boolean True if the schema schould be updated
- * @return boolean True if the schema is up-to-date, false if not or an error occured
- */
- function mdb2_schema_check($update = false)
- {
- if (!$this->configured)
- return false;
-
- $options = array(
- 'use_transactions' => false,
- 'log_line_break' => "\n",
- 'idxname_format' => '%s',
- 'debug' => false,
- 'quote_identifier' => true,
- 'force_defaults' => false,
- 'portability' => true
- );
-
- $dsnw = $this->config['db_dsnw'];
- $schema = MDB2_Schema::factory($dsnw, $options);
- $schema->db->supported['transactions'] = false;
-
- if (PEAR::isError($schema)) {
- $this->raise_error(array('code' => $schema->getCode(), 'message' => $schema->getMessage() . ' ' . $schema->getUserInfo()));
- return false;
- }
- else {
- $definition = $schema->getDefinitionFromDatabase();
- $definition['charset'] = 'utf8';
-
- if (PEAR::isError($definition)) {
- $this->raise_error(array('code' => $definition->getCode(), 'message' => $definition->getMessage() . ' ' . $definition->getUserInfo()));
- return false;
- }
-
- // load reference schema
- $dsn_arr = MDB2::parseDSN($this->config['db_dsnw']);
-
- $ref_schema = INSTALL_PATH . 'SQL/' . $dsn_arr['phptype'] . '.schema.xml';
-
- if (is_readable($ref_schema)) {
- $reference = $schema->parseDatabaseDefinition($ref_schema, false, array(), $schema->options['fail_on_invalid_names']);
-
- if (PEAR::isError($reference)) {
- $this->raise_error(array('code' => $reference->getCode(), 'message' => $reference->getMessage() . ' ' . $reference->getUserInfo()));
- }
- else {
- $diff = $schema->compareDefinitions($reference, $definition);
-
- if (empty($diff)) {
- return true;
- }
- else if ($update) {
- // update database schema with the diff from the above check
- $success = $schema->alterDatabase($reference, $definition, $diff);
-
- if (PEAR::isError($success)) {
- $this->raise_error(array('code' => $success->getCode(), 'message' => $success->getMessage() . ' ' . $success->getUserInfo()));
- }
- else
- return true;
- }
- echo '<pre>'; var_dump($diff); echo '</pre>';
- return false;
- }
- }
- else
- $this->raise_error(array('message' => "Could not find reference schema file ($ref_schema)"));
- return false;
- }
- return false;
+ return $schema;
}