diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index d9d9011f4af5a2e7b7679df622e8d03aa8cd28c5..02d463dc1a95a9dd834d2f16e713352e8cb4c413 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -33,7 +33,7 @@ spec: secretName: {{ template "secret_name" . }} - name: mglogs-persistent-storage persistentVolumeClaim: - claimName: mg-logs + claimName: mglogs - name: redis-config configMap: name: {{ include "chart.fullname" . }}-redis-container-config diff --git a/metager/app/Http/Controllers/AdminInterface.php b/metager/app/Http/Controllers/AdminInterface.php index f45f272a840fce148536ed7b5a38d1eca9d7097d..f038bf55b1a6cdc7eabda7e23fc562593b7b472f 100644 --- a/metager/app/Http/Controllers/AdminInterface.php +++ b/metager/app/Http/Controllers/AdminInterface.php @@ -52,7 +52,7 @@ class AdminInterface extends Controller abort(404); } - $connection = new SQLiteConnection(new PDO("sqlite:$database_file")); + $connection = new SQLiteConnection(new PDO("sqlite:$database_file", null, null, [PDO::SQLITE_ATTR_OPEN_FLAGS => PDO::SQLITE_OPEN_READONLY])); try { if (!$connection->getSchemaBuilder()->hasTable("logs")) { abort(404); @@ -63,7 +63,7 @@ class AdminInterface extends Controller $connection->disconnect(); } // No Cache for today - if (!now()->isSameDay($date)) { + if ($date->isToday()) { Cache::put($cache_key, $total_count, now()->addWeek()); } } @@ -98,7 +98,7 @@ class AdminInterface extends Controller abort(404); } - $connection = new SQLiteConnection(new PDO("sqlite:$database_file")); + $connection = new SQLiteConnection(new PDO("sqlite:$database_file", null, null, [PDO::SQLITE_ATTR_OPEN_FLAGS => PDO::SQLITE_OPEN_READONLY])); try { if (!$connection->getSchemaBuilder()->hasTable("logs")) { abort(404); diff --git a/metager/app/QueryLogger.php b/metager/app/QueryLogger.php index efcbc9c67ed74fcb7b2a5ef6edf11f1d61cef075..049295189fe28c1266a63bf966cc24826258c150 100644 --- a/metager/app/QueryLogger.php +++ b/metager/app/QueryLogger.php @@ -249,7 +249,7 @@ class QueryLogger return null; } - $connection = new SQLiteConnection(new PDO('sqlite:' . $current_database)); + $connection = new SQLiteConnection(new PDO('sqlite:' . $current_database, null, null, [PDO::SQLITE_ATTR_OPEN_FLAGS => PDO::SQLITE_OPEN_READONLY])); if (!$connection->getSchemaBuilder()->hasTable($current_table)) { return null; } diff --git a/metager/resources/js/admin/count.js b/metager/resources/js/admin/count.js index b9f81d8da26f4d68cc588d6cb074600803b1d1f9..2210ad25259d9dea1605fb73edd3e3490712248c 100644 --- a/metager/resources/js/admin/count.js +++ b/metager/resources/js/admin/count.js @@ -107,13 +107,7 @@ function loadTotals(parallel) { let days_ago = parseInt(element.parentNode.dataset.days_ago) - let total_requests = parseInt(localStorage.getItem("totals-" + date)); - if (total_requests) { - if (!data[days_ago]) { - data[days_ago] = {} - } - data[days_ago]["total"] = total_requests; - } else if (fetches.length < parallel) { + if (fetches.length < parallel) { fetches.push(fetch('/admin/count/count-data-total?date=' + date) .then(response => response.json()) .then(response => { @@ -122,9 +116,6 @@ function loadTotals(parallel) { data[days_ago] = {} } data[days_ago]["total"] = total_requests; - if (i > 0) { - localStorage.setItem("totals-" + date, total_requests); - } }) .catch(reason => { if (!data[days_ago]) { @@ -149,13 +140,7 @@ function loadSameTimes(parallel) { let days_ago = parseInt(element.parentNode.dataset.days_ago) - let total_requests = parseInt(localStorage.getItem("until-" + date)) - if (total_requests) { - if (!data[days_ago]) { - data[days_ago] = {} - } - data[days_ago]["same_time"] = total_requests; - } else if (fetches.length < parallel) { + if (fetches.length < parallel) { fetches.push(fetch('/admin/count/count-data-until?date=' + date) .then(response => response.json()) .then(response => {