From 65e28bc678b1d9fc0b6af4cb848cfde338b2f01c Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sun, 11 Jan 2009 23:08:23 +0000 Subject: Moving slowly forward on the batch installer. It now connects to the database and checks that the supplied database is defined. --- installer/libraries/Install_Mysql_Driver.php | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 installer/libraries/Install_Mysql_Driver.php (limited to 'installer/libraries/Install_Mysql_Driver.php') diff --git a/installer/libraries/Install_Mysql_Driver.php b/installer/libraries/Install_Mysql_Driver.php new file mode 100644 index 00000000..ae44e040 --- /dev/null +++ b/installer/libraries/Install_Mysql_Driver.php @@ -0,0 +1,44 @@ +link = @mysql_connect($server, $user, $password); + if (!$this->link) { + throw new Exception(mysql_error()); + } + } + + public function __destruct() { + if (!empty($this->link)) { + @mysql_close($this->link); + } + } + + public function list_dbs() { + $db_list = mysql_list_dbs($this->link); + $databases = array(); + while ($row = mysql_fetch_object($db_list)) { + $databases[$row->Database] = 1; + } + return $databases; + } +} -- cgit v1.2.3