From ad71e4263ef61efa0720ea6f08d6a9c582684c9b Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 19 Jan 2009 00:16:52 +0000 Subject: Replace exec("mysql") call with directy mysql() calls. --- installer/installer.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'installer') diff --git a/installer/installer.php b/installer/installer.php index 403f4260..986c7794 100644 --- a/installer/installer.php +++ b/installer/installer.php @@ -353,13 +353,13 @@ class installer { throw new Exception("'var/database.php' was not created"); } - $command = "mysql -h{$data['host']} " . - "-u{$data['user']} -p{$data['password']} {$data['database']} <" . - "\"installer/data/install.sql\""; - exec($command, $output, $status); - if ($status) { - print implode("\n", $output); - throw new Exception("Database initialization failed"); + $buf = ""; + foreach (file("installer/data/install.sql") as $line) { + $buf .= $line; + if (preg_match("/;$/", $buf)) { + mysql_query($buf); + $buf = ""; + } } if (file_put_contents("var/installed", "installed")) { -- cgit v1.2.3