diff --git a/src/Caddyfile b/src/Caddyfile new file mode 100644 index 0000000..ea7cbbf --- /dev/null +++ b/src/Caddyfile @@ -0,0 +1,9 @@ +{ + frankenphp + order php_server before file_server +} +http://localhost:8205 { + root ./public + try_files {uri} {uri}.php + php_server +} diff --git a/src/lib/Data.php b/src/lib/Data.php index d134744..39dea42 100644 --- a/src/lib/Data.php +++ b/src/lib/Data.php @@ -9,15 +9,17 @@ class Data { * @return SQLite3 A new connection to the database */ private static function getConnection(): SQLite3 { - $db = new SQLite3("../data/{${DATABASE_NAME}}"); + $db = new SQLite3('../data/' . DATABASE_NAME); $db->exec('PRAGMA foreign_keys = ON;'); return $db; } public static function ensureDb(): void { $db = self::getConnection(); - $tables = $db->query("SELECT name FROM sqlite_master WHERE type = 'table'")->fetchArray(SQLITE3_NUM); - if (!array_search('frc_user', $tables)) { + $tables = array(); + $tableQuery = $db->query("SELECT name FROM sqlite_master WHERE type = 'table'"); + while ($table = $tableQuery->fetchArray(SQLITE3_NUM)) $tables[] = $table[0]; + if (!in_array('frc_user', $tables)) { $query = <<exec($query); $db->exec('CREATE INDEX idx_user_email ON frc_user (email)'); } - if (!array_search('feed', $tables)) { + if (!in_array('feed', $tables)) { $query = <<exec($query); } - if (!array_search('item', $tables)) { + if (!in_array('item', $tables)) { $query = << +

Startup worked

+ + + + <?=$title?> | Feed Reader Central + +