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