1 | <?php |
||
39 | class SolrConfigurationStatus extends AbstractSolrStatus |
||
40 | { |
||
41 | /** |
||
42 | * @var SystemDomainRepository |
||
43 | */ |
||
44 | protected $systemDomainRepository; |
||
45 | |||
46 | /** |
||
47 | * SolrConfigurationStatus constructor. |
||
48 | * @param SystemDomainRepository|null $systemDomainRepository |
||
49 | */ |
||
50 | 6 | public function __construct(SystemDomainRepository $systemDomainRepository = null) |
|
54 | |||
55 | /** |
||
56 | * Compiles a collection of configuration status checks. |
||
57 | * |
||
58 | * @return array |
||
59 | */ |
||
60 | 6 | public function getStatus() |
|
84 | |||
85 | /** |
||
86 | * Checks whether the "Use as Root Page" page property has been set for any |
||
87 | * site. |
||
88 | * |
||
89 | * @return NULL|Status An error status is returned if no root pages were found. |
||
90 | */ |
||
91 | 6 | protected function getRootPageFlagStatus() |
|
101 | |||
102 | /** |
||
103 | * Checks whether a domain record (sys_domain) has been configured for each site root. |
||
104 | * |
||
105 | * @return NULL|Status An error status is returned for each site root page without domain record. |
||
106 | */ |
||
107 | 5 | protected function getDomainRecordAvailableStatus() |
|
117 | |||
118 | /** |
||
119 | * Checks whether config.index_enable is set to 1, otherwise indexing will |
||
120 | * not work. |
||
121 | * |
||
122 | * @return NULL|Status An error status is returned for each site root page config.index_enable = 0. |
||
123 | */ |
||
124 | 5 | protected function getConfigIndexEnableStatus() |
|
134 | |||
135 | /** |
||
136 | * Returns an array of rootPages without an existing domain record. |
||
137 | * |
||
138 | * @return array |
||
139 | */ |
||
140 | 5 | protected function getRootPagesWithoutDomain() |
|
158 | |||
159 | /** |
||
160 | * Returns an array of rootPages where the indexing is off and EXT:solr is enabled. |
||
161 | * |
||
162 | * @return array |
||
163 | */ |
||
164 | 5 | protected function getRootPagesWithIndexingOff() |
|
165 | { |
||
166 | 5 | $rootPages = $this->getRootPages(); |
|
167 | 5 | $rootPagesWithIndexingOff = []; |
|
168 | |||
169 | 5 | foreach ($rootPages as $rootPage) { |
|
170 | try { |
||
171 | 5 | $this->initializeTSFE($rootPage); |
|
172 | 5 | $solrIsEnabledAndIndexingDisabled = $this->getIsSolrEnabled() && !$this->getIsIndexingEnabled(); |
|
173 | 5 | if ($solrIsEnabledAndIndexingDisabled) { |
|
174 | 5 | $rootPagesWithIndexingOff[] = $rootPage; |
|
175 | } |
||
176 | } catch (\RuntimeException $rte) { |
||
177 | $rootPagesWithIndexingOff[] = $rootPage; |
||
178 | } catch (ServiceUnavailableException $sue) { |
||
179 | if ($sue->getCode() == 1294587218) { |
||
180 | // No TypoScript template found, continue with next site |
||
181 | $rootPagesWithIndexingOff[] = $rootPage; |
||
182 | 5 | continue; |
|
183 | } |
||
184 | } |
||
185 | } |
||
186 | |||
187 | 5 | return $rootPagesWithIndexingOff; |
|
188 | } |
||
189 | |||
190 | /** |
||
191 | * Gets the site's root pages. The "Is root of website" flag must be set, |
||
192 | * which usually is the case for pages with pid = 0. |
||
193 | * |
||
194 | * @return array An array of (partial) root page records, containing the uid and title fields |
||
195 | */ |
||
196 | 4 | protected function getRootPages() |
|
206 | |||
207 | /** |
||
208 | * Checks if the solr plugin is enabled with plugin.tx_solr.enabled. |
||
209 | * |
||
210 | * @return bool |
||
211 | */ |
||
212 | 3 | protected function getIsSolrEnabled() |
|
219 | |||
220 | /** |
||
221 | * Checks if the indexing is enabled with config.index_enable |
||
222 | * |
||
223 | * @return bool |
||
224 | */ |
||
225 | 3 | protected function getIsIndexingEnabled() |
|
233 | |||
234 | /** |
||
235 | * @param $rootPage |
||
236 | */ |
||
237 | 3 | protected function initializeTSFE($rootPage) |
|
241 | } |
||
242 |