Upgrade to PHP8.2
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2023-06-07 09:56:23 +00:00
parent 79dfcd6495
commit afc4a1e3ce
8 changed files with 1058 additions and 794 deletions

View File

@ -3,6 +3,7 @@ namespace App\Rclone;
use Psr\Log\LoggerAwareTrait;
use Psr\Log\NullLogger;
use Psr\Log\LoggerInterface;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
@ -45,13 +46,14 @@ class Rclone
try
{
$version = $this->exec('--version');
$this->version = explode("\n", $version)[0];
}
catch(ProcessFailedException $e)
{
throw new Exception("Check installation of rclone");
}
$this->version = explode("\n", $version)[0];
if (!\str_contains($this->version, 'rclone')) {
throw new Exception("Rclone not recognized");
@ -122,16 +124,23 @@ class Rclone
$options
)
);
$this->logger->info("Execute command", [$process->getCommandLine()]);
if ($this->logger instanceof LoggerInterface) {
$this->logger->info("Execute command", [$process->getCommandLine()]);
}
$process->setTimeout(4*3600);
$process->run();
// executes after the command finishes
if (!$process->isSuccessful()) {
$this->logger->error("Failed execution");
if ($this->logger instanceof LoggerInterface) {
$this->logger->error("Failed execution");
}
throw new ProcessFailedException($process);
}
$this->logger->info("Return code", [$process->getExitCode()]);
if ($this->logger instanceof LoggerInterface) {
$this->logger->info("Return code", [$process->getExitCode()]);
}
return $process->getOutput();
}
}