diff --git a/config/config.default.php b/config/config.default.php index 0423d2b88..e0dbb5347 100644 --- a/config/config.default.php +++ b/config/config.default.php @@ -17,6 +17,7 @@ 'user' => getenv('XHGUI_PDO_USER') ?: null, 'pass' => getenv('XHGUI_PDO_PASS') ?: null, 'table' => getenv('XHGUI_PDO_TABLE') ?: 'results', + 'tableWatch' => getenv('XHGUI_PDO_TABLE_WATCHES') ?: 'watches', ], // Database options for MongoDB. diff --git a/src/Db/PdoRepository.php b/src/Db/PdoRepository.php index ba91295af..4a86c43ca 100644 --- a/src/Db/PdoRepository.php +++ b/src/Db/PdoRepository.php @@ -20,12 +20,13 @@ class PdoRepository /** * @param PDO $pdo An open database connection * @param string $table Table name where Xhgui profiles are stored + * @param string $tableWatch Table name where Xhgui watch functions are stored */ - public function __construct(PDO $pdo, string $table) + public function __construct(PDO $pdo, string $table, string $tableWatch) { $this->pdo = $pdo; $this->tableResults = sprintf('"%s"', $table); - $this->tableWatches = 'watches'; + $this->tableWatches = sprintf('"%s"', $tableWatch); } public function getLatest(): array diff --git a/src/ServiceProvider/PdoStorageProvider.php b/src/ServiceProvider/PdoStorageProvider.php index 5bf22f181..232d0b60a 100644 --- a/src/ServiceProvider/PdoStorageProvider.php +++ b/src/ServiceProvider/PdoStorageProvider.php @@ -44,7 +44,11 @@ public function register(Container $app): void }; $app[PdoRepository::class] = static function ($app) { - return new PdoRepository($app['pdo'], $app['config']['pdo']['table']); + return new PdoRepository( + $app['pdo'], + $app['config']['pdo']['table'], + $app['config']['pdo']['tableWatch'] + ); }; $app['searcher.pdo'] = static function ($app) {