From: Christian Weiske Date: Sun, 4 Jun 2023 11:33:18 +0000 (+0200) Subject: Add setupcheck script X-Git-Url: https://git.cweiske.de/gamestick-pjgsapi.git/commitdiff_plain/8fc78d10037b561ef5494d20083933c3f9442df3 Add setupcheck script --- 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 @@ +