Skip to content
Snippets Groups Projects
Commit 9c875151 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

disconnecting

parent 86c2dc25
No related branches found
No related tags found
No related merge requests found
......@@ -53,11 +53,15 @@ class AdminInterface extends Controller
}
$connection = new SQLiteConnection(new PDO("sqlite:$database_file"));
if (!$connection->getSchemaBuilder()->hasTable($day)) {
abort(404);
}
try {
if (!$connection->getSchemaBuilder()->hasTable($day)) {
abort(404);
}
$total_count = $connection->table($day)->count('*');
$total_count = $connection->table($day)->count('*');
} finally {
$connection->disconnect();
}
// No Cache for today
if (!now()->isSameDay($date)) {
Cache::put($cache_key, $total_count, now()->addWeek());
......@@ -95,12 +99,15 @@ class AdminInterface extends Controller
}
$connection = new SQLiteConnection(new PDO("sqlite:$database_file"));
if (!$connection->getSchemaBuilder()->hasTable($day)) {
abort(404);
}
$total_count = $connection->table($day)->whereTime("time", "<", $time)->count();
try {
if (!$connection->getSchemaBuilder()->hasTable($day)) {
abort(404);
}
$total_count = $connection->table($day)->whereTime("time", "<", $time)->count();
} finally {
$connection->disconnect();
}
$result = [
"status" => 200,
"error" => false,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment