pull/52/merge
Bastian Heist 2021-10-10 21:28:52 -07:00 committed by GitHub
commit 461bb6b957
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 4 deletions

View File

@ -1931,7 +1931,7 @@ Class H5PExport {
$zip->close();
H5PCore::deleteFileTree($tmpPath);
$filename = $content['slug'] . '-' . $content['id'] . '.h5p';
$filename = self::buildExportFileName($content);
try {
// Save export
$this->h5pC->fs->saveExport($tmpFile, $filename);
@ -1976,13 +1976,21 @@ Class H5PExport {
}
}
/**
* @param array $content object
* @return string the export filename
*/
public static function buildExportFileName($content) {
return ($content['slug'] ? $content['slug'] . '-' : '') . $content['id'] . '.h5p';
}
/**
* Delete .h5p file
*
* @param array $content object
*/
public function deleteExport($content) {
$this->h5pC->fs->deleteExport(($content['slug'] ? $content['slug'] . '-' : '') . $content['id'] . '.h5p');
$this->h5pC->fs->deleteExport(self::buildExportFileName($content));
}
/**
@ -2214,7 +2222,7 @@ class H5PCore {
if (!empty($content['filtered']) &&
(!$this->exportEnabled ||
($content['slug'] &&
$this->fs->hasExport($content['slug'] . '-' . $content['id'] . '.h5p')))) {
$this->fs->hasExport(H5PExport::buildExportFileName($content))))) {
return $content['filtered'];
}
@ -2266,7 +2274,7 @@ class H5PCore {
$content['slug'] = $this->generateContentSlug($content);
// Remove old export file
$this->fs->deleteExport($content['id'] . '.h5p');
$this->fs->deleteExport(H5PExport::buildExportFileName($content));
}
if ($this->exportEnabled) {