Add filename in build archive response

modifié:         core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/TarArchiveBuilder.php
	modifié:         core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/ZipArchiveBuilder.php
	modifié:         core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilderInterface.php
This commit is contained in:
Benjamin Perche
2014-07-04 14:34:30 +02:00
parent dd77d27892
commit d9db2adfc8
3 changed files with 8 additions and 4 deletions

View File

@@ -236,7 +236,7 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
* *
* This method return an instance of a Response with the archive as content. * This method return an instance of a Response with the archive as content.
*/ */
public function buildArchiveResponse() public function buildArchiveResponse($filename)
{ {
$this->tar->setMetadata("Generated by Thelia v" . Thelia::THELIA_VERSION); $this->tar->setMetadata("Generated by Thelia v" . Thelia::THELIA_VERSION);
@@ -262,6 +262,7 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
200, 200,
[ [
"Content-Type" => $this->getMimeType(), "Content-Type" => $this->getMimeType(),
"Content-Disposition" => $filename . "." . $this->getExtension(),
] ]
); );
} }

View File

@@ -302,7 +302,7 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
* *
* This method return an instance of a Response with the archive as content. * This method return an instance of a Response with the archive as content.
*/ */
public function buildArchiveResponse() public function buildArchiveResponse($filename)
{ {
$this->zip->comment = "Generated by Thelia v" . Thelia::THELIA_VERSION; $this->zip->comment = "Generated by Thelia v" . Thelia::THELIA_VERSION;
@@ -331,7 +331,8 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
$content, $content,
200, 200,
[ [
"Content-Type" => $this->getMimeType() "Content-Type" => $this->getMimeType(),
"Content-Disposition" => $filename . "." . $this->getExtension(),
] ]
); );
} }

View File

@@ -76,12 +76,14 @@ interface ArchiveBuilderInterface
* This method creates an empty directory * This method creates an empty directory
*/ */
public function addDirectory($directoryPath); public function addDirectory($directoryPath);
/** /**
* @params string $filename
* @return \Thelia\Core\HttpFoundation\Response * @return \Thelia\Core\HttpFoundation\Response
* *
* This method return an instance of a Response with the archive as content. * This method return an instance of a Response with the archive as content.
*/ */
public function buildArchiveResponse(); public function buildArchiveResponse($filename);
/** /**
* @param string $pathToArchive * @param string $pathToArchive