Fix archive download via API

This commit is contained in:
Thibaud Fabre
2016-05-23 17:54:40 +02:00
parent 9c287e0cd9
commit cf684cdeca
3 changed files with 12 additions and 5 deletions

View File

@@ -162,7 +162,7 @@ class DoDownloadController extends Controller
$this->app,
$token,
$list,
sprintf($this->app['tmp.download.path'].'/%s.zip', $token->getValue()) // Dest file
sprintf('%s/%s.zip', $this->app['tmp.download.path'], $token->getValue()) // Dest file
);
} else {
$list['complete'] = true;

View File

@@ -1,4 +1,5 @@
<?php
/*
* This file is part of Phraseanet
*
@@ -7,6 +8,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Databox;
interface DataboxRepository

View File

@@ -157,7 +157,7 @@ class ApiOrderController extends BaseOrderController
}
$export = new \set_export($this->app, '', $basket->getId());
$exportName = sprintf('%s.zip', $export->getExportName());
$exportName = sprintf('%s/%s.zip', $this->app['tmp.download.path'], $export->getExportName());
$user = $this->getAuthenticatedUser();
@@ -167,10 +167,15 @@ class ApiOrderController extends BaseOrderController
$exportData['export_name'] = $exportName;
$token = $this->app['manipulator.token']->createDownloadToken($user, serialize($exportData));
$lst = [];
foreach ($exportData['files'] as $file) {
$lst[] = $this->getApplicationBox()->get_collection($file['base_id'])->get_databox()->get_sbas_id() . '_' . $file['record_id'];
}
$this->dispatch(
PhraseaEvents::EXPORT_CREATE,
new ExportEvent($user, $basket->getId(), '', $subdefs, $exportName)
new ExportEvent($user, $basket->getId(), implode(';', $lst), $subdefs, $exportName)
);
set_time_limit(0);
@@ -330,7 +335,7 @@ class ApiOrderController extends BaseOrderController
$subdefNames = [
'document' => true,
];
$this->getApplicationBox()->get_collection($file['base_id'])->get_databox()->get_sbas_id();
foreach ($this->getApplicationBox()->get_databoxes() as $databox) {
foreach ($databox->get_subdef_structure() as $subdefGroup) {
/** @var \databox_subdef $subdef */