Make sure that the configured database exists and that the user has write privileges ';
echo 'DSN: ' . rcube::Q($RCI->config['db_dsnw']) . '
';
}
}
else {
$RCI->fail('DSN (write)', 'not set');
}
}
else {
$RCI->fail('DSN (write)', 'Could not read config file');
}
// initialize db with schema found in /SQL/*
if ($db_working && !empty($_POST['initdb'])) {
if (!$RCI->init_db($DB)) {
$db_working = false;
echo '
Please try to inizialize the database manually as described in the INSTALL guide.
Make sure that the configured database extists and that the user as write privileges
';
}
}
else if ($db_working && !empty($_POST['updatedb'])) {
if (!$RCI->update_db($_POST['version'])) {
echo '
Database schema update failed.
';
}
}
// test database
if ($db_working) {
$db_read = $DB->query("SELECT count(*) FROM " . $DB->quote_identifier($RCI->config['db_prefix'] . 'users'));
if ($DB->is_error()) {
$RCI->fail('DB Schema', "Database not initialized");
echo '';
$db_working = false;
}
else if ($err = $RCI->db_schema_check($DB, $update = !empty($_POST['updatedb']))) {
$RCI->fail('DB Schema', "Database schema differs");
echo '
You should run the update queries to get the schema fixed.
Version to update from: ' . $select->show('') . '
';
$db_working = false;
}
else {
$RCI->pass('DB Schema');
echo ' ';
}
}
// more database tests
if ($db_working) {
// Using transactions to workaround SQLite bug (#7064)
if ($DB->db_provider == 'sqlite') {
$DB->startTransaction();
}
// write test
$insert_id = md5(uniqid());
$db_write = $DB->query("INSERT INTO " . $DB->quote_identifier($RCI->config['db_prefix'] . 'session')
. " (`sess_id`, `changed`, `ip`, `vars`) VALUES (?, ".$DB->now().", '127.0.0.1', 'foo')", $insert_id);
if ($db_write) {
$RCI->pass('DB Write');
$DB->query("DELETE FROM " . $DB->quote_identifier($RCI->config['db_prefix'] . 'session')
. " WHERE `sess_id` = ?", $insert_id);
}
else {
$RCI->fail('DB Write', $RCI->get_error());
}
echo ' ';
// Transaction end
if ($DB->db_provider == 'sqlite') {
$DB->rollbackTransaction();
}
// check timezone settings
$tz_db = 'SELECT ' . $DB->unixtimestamp($DB->now()) . ' AS tz_db';
$tz_db = $DB->query($tz_db);
$tz_db = $DB->fetch_assoc($tz_db);
$tz_db = (int) $tz_db['tz_db'];
$tz_local = (int) time();
$tz_diff = $tz_local - $tz_db;
// sometimes db and web servers are on separate hosts, so allow a 30 minutes delta
if (abs($tz_diff) > 1800) {
$RCI->fail('DB Time', "Database time differs {$tz_diff}s from PHP time");
}
else {
$RCI->pass('DB Time');
}
}
?>
Test filetype detection
check_mime_detection()) {
$RCI->fail('Fileinfo/mime_content_type configuration');
if (!empty($RCI->config['mime_magic'])) {
echo '
Try setting the mime_magic config option to null.
';
}
else {
echo '
Check the Fileinfo functions of your PHP installation. ';
echo 'The path to the magic.mime file can be set using the mime_magic config option in Roundcube.
Please set a valid path to your webserver\'s mime.types file to the mime_types config option. ';
echo 'If you can\'t find such a file, download it from svn.apache.org.
After completing the installation and the final tests please remove the whole
installer folder from the document root of the webserver or make sure that
enable_installer option in config.inc.php is disabled.
These files may expose sensitive configuration data like server passwords and encryption keys
to the public. Make sure you cannot access this installer from your browser.