/** * Install schema into the database * * @param string $filename location of database schema file * @param DB_common $conn connection to database * * @return boolean - indicating success or failure */ function runDbScript($filename, DB_common $conn) { $sql = trim(file_get_contents(INSTALLDIR . '/db/' . $filename)); $stmts = explode(';', $sql); foreach ($stmts as $stmt) { $stmt = trim($stmt); if (!mb_strlen($stmt)) { continue; } try { $res = $conn->simpleQuery($stmt); } catch (Exception $e) { $error = $e->getMessage(); $this->updateStatus("ERROR ({$error}) for SQL '{$stmt}'"); return false; } } return true; }