diff --git a/docker/entrypoint-api.sh b/docker/entrypoint-api.sh index 1d4b8b4..7892d9b 100755 --- a/docker/entrypoint-api.sh +++ b/docker/entrypoint-api.sh @@ -1,4 +1,5 @@ #!/bin/sh mkdir -p /app/data -chown -R www-data:www-data /app/data 2>/dev/null || chmod -R 777 /app/data 2>/dev/null || true +chmod -R 777 /app/data +rm -f /app/data/*.lock exec docker-php-entrypoint "$@" \ No newline at end of file diff --git a/src/Api/Router.php b/src/Api/Router.php index 4317df9..9e20069 100644 --- a/src/Api/Router.php +++ b/src/Api/Router.php @@ -145,7 +145,7 @@ class Router return ['status' => 'logged_out']; } - private function createSource(): array + private function createSource(): mixed { $body = json_decode(file_get_contents('php://input'), true); $type = LogSourceType::from($body['type'] ?? ''); @@ -157,7 +157,7 @@ class Router ); } - private function createRule(): array + private function createRule(): mixed { $body = json_decode(file_get_contents('php://input'), true); return $this->repo->createRule( @@ -178,7 +178,7 @@ class Router return ['status' => 'deleted', 'id' => $id]; } - private function getAlerts(): array + private function getAlerts(): mixed { $limit = (int) ($_GET['limit'] ?? 100); $offset = (int) ($_GET['offset'] ?? 0); diff --git a/src/Storage/Database.php b/src/Storage/Database.php index 782fb89..5feb80a 100644 --- a/src/Storage/Database.php +++ b/src/Storage/Database.php @@ -14,6 +14,10 @@ class Database } @chmod($dir, 0777); + if (file_exists($path)) { + @chmod($path, 0666); + } + $this->pdo = new \PDO("sqlite:$path"); $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $this->pdo->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_ASSOC);