runs->find((int)$argument['run']); if ($run->getStatus() !== Run::RUNNING) { return; } $req = json_decode($run->getState(), true, 512, JSON_THROW_ON_ERROR); $run->setPhase('restoring'); $run->setUpdatedAt(time()); $this->runs->update($run); @set_time_limit(0); try { $result = $this->restore->restoreUserFiles($this->targets->get((string)$run->getTargetId()), $req['snapshot'], $req['path'], $req['mode']); $run->setStatus(Run::DONE); $run->setPhase('done'); $run->setStats(json_encode($result, JSON_THROW_ON_ERROR)); } catch (\Throwable $e) { $this->logger->error('NG Backup restore ' . $run->getId() . ' failed: ' . $e->getMessage(), ['exception' => $e]); $run->setStatus(Run::FAILED); $run->setError($e->getMessage()); } $run->setFinishedAt(time()); $run->setUpdatedAt(time()); $this->runs->update($run); } }