diff --git a/app.php b/app.php index 6ef0d72..03392a0 100644 --- a/app.php +++ b/app.php @@ -27,6 +27,6 @@ set_error_handler('ErrorHandler::handleError'); ini_set("display_errors", DEBUG ? "On" : "Off"); // The real magic starts here! -ob_start(); +ob_start(null, 32768); Dispatcher::dispatch(); ob_end_flush(); diff --git a/controllers/Download.php b/controllers/Download.php index b1bcb95..c466100 100644 --- a/controllers/Download.php +++ b/controllers/Download.php @@ -53,20 +53,6 @@ class Download extends HTMLController { $files = array(); - $album_ids = array_merge(array($album->id_tag), $this->getChildAlbumIds($album->id_tag)); - foreach($album_ids as $album_id) - { - $iterator = AssetIterator::getByOptions( - array( - 'id_tag' => $album_id - ) - ); - while($asset = $iterator->Next()) - { - $files[] = join(DIRECTORY_SEPARATOR, array('.', $asset->getSubdir(), $asset->getFilename())); - } - } - $descriptorspec = array( 0 => array('pipe', 'r'), 1 => array('pipe', 'w'), @@ -93,8 +79,19 @@ class Download extends HTMLController header('Content-Type: application/octet-stream'); header('Content-Transfer-Encoding: binary'); - foreach($files as $file) - fwrite($pipes[0], $file . "\0"); + $album_ids = array_merge(array($album->id_tag), $this->getChildAlbumIds($album->id_tag)); + foreach($album_ids as $album_id) + { + $iterator = AssetIterator::getByOptions( + array( + 'id_tag' => $album_id + ) + ); + while($asset = $iterator->Next()) + { + fwrite($pipes[0], join(DIRECTORY_SEPARATOR, array('.', $asset->getSubdir(), $asset->getFilename())) . "\0"); + } + } fclose($pipes[0]);