Rework album/tag downloads #19

Merged
Roflin merged 6 commits from tag-download into master 2020-03-11 20:04:31 +01:00
Showing only changes of commit 1b7e83e11e - Show all commits

View File

@ -29,22 +29,16 @@ class Download
exit; exit;
} }
private function exportAlbum($album) private function exportAlbum(Tag $album)
{ {
$files = []; $files = [];
$album_ids = array_merge([$album->id_tag], $this->getChildAlbumIds($album->id_tag)); $album_ids = array_merge([$album->id_tag], $this->getChildAlbumIds($album->id_tag));
foreach($album_ids as $album_id) foreach($album_ids as $album_id)
{ {
$iterator = AssetIterator::getByOptions( $iterator = AssetIterator::getByOptions(['id_tag' => $album_id]);
[ while ($asset = $iterator->next())
'id_tag' => $album_id $files[] = join(DIRECTORY_SEPARATOR, [$asset->getSubdir(), $asset->getFilename()]);
]
);
while($asset = $iterator->Next())
{
$files[] = join(DIRECTORY_SEPARATOR, ['.', $asset->getSubdir(), $asset->getFilename()]);
}
} }
$descriptorspec = [ $descriptorspec = [
@ -52,7 +46,7 @@ class Download
1 => ['pipe', 'w'], 1 => ['pipe', 'w'],
]; ];
$command = 'tar --null -cf - -T -'; $command = 'tar -cf - -C ' . escapeshellarg(ASSETSDIR) . ' --null -T -';
$proc = proc_open($command, $descriptorspec, $pipes, ASSETSDIR); $proc = proc_open($command, $descriptorspec, $pipes, ASSETSDIR);