Compare commits
1 Commits
ai/issue-6
...
ai/issue-2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0d6f1bfc5 |
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Luca Haid
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
// Health check endpoint - returns number of tables in thetool database
|
||||
|
||||
// Define required constants before loading config
|
||||
define('FRONKDB_SQLDEBUG', false);
|
||||
|
||||
// Load the framework's database configuration
|
||||
require_once(__DIR__ . "/../../config/config.php");
|
||||
|
||||
// Load the autoloader to get FronkDB class
|
||||
require_once(__DIR__ . "/../../lib/autoloader/autoloader.php");
|
||||
require_once(__DIR__ . "/../../lib/mvcfronk/mfLog/mfLoghandler.php");
|
||||
require_once(__DIR__ . "/../../lib/FronkDB/FronkDB.php");
|
||||
|
||||
// Connect to the database using the framework's configuration
|
||||
$db = new FronkDB(
|
||||
FRONKDB_DBHOST,
|
||||
FRONKDB_DBUSER,
|
||||
FRONKDB_DBPASS,
|
||||
FRONKDB_DBNAME
|
||||
);
|
||||
|
||||
// Query to count tables in the thetool database
|
||||
$sql = "SELECT COUNT(*) as count FROM information_schema.tables WHERE table_schema = 'thetool'";
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$row = $db->fetch_array($result);
|
||||
$tableCount = (int)$row['count'];
|
||||
} else {
|
||||
$tableCount = 0;
|
||||
}
|
||||
|
||||
// Return JSON response
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(['tables' => $tableCount]);
|
||||
Reference in New Issue
Block a user