/** * Initialize the database with the according schema * * @param rcube_db $db Database connection * * @return boolen True on success, False on error */ public function init_db($db) { $engine = $db->db_provider; // read schema file from /SQL/* $fname = INSTALL_PATH . "SQL/{$engine}.initial.sql"; if ($sql = @file_get_contents($fname)) { $db->set_option('table_prefix', $this->config['db_prefix']); $db->exec_script($sql); } else { $this->fail('DB Schema', "Cannot read the schema file: {$fname}"); return false; } if ($err = $this->get_error()) { $this->fail('DB Schema', "Error creating database schema: {$err}"); return false; } return true; }