diff options
| author | Greg Roach <greg@subaqua.co.uk> | 2020-12-27 20:12:27 +0000 |
|---|---|---|
| committer | Greg Roach <greg@subaqua.co.uk> | 2021-03-11 10:22:29 +0000 |
| commit | f7cf8a155e2743f3d124eef3d30a558ab062fa4b (patch) | |
| tree | a45052d9dc68b2049f4848e1043f56f6782ad3dd /app/Http/RequestHandlers/CleanDataFolder.php | |
| parent | 7989fe578b0082b5d3378ee0b461904deb3802d1 (diff) | |
| download | webtrees-f7cf8a155e2743f3d124eef3d30a558ab062fa4b.tar.gz webtrees-f7cf8a155e2743f3d124eef3d30a558ab062fa4b.tar.bz2 webtrees-f7cf8a155e2743f3d124eef3d30a558ab062fa4b.zip | |
Remove vendor dir, add support for PHP 8.0, drop support for PHP 7.1 and 7.2
Diffstat (limited to 'app/Http/RequestHandlers/CleanDataFolder.php')
| -rw-r--r-- | app/Http/RequestHandlers/CleanDataFolder.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/app/Http/RequestHandlers/CleanDataFolder.php b/app/Http/RequestHandlers/CleanDataFolder.php index 9a821ca404..9cc7200a17 100644 --- a/app/Http/RequestHandlers/CleanDataFolder.php +++ b/app/Http/RequestHandlers/CleanDataFolder.php @@ -23,6 +23,8 @@ use Fisharebest\Webtrees\Http\ViewResponseTrait; use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Registry; use Fisharebest\Webtrees\Services\TreeService; +use League\Flysystem\Filesystem; +use League\Flysystem\StorageAttributes; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; @@ -81,13 +83,14 @@ class CleanDataFolder implements RequestHandlerInterface } // List the top-level contents of the data folder - $entries = array_map(static function (array $content) { - if ($content['type'] === 'dir') { - return $content['path'] . '/'; - } + $entries = $data_filesystem->listContents('', Filesystem::LIST_SHALLOW) + ->map(static function (StorageAttributes $attributes): string { + if ($attributes->isDir()) { + return $attributes->path() . '/'; + } - return $content['path']; - }, $data_filesystem->listContents()); + return $attributes->path(); + }); return $this->viewResponse('admin/clean-data', [ 'title' => I18N::translate('Clean up data folder'), |
