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

tomasnorre / crawler / 43405165794

13 Nov 2026 09:55AM UTC coverage: 71.322% (+1.4%) from 69.891%
43405165794

push

github

web-flow
!!! [TASK] Remove TYPO3 13 Support (#1323)

9 of 42 new or added lines in 6 files covered. (21.43%)

1910 of 2678 relevant lines covered (71.32%)

3.27 hits per line

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

0.0
/Classes/Controller/Backend/AbstractBackendModuleController.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace AOE\Crawler\Controller\Backend;
6

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

22
use AOE\Crawler\Configuration\ExtensionConfigurationProvider;
23
use AOE\Crawler\Utility\MessageUtility;
24
use AOE\Crawler\Utility\PhpBinaryUtility;
25
use Psr\Http\Message\ServerRequestInterface;
26
use Symfony\Contracts\Service\Attribute\Required;
27
use TYPO3\CMS\Backend\Template\ModuleTemplate;
28
use TYPO3\CMS\Backend\Template\ModuleTemplateFactory;
29
use TYPO3\CMS\Backend\Utility\BackendUtility;
30
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
31
use TYPO3\CMS\Core\Localization\LanguageService;
32
use TYPO3\CMS\Core\Type\Bitmask\Permission;
33
use TYPO3\CMS\Core\Utility\CommandUtility;
34
use TYPO3\CMS\Core\Utility\GeneralUtility;
35

36
/**
37
 * @internal since v12.0.0
38
 */
39
abstract class AbstractBackendModuleController
40
{
41
    protected bool $isErrorDetected = false;
42
    protected int $pageUid;
43
    protected ModuleTemplate $moduleTemplate;
44
    protected array $extensionSettings = [];
45

46
    #[Required]
47
    public function setExtensionSettings(): void
48
    {
49
        $configurationProvider = GeneralUtility::makeInstance(ExtensionConfigurationProvider::class);
×
50
        $this->extensionSettings = $configurationProvider->getExtensionConfiguration();
×
51
    }
52

53
    protected function setupView(ServerRequestInterface $request, int $pageUid): ModuleTemplate
54
    {
55
        $moduleTemplate = (GeneralUtility::makeInstance(ModuleTemplateFactory::class))->create($request);
×
56
        $permissionClause = $this->getBackendUserAuthentication()->getPagePermsClause(Permission::PAGE_SHOW);
×
57
        $pageRecord = BackendUtility::readPageAccess($pageUid, $permissionClause);
×
58
        if ($pageRecord) {
×
NEW
59
            $moduleTemplate->getDocHeaderComponent()->setPageBreadcrumb($pageRecord);
×
60
        }
61

62
        return $moduleTemplate;
×
63
    }
64

65
    protected function makeCrawlerProcessableChecks(array $extensionSettings): void
66
    {
67
        if (!$this->isPhpForkAvailable()) {
×
68
            $this->isErrorDetected = true;
×
69
            MessageUtility::addErrorMessage(
×
NEW
70
                $this->getLanguageService()->sL('crawler.messages:message.noPhpForkAvailable')
×
71
            );
×
72
        }
73

74
        $exitCode = 0;
×
75
        $out = [];
×
76
        CommandUtility::exec(PhpBinaryUtility::getPhpBinary() . ' -v', $out, $exitCode);
×
77
        if ($exitCode > 0) {
×
78
            $this->isErrorDetected = true;
×
79
            MessageUtility::addErrorMessage(
×
80
                sprintf($this->getLanguageService()->sL(
×
NEW
81
                    'crawler.messages:message.phpBinaryNotFound'
×
82
                ), htmlspecialchars((string) $extensionSettings['phpPath'], ENT_QUOTES | ENT_HTML5))
×
83
            );
×
84
        }
85
    }
86

87
    protected function getModuleMenu(): array
88
    {
89
        return [
×
90
            'logDepth' => [
×
NEW
91
                0 => $this->getLanguageService()->sL('core.core:labels.depth_0'),
×
NEW
92
                1 => $this->getLanguageService()->sL('core.core:labels.depth_1'),
×
NEW
93
                2 => $this->getLanguageService()->sL('core.core:labels.depth_2'),
×
NEW
94
                3 => $this->getLanguageService()->sL('core.core:labels.depth_3'),
×
NEW
95
                4 => $this->getLanguageService()->sL('core.core:labels.depth_4'),
×
NEW
96
                99 => $this->getLanguageService()->sL('core.core:labels.depth_infi'),
×
97
            ],
×
98
            'crawlaction' => [
×
NEW
99
                'start' => $this->getLanguageService()->sL('crawler.messages:labels.start'),
×
NEW
100
                'log' => $this->getLanguageService()->sL('crawler.messages:labels.log'),
×
NEW
101
                'multiprocess' => $this->getLanguageService()->sL('crawler.messages:labels.multiprocess'),
×
102
            ],
×
103
            'log_resultLog' => '',
×
104
            'log_feVars' => '',
×
105
            'processListMode' => '',
×
106
            'displayLog' => [
×
NEW
107
                'all' => $this->getLanguageService()->sL('crawler.messages:labels.all'),
×
NEW
108
                'pending' => $this->getLanguageService()->sL('crawler.messages:labels.pending'),
×
NEW
109
                'finished' => $this->getLanguageService()->sL('crawler.messages:labels.finished'),
×
110
            ],
×
111
            'itemsPerPage' => [
×
NEW
112
                '5' => $this->getLanguageService()->sL('crawler.messages:labels.itemsPerPage.5'),
×
NEW
113
                '10' => $this->getLanguageService()->sL('crawler.messages:labels.itemsPerPage.10'),
×
NEW
114
                '50' => $this->getLanguageService()->sL('crawler.messages:labels.itemsPerPage.50'),
×
NEW
115
                '0' => $this->getLanguageService()->sL('crawler.messages:labels.itemsPerPage.0'),
×
116
            ],
×
117
        ];
×
118
    }
119

120
    protected function getLanguageService(): LanguageService
121
    {
122
        return $GLOBALS['LANG'];
×
123
    }
124

125
    protected function getBackendUserAuthentication(): BackendUserAuthentication
126
    {
127
        return $GLOBALS['BE_USER'];
×
128
    }
129

130
    /**
131
     * Indicate that the required PHP method "popen" is
132
     * available in the system.
133
     */
134
    private function isPhpForkAvailable(): bool
135
    {
136
        return function_exists('popen');
×
137
    }
138
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc