mirror of
https://github.com/pi-hole/web.git
synced 2026-04-21 17:29:11 +01:00
@@ -24,38 +24,8 @@ else
|
||||
$GRAVITYDB = "/etc/pihole/gravity.db";
|
||||
}
|
||||
|
||||
function SQLite3_connect($dbfile, $trytoreconnect)
|
||||
{
|
||||
try
|
||||
{
|
||||
// connect to database
|
||||
return new SQLite3($dbfile, SQLITE3_OPEN_READONLY);
|
||||
}
|
||||
catch (Exception $exception)
|
||||
{
|
||||
// sqlite3 throws an exception when it is unable to connect, try to reconnect after 3 seconds
|
||||
if($trytoreconnect)
|
||||
{
|
||||
sleep(3);
|
||||
$db = SQLite3_connect($dbfile, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(strlen($GRAVITYDB) > 0)
|
||||
{
|
||||
$db = SQLite3_connect($GRAVITYDB, true);
|
||||
|
||||
// Check if we successfully opened the database
|
||||
if(!$db)
|
||||
{
|
||||
die("Error connecting to database");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
die("No database available");
|
||||
}
|
||||
require("database.php");
|
||||
$db = SQLite3_connect($GRAVITYDB);
|
||||
|
||||
function getTableContent($listname) {
|
||||
global $db;
|
||||
|
||||
Reference in New Issue
Block a user