Skip to content

Commit

Permalink
Use database path as root to place tar inside
Browse files Browse the repository at this point in the history
  • Loading branch information
stevebauman committed Jan 22, 2024
1 parent b27e95e commit 97649f4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Drivers/MaxMind.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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);
}

/**
Expand Down

0 comments on commit 97649f4

Please sign in to comment.