|
16 | 16 | use Symfony\Component\HttpFoundation\Request;
|
17 | 17 | use Symfony\Component\HttpFoundation\Response;
|
18 | 18 | use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
| 19 | +use Symfony\Component\Security\Core\Exception\RuntimeException; |
19 | 20 |
|
20 | 21 | /**
|
21 | 22 | * @Service
|
@@ -75,7 +76,7 @@ private function log(string $logLevel, string $message): void
|
75 | 76 | $dateTime = date('Y-m-d H:i:s');
|
76 | 77 | $this->filesystem->appendToFile($logFile, "[$dateTime] $logLevel: $message" . PHP_EOL);
|
77 | 78 | } catch (\Exception $e) {
|
78 |
| - $this->flashError('filesystem.mkdir.error.backupDir'); |
| 79 | + throw new RuntimeException('filesystem.mkdir.error.backupDir'); |
79 | 80 | }
|
80 | 81 | }
|
81 | 82 |
|
@@ -262,8 +263,8 @@ public function backupDatabase(string $sqlDumpName): void
|
262 | 263 | $errorsStr = trim($errorsStr, PHP_EOL);
|
263 | 264 |
|
264 | 265 | if (!empty($errorsStr)) {
|
265 |
| - $this->flashError($errorsStr); |
266 | 266 | $this->log(self::LOG_ERROR_PREFIX, $errorsStr);
|
| 267 | + throw new RuntimeException($errorsStr); |
267 | 268 | }
|
268 | 269 | }
|
269 | 270 | }
|
@@ -298,18 +299,18 @@ public function zipData(string $source, string $destination): bool
|
298 | 299 | $zip->addFromString(basename($source), file_get_contents($source) ?: '');
|
299 | 300 | }
|
300 | 301 | } else {
|
301 |
| - $this->flashError('backup.action.zip.error.destination'); |
302 | 302 | $this->log(self::LOG_ERROR_PREFIX, "Couldn't open '$destination'.");
|
| 303 | + throw new RuntimeException('backup.action.zip.error.destination'); |
303 | 304 | }
|
304 | 305 |
|
305 | 306 | return $zip->close();
|
306 | 307 | } else {
|
307 |
| - $this->flashError('backup.action.zip.error.source'); |
308 | 308 | $this->log(self::LOG_ERROR_PREFIX, "Source file not found: '$source'.");
|
| 309 | + throw new RuntimeException('backup.action.zip.error.source'); |
309 | 310 | }
|
310 | 311 | } else {
|
311 |
| - $this->flashError('backup.action.zip.error.extension'); |
312 | 312 | $this->log(self::LOG_ERROR_PREFIX, "Extension 'zip' not found!");
|
| 313 | + throw new RuntimeException('backup.action.zip.error.extension'); |
313 | 314 | }
|
314 | 315 |
|
315 | 316 | return false;
|
@@ -345,10 +346,10 @@ public function execute(string $cmd, string $workdir = null): array
|
345 | 346 | public function getKimaiVersion(bool $full = false): string
|
346 | 347 | {
|
347 | 348 | if ($full) {
|
348 |
| - return Constants::SOFTWARE . ' - ' . Constants::VERSION; // . ' ' . Constants::STATUS; |
| 349 | + return Constants::SOFTWARE . ' - ' . Constants::VERSION; // . ' ' . Constants::STATUS; TODO |
349 | 350 | }
|
350 | 351 |
|
351 |
| - return Constants::VERSION; // . ' ' . Constants::STATUS; |
| 352 | + return Constants::VERSION; // . ' ' . Constants::STATUS; // TODO |
352 | 353 | }
|
353 | 354 |
|
354 | 355 | public function getExistingBackups(): array
|
|
0 commit comments