Skip to content

Commit

Permalink
Smaller restriction files
Browse files Browse the repository at this point in the history
  • Loading branch information
kduma committed Dec 17, 2023
1 parent 69d1a5a commit 03b8c60
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/Extensions/FileRestrictionsMapFileGeneratorExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,13 @@ public function hook(BuildStateInterface $buildState): void
->groupBy('url')
->map(function (Collection $packages) {
return $packages->pluck('tags')->flatten();
});
})
->filter(fn (Collection $tags, string $url) => !str($url)->startsWith(['http://', 'https://']));

Storage::disk('temp')->put(str('file_restrictions.json')->start('/')->start($buildState->getTempPrefix()), json_encode($packages->toArray(), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
Storage::disk('temp')->deleteDirectory('file_restrictions');
$packages->each(function (Collection $tags, string $url) use ($buildState) {
$path = str('_file_restrictions')->append('/')->append($url)->append('.json')->start('/')->start($buildState->getTempPrefix());
Storage::disk('temp')->put($path, $tags->toJson(JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
});
}
}

0 comments on commit 03b8c60

Please sign in to comment.