• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tomasnorre / crawler / 18658463615

20 Oct 2025 04:27PM UTC coverage: 68.73% (-1.0%) from 69.702%
18658463615

Pull #1205

github

web-flow
Merge 64e92c11a into 5745fd891
Pull Request #1205: [FEATURE] Automatic reload process status without page reload

0 of 39 new or added lines in 2 files covered. (0.0%)

1921 of 2795 relevant lines covered (68.73%)

3.22 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/Classes/Controller/Ajax/ProcessStatusController.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * (c) 2025 Tomas Norre Mikkelsen <tomasnorre@gmail.com>
7
 *
8
 * This file is part of the TYPO3 Crawler Extension.
9
 *
10
 * It is free software; you can redistribute it and/or modify it under
11
 * the terms of the GNU General Public License, either version 2
12
 * of the License, or any later version.
13
 *
14
 * For the full copyright and license information, please read the
15
 * LICENSE.txt file that was distributed with this source code.
16
 *
17
 * The TYPO3 project - inspiring people to share!
18
 */
19

20
namespace AOE\Crawler\Controller\Ajax;
21

22
use AOE\Crawler\Domain\Repository\ProcessRepository;
23
use Psr\Http\Message\ResponseInterface;
24
use Psr\Http\Message\ServerRequestInterface;
25
use TYPO3\CMS\Core\Http\Response;
26

27
class ProcessStatusController
28
{
29
    public function __construct(
30
        private readonly ProcessRepository $processRepository,
31
    ) {
NEW
32
    }
×
33

34
    public function getProcessStatus(ServerRequestInterface $request): ResponseInterface
35
    {
NEW
36
        $body = $request->getBody()->getContents();
×
NEW
37
        $data = json_decode($body, true);
×
NEW
38
        $id = $data['id'] ?? null;
×
39

NEW
40
        $response = new Response();
×
41

NEW
42
        if ($id === null) {
×
NEW
43
            return $response->withStatus(400, 'No process ID provided');
×
44
        }
45

NEW
46
        $process = $this->processRepository->findByProcessId($id);
×
NEW
47
        if ($process === null) {
×
NEW
48
            return $response->withStatus(404, 'Process with ID ' . $id . ' not found');
×
49
        }
50

NEW
51
        $content = json_encode(
×
NEW
52
            [
×
NEW
53
                'status' => $process->getProgress(),
×
NEW
54
                'processedItems' => $process->getAmountOfItemsProcessed(),
×
NEW
55
                'runtime' => $process->getRuntime(),
×
NEW
56
                'processId' => $id,
×
NEW
57
            ]
×
NEW
58
        );
×
NEW
59
        if ($content === false) {
×
NEW
60
            throw new \RuntimeException('Failed to encode JSON response', 1760971184);
×
61
        }
NEW
62
        $response->getBody()->write($content);
×
NEW
63
        return $response;
×
64
    }
65
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc