Merge f6931c2691
into aaf26d584b
commit
936325672e
|
@ -795,6 +795,10 @@ class H5PValidator {
|
|||
* TRUE if the .h5p file is valid
|
||||
*/
|
||||
public function isValidPackage($skipContent = FALSE, $upgradeOnly = FALSE) {
|
||||
// Create a temporary dir to extract package in.
|
||||
$tmpDir = $this->h5pF->getUploadedH5pFolderPath();
|
||||
$tmpPath = $this->h5pF->getUploadedH5pPath();
|
||||
|
||||
// Check dependencies, make sure Zip is present
|
||||
if (!class_exists('ZipArchive')) {
|
||||
$this->h5pF->setErrorMessage($this->h5pF->t('Your PHP version does not support ZipArchive.'), 'zip-archive-unsupported');
|
||||
|
@ -807,10 +811,6 @@ class H5PValidator {
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
// Create a temporary dir to extract package in.
|
||||
$tmpDir = $this->h5pF->getUploadedH5pFolderPath();
|
||||
$tmpPath = $this->h5pF->getUploadedH5pPath();
|
||||
|
||||
// Only allow files with the .h5p extension:
|
||||
if (strtolower(substr($tmpPath, -3)) !== 'h5p') {
|
||||
$this->h5pF->setErrorMessage($this->h5pF->t('The file you uploaded is not a valid HTML5 Package (It does not have the .h5p file extension)'), 'missing-h5p-extension');
|
||||
|
@ -954,7 +954,7 @@ class H5PValidator {
|
|||
// This is a breaking error, there's no need to continue. (the rest of the files will fail as well)
|
||||
$this->h5pF->setErrorMessage($this->h5pF->t('Unable to read file from the package: %fileName', array('%fileName' => $fileName)), 'unable-to-read-package-file');
|
||||
$zip->close();
|
||||
unlink($path);
|
||||
unlink($tmpPath);
|
||||
H5PCore::deleteFileTree($tmpDir);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue