From 8fc78d10037b561ef5494d20083933c3f9442df3 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Sun, 4 Jun 2023 13:33:18 +0200 Subject: [PATCH] Add setupcheck script --- src/ProfileDb.php | 7 +++++- www/setupcheck.php | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 www/setupcheck.php diff --git a/src/ProfileDb.php b/src/ProfileDb.php index 5eed726..29f3eda 100644 --- a/src/ProfileDb.php +++ b/src/ProfileDb.php @@ -10,7 +10,7 @@ class ProfileDb public function __construct() { - $dbFile = dirname(__FILE__, 2) . '/data/profiles.sqlite3'; + $dbFile = static::getDbFilePath(); $this->db = new PDO( 'sqlite:' . $dbFile, '', '', @@ -22,6 +22,11 @@ class ProfileDb $this->createTablesIfNeeded(); } + public static function getDbFilePath() + { + return dirname(__FILE__, 2) . '/data/profiles.sqlite3'; + } + public function getProfileByHardwareId(string $hwId): ?Profile { $stmt = $this->db->prepare('SELECT * FROM gamesticks WHERE hwId = :id'); diff --git a/www/setupcheck.php b/www/setupcheck.php new file mode 100644 index 0000000..715f6b0 --- /dev/null +++ b/www/setupcheck.php @@ -0,0 +1,62 @@ + -- 2.30.2