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

tomasnorre / crawler / 19727593680

27 Nov 2025 06:44AM UTC coverage: 69.2% (-0.01%) from 69.211%
19727593680

push

github

web-flow
[CI] Bring back Psalm (#1226)

1 of 1 new or added line in 1 file covered. (100.0%)

2 existing lines in 2 files now uncovered.

1930 of 2789 relevant lines covered (69.2%)

3.2 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
    {
UNCOV
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) {
×
59
            $moduleTemplate->getDocHeaderComponent()->setMetaInformation($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(
×
70
                $this->getLanguageService()->sL(
×
71
                    'LLL:EXT:crawler/Resources/Private/Language/locallang.xlf:message.noPhpForkAvailable'
×
72
                )
×
73
            );
×
74
        }
75

76
        $exitCode = 0;
×
77
        $out = [];
×
78
        CommandUtility::exec(PhpBinaryUtility::getPhpBinary() . ' -v', $out, $exitCode);
×
79
        if ($exitCode > 0) {
×
80
            $this->isErrorDetected = true;
×
81
            MessageUtility::addErrorMessage(
×
82
                sprintf($this->getLanguageService()->sL(
×
83
                    'LLL:EXT:crawler/Resources/Private/Language/locallang.xlf:message.phpBinaryNotFound'
×
84
                ), htmlspecialchars((string) $extensionSettings['phpPath'], ENT_QUOTES | ENT_HTML5))
×
85
            );
×
86
        }
87
    }
88

89
    protected function getModuleMenu(): array
90
    {
91
        return [
×
92
            'logDepth' => [
×
93
                0 => $this->getLanguageService()->sL(
×
94
                    'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_0'
×
95
                ),
×
96
                1 => $this->getLanguageService()->sL(
×
97
                    'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_1'
×
98
                ),
×
99
                2 => $this->getLanguageService()->sL(
×
100
                    'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_2'
×
101
                ),
×
102
                3 => $this->getLanguageService()->sL(
×
103
                    'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_3'
×
104
                ),
×
105
                4 => $this->getLanguageService()->sL(
×
106
                    'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_4'
×
107
                ),
×
108
                99 => $this->getLanguageService()->sL(
×
109
                    'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_infi'
×
110
                ),
×
111
            ],
×
112
            'crawlaction' => [
×
113
                'start' => $this->getLanguageService()->sL(
×
114
                    'LLL:EXT:crawler/Resources/Private/Language/locallang.xlf:labels.start'
×
115
                ),
×
116
                'log' => $this->getLanguageService()->sL(
×
117
                    'LLL:EXT:crawler/Resources/Private/Language/locallang.xlf:labels.log'
×
118
                ),
×
119
                'multiprocess' => $this->getLanguageService()->sL(
×
120
                    'LLL:EXT:crawler/Resources/Private/Language/locallang.xlf:labels.multiprocess'
×
121
                ),
×
122
            ],
×
123
            'log_resultLog' => '',
×
124
            'log_feVars' => '',
×
125
            'processListMode' => '',
×
126
            'displayLog' => [
×
127
                'all' => $this->getLanguageService()->sL(
×
128
                    'LLL:EXT:crawler/Resources/Private/Language/locallang.xlf:labels.all'
×
129
                ),
×
130
                'pending' => $this->getLanguageService()->sL(
×
131
                    'LLL:EXT:crawler/Resources/Private/Language/locallang.xlf:labels.pending'
×
132
                ),
×
133
                'finished' => $this->getLanguageService()->sL(
×
134
                    'LLL:EXT:crawler/Resources/Private/Language/locallang.xlf:labels.finished'
×
135
                ),
×
136
            ],
×
137
            'itemsPerPage' => [
×
138
                '5' => $this->getLanguageService()->sL(
×
139
                    'LLL:EXT:crawler/Resources/Private/Language/locallang.xlf:labels.itemsPerPage.5'
×
140
                ),
×
141
                '10' => $this->getLanguageService()->sL(
×
142
                    'LLL:EXT:crawler/Resources/Private/Language/locallang.xlf:labels.itemsPerPage.10'
×
143
                ),
×
144
                '50' => $this->getLanguageService()->sL(
×
145
                    'LLL:EXT:crawler/Resources/Private/Language/locallang.xlf:labels.itemsPerPage.50'
×
146
                ),
×
147
                '0' => $this->getLanguageService()->sL(
×
148
                    'LLL:EXT:crawler/Resources/Private/Language/locallang.xlf:labels.itemsPerPage.0'
×
149
                ),
×
150
            ],
×
151
        ];
×
152
    }
153

154
    protected function getLanguageService(): LanguageService
155
    {
156
        return $GLOBALS['LANG'];
×
157
    }
158

159
    protected function getBackendUserAuthentication(): BackendUserAuthentication
160
    {
161
        return $GLOBALS['BE_USER'];
×
162
    }
163

164
    /**
165
     * Indicate that the required PHP method "popen" is
166
     * available in the system.
167
     */
168
    private function isPhpForkAvailable(): bool
169
    {
170
        return function_exists('popen');
×
171
    }
172
}
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