diff --git a/src/Drivers/MaxMind.php b/src/Drivers/MaxMind.php index 9eb55af..f2d7967 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 { + @mkdir( + $root = Str::beforeLast($this->getDatabasePath(), DIRECTORY_SEPARATOR) + ); + $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); } /**