Conditions | 3 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
41 | public function scanAction() |
||
42 | { |
||
43 | if ($this->filesystem->exists(self::$fileCache)) { |
||
44 | $errors = unserialize(file_get_contents(self::$fileCache)); |
||
45 | $lastEdit = filemtime(self::$fileCache); |
||
46 | } else { |
||
47 | $lastEdit = 0; |
||
48 | $errors = []; |
||
49 | } |
||
50 | |||
51 | $lastTime = new LastTime(self::$fileCache); |
||
52 | if (false === $lastTime->wasRunSince(new DateInterval('PT5M'))) { // todo config |
||
53 | exec('cd ../ && php bin/console page:scan > /dev/null 2>/dev/null &'); |
||
54 | $newRunLaunched = true; |
||
55 | $lastTime->setWasRun('now', false); |
||
56 | } |
||
57 | |||
58 | return $this->render('@pwcPageScanner/results.html.twig', [ |
||
59 | 'newRun' => $newRunLaunched ?? false, |
||
60 | 'lastEdit' => $lastEdit, |
||
61 | 'errorsByPages' => $errors, |
||
62 | ]); |
||
65 |