We save the file instead of returning it for performance reasons

namespaces
Svein-Tore Griff With 2013-11-17 18:26:39 +01:00
parent 884664e637
commit f32ae3a4d4
1 changed files with 2 additions and 6 deletions

View File

@ -1057,7 +1057,7 @@ Class H5PExport {
* The data to be exported. * The data to be exported.
* @return H5P package. * @return H5P package.
*/ */
public function exportToZip($exportData) { public function getExportPath($exportData) {
$h5pDir = $this->h5pF->getH5pPath() . DIRECTORY_SEPARATOR; $h5pDir = $this->h5pF->getH5pPath() . DIRECTORY_SEPARATOR;
$tempPath = $h5pDir . 'temp' . DIRECTORY_SEPARATOR . $exportData['contentId']; $tempPath = $h5pDir . 'temp' . DIRECTORY_SEPARATOR . $exportData['contentId'];
$zipPath = $h5pDir . 'exports' . DIRECTORY_SEPARATOR . $exportData['contentId'] . '.h5p'; $zipPath = $h5pDir . 'exports' . DIRECTORY_SEPARATOR . $exportData['contentId'] . '.h5p';
@ -1140,11 +1140,7 @@ Class H5PExport {
$this->h5pC->delTree($tempPath); $this->h5pC->delTree($tempPath);
} }
// Set headers for automagic download!! return str_replace(DIRECTORY_SEPARATOR, '/', $zipPath);
header('Content-Description: File Transfer');
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename="' . $exportData['title'] . '.h5p"');
readfile ($zipPath);
} }
private function addEditorLibraries($libraries) { private function addEditorLibraries($libraries) {