Finish export handle
modifié: core/lib/Thelia/Controller/Admin/ImportExportController.php modifié: core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/TarArchiveBuilder.php modifié: core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/ZipArchiveBuilder.php
This commit is contained in:
@@ -117,8 +117,10 @@ class ImportExportController extends BaseAdminController
|
|||||||
|
|
||||||
$formattedContent = $formatter->encode($data);
|
$formattedContent = $formatter->encode($data);
|
||||||
|
|
||||||
|
$filename = $formatter::FILENAME . "." . $formatter->getExtension();
|
||||||
|
|
||||||
if (!$boundForm->get("do_compress")->getData()) {
|
if (!$boundForm->get("do_compress")->getData()) {
|
||||||
$filename = $formatter::FILENAME . "." . $formatter->getExtension();
|
|
||||||
|
|
||||||
return new Response(
|
return new Response(
|
||||||
$formattedContent,
|
$formattedContent,
|
||||||
@@ -153,12 +155,8 @@ class ImportExportController extends BaseAdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Then add the export file
|
|
||||||
*/
|
|
||||||
$archiveBuilder->addFileFromString(
|
$archiveBuilder->addFileFromString(
|
||||||
$formattedContent,
|
$formattedContent, $filename
|
||||||
$formatter::FILENAME . "." . $formatter->getExtension()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return $archiveBuilder->buildArchiveResponse($formatter::FILENAME);
|
return $archiveBuilder->buildArchiveResponse($formatter::FILENAME);
|
||||||
|
|||||||
@@ -238,8 +238,6 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
|||||||
*/
|
*/
|
||||||
public function buildArchiveResponse($filename)
|
public function buildArchiveResponse($filename)
|
||||||
{
|
{
|
||||||
$this->tar->setMetadata("Generated by Thelia v" . Thelia::THELIA_VERSION);
|
|
||||||
|
|
||||||
if (!is_file($this->cacheFile)) {
|
if (!is_file($this->cacheFile)) {
|
||||||
$this->throwFileNotFound($this->cacheFile);
|
$this->throwFileNotFound($this->cacheFile);
|
||||||
}
|
}
|
||||||
@@ -262,7 +260,7 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
|||||||
200,
|
200,
|
||||||
[
|
[
|
||||||
"Content-Type" => $this->getMimeType(),
|
"Content-Type" => $this->getMimeType(),
|
||||||
"Content-Disposition" => $filename . "." . $this->getExtension(),
|
"Content-Disposition" => "attachment; filename=\"".$filename . "." . $this->getExtension() ."\"",
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -332,7 +332,7 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
|||||||
200,
|
200,
|
||||||
[
|
[
|
||||||
"Content-Type" => $this->getMimeType(),
|
"Content-Type" => $this->getMimeType(),
|
||||||
"Content-Disposition" => $filename . "." . $this->getExtension(),
|
"Content-Disposition" => "attachment; filename=\"". $filename . "." . $this->getExtension() ."\"",
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user