Browse Source

Add more details if extract fails.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
tags/v21.0.0beta1
Daniel Kesselberg 3 years ago
parent
commit
d11de8c8e7
No account linked to committer's email address
2 changed files with 18 additions and 6 deletions
  1. 10
    0
      lib/private/Archive/TAR.php
  2. 8
    6
      lib/private/Installer.php

+ 10
- 0
lib/private/Archive/TAR.php View File

@@ -381,4 +381,14 @@ class TAR extends Archive {
$types = [null, 'gz', 'bz'];
$this->tar = new \Archive_Tar($this->path, $types[self::getTarType($this->path)]);
}

/**
* Get error object from archive_tar.
*/
public function getError(): ?\PEAR_Error {
if ($this->tar instanceof \Archive_Tar && $this->tar->error_object instanceof \PEAR_Error) {
return $this->tar->error_object;
}
return null;
}
}

+ 8
- 6
lib/private/Installer.php View File

@@ -294,12 +294,14 @@ class Installer {

if ($archive) {
if (!$archive->extract($extractDir)) {
throw new \Exception(
sprintf(
'Could not extract app %s',
$appId
)
);
$errorMessage = 'Could not extract app ' . $appId;

$archiveError = $archive->getError();
if ($archiveError instanceof \PEAR_Error) {
$errorMessage .= ': ' . $archiveError->getMessage();
}

throw new \Exception($errorMessage);
}
$allFiles = scandir($extractDir);
$folders = array_diff($allFiles, ['.', '..']);

Loading…
Cancel
Save