Skip to content

Commit

Permalink
Report an error when the bzopen fails (matomo-org#14145)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kate Butler authored and diosmosis committed Mar 2, 2019
1 parent 8ac338d commit 0e3c30b
Showing 1 changed file with 17 additions and 7 deletions.
Expand Up @@ -65,12 +65,15 @@ protected function updateCoreFiles(InputInterface $input, OutputInterface $outpu

$tar = new Tar($tarFile, 'bz2');

$tar->extract($targetDir);

$this->writeSuccessMessage($output, array(
'All processed system test results were copied to <comment>' . $targetDir . '</comment>',
'Compare them with the expected test results and commit them if needed.'
));
if ($tar->extract($targetDir)) {
$this->writeSuccessMessage($output, array(
'All processed system test results were copied to <comment>' . $targetDir . '</comment>',
'Compare them with the expected test results and commit them if needed.'
));
} else {
$output->write('<error>' . $tar->errorInfo() . '.</error>');
$output->writeln('<error> Check that you have the PHP bz2 extension installed and try again.');
}

unlink($tarFile);
}
Expand Down Expand Up @@ -100,7 +103,14 @@ protected function updatePluginsFiles(InputInterface $input, OutputInterface $ou
$extractionTarget = $tmpDir . '/artifacts';

Filesystem::mkdir($extractionTarget);
$tar->extract($extractionTarget);

$success = $tar->extract($extractionTarget);
if (! $success) {
$output->write('<error>' . $tar->errorInfo() . '.</error>');
$output->writeln('<error> Check that you have the PHP bz2 extension installed and try again.');
unlink($tarFile);
return;
}

$artifacts = Filesystem::globr($extractionTarget, '*~~*');

Expand Down

0 comments on commit 0e3c30b

Please sign in to comment.