From 97649f4b290d68c5dd6eb0da968badada20ba587 Mon Sep 17 00:00:00 2001 From: Steve Bauman Date: Mon, 22 Jan 2024 14:15:40 -0500 Subject: [PATCH 1/3] Use database path as root to place tar inside --- src/Drivers/MaxMind.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Drivers/MaxMind.php b/src/Drivers/MaxMind.php index 9eb55af..ed3fb71 100644 --- a/src/Drivers/MaxMind.php +++ b/src/Drivers/MaxMind.php @@ -23,9 +23,13 @@ class MaxMind extends Driver implements Updatable */ public function update(Command $command): void { + $root = Str::beforeLast($this->getDatabasePath(), DIRECTORY_SEPARATOR); + + @mkdir($root); + $storage = Storage::build([ 'driver' => 'local', - 'root' => sys_get_temp_dir(), + 'root' => $root, ]); $storage->put( @@ -44,14 +48,12 @@ public function update(Command $command): void $archive->extractTo($storage->path('/'), $relativePath, true); - @mkdir( - Str::beforeLast($this->getDatabasePath(), DIRECTORY_SEPARATOR) - ); - file_put_contents( $this->getDatabasePath(), fopen($storage->path($relativePath), 'r') ); + + $storage->delete($tar); } /** From f349db0fac34afdbf5ce0a020e9a3fa30c6e0307 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Mon, 22 Jan 2024 19:15:51 +0000 Subject: [PATCH 2/3] Apply fixes from StyleCI --- src/Drivers/Cloudflare.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Drivers/Cloudflare.php b/src/Drivers/Cloudflare.php index 5de2009..e23902d 100644 --- a/src/Drivers/Cloudflare.php +++ b/src/Drivers/Cloudflare.php @@ -27,7 +27,7 @@ protected function process(Request $request): Fluent|false 'countryCode' => $countryCode, 'cityName' => $request->getHeader('cf-ipcity'), 'longitude' => $request->getHeader('cf-iplongitude'), - 'latitude' => $request->getHeader('cf-iplatitude'), + 'latitude' => $request->getHeader('cf-iplatitude'), ]); } From fe128d4dd6236fbd9d40c58861ad6c77de928b83 Mon Sep 17 00:00:00 2001 From: Steve Bauman Date: Mon, 22 Jan 2024 14:16:16 -0500 Subject: [PATCH 3/3] Small tweak --- src/Drivers/MaxMind.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Drivers/MaxMind.php b/src/Drivers/MaxMind.php index ed3fb71..f2d7967 100644 --- a/src/Drivers/MaxMind.php +++ b/src/Drivers/MaxMind.php @@ -23,9 +23,9 @@ class MaxMind extends Driver implements Updatable */ public function update(Command $command): void { - $root = Str::beforeLast($this->getDatabasePath(), DIRECTORY_SEPARATOR); - - @mkdir($root); + @mkdir( + $root = Str::beforeLast($this->getDatabasePath(), DIRECTORY_SEPARATOR) + ); $storage = Storage::build([ 'driver' => 'local',