initialize db if not found
This commit is contained in:
parent
18a1358ef2
commit
4b54f5919a
1 changed files with 14 additions and 1 deletions
13
api.php
13
api.php
|
@ -1,6 +1,19 @@
|
|||
<?php
|
||||
|
||||
|
||||
$initialized = file_exists('outchat.db');
|
||||
|
||||
try {
|
||||
$database = new SQLite3('outchat.db');
|
||||
} catch (Exception $exception) {
|
||||
http_response_code(500);
|
||||
echo $exception;
|
||||
die(-1);
|
||||
}
|
||||
|
||||
if (!$initialized) {
|
||||
$database->exec(file_get_contents("outchat-ddl.sql"));
|
||||
}
|
||||
|
||||
$action = $_GET['action'];
|
||||
|
||||
|
|
Loading…
Reference in a new issue