Skip to content

Commit f8083a6

Browse files
committed
[TASK] Evaluate all entries in Services.yaml regarding to shared setting
All entries in Services.yaml become the `shared` setting dependent on its implementation and context. All non-Singleton-Like classes are set to `shared: false` which could stuck with objects states: * on Builder-Objects * on Query-Objects * on other object, those state change is not global relevant Some classes were commented with todos. Relates: #3995 Fixes: #4183, #4246
1 parent 0dfd4b4 commit f8083a6

File tree

5 files changed

+51
-2
lines changed

5 files changed

+51
-2
lines changed

Classes/EventListener/Extbase/PersistenceEventListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function entityPersisted(EntityPersistedEvent $event): void
4343
$object = $event->getObject();
4444
$tableName = $this->getTableName($object);
4545
if (!$this->skipMonitoringOfTable($tableName)) {
46-
// Entity might turn inaccessable
46+
// Entity might turn inaccessible
4747
$this->eventDispatcher->dispatch(new RecordGarbageCheckEvent($object->getUid(), $tableName));
4848
// Entity added/updated
4949
$this->eventDispatcher->dispatch(new RecordUpdatedEvent($object->getUid(), $tableName));

Classes/Search/FacetingComponent.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
/**
3535
* Modifies a query to add faceting parameters
36+
*
37+
* @todo: Check the implementation can handle results properly if multiple plugins inserted to page.
3638
*/
3739
class FacetingComponent implements LoggerAwareInterface
3840
{

Classes/Search/LastSearchesComponent.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
/**
2626
* Writes the last searches
27+
* @todo: Neither the table `tx_solr_last_searches` know about pluginNamespaces/PID nor the component is covered with caching.
28+
* So either make the last searches component distinguishable for PID+pluginNamespaces, or enable caching for that, to avoid to restore same data from DB.
2729
*/
2830
class LastSearchesComponent
2931
{

Classes/Search/StatisticsComponent.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424

2525
/**
2626
* Statistics search component
27+
*
28+
* @todo: Neither the table `tx_solr_statistics` know about pluginNamespaces nor the component is covered with caching.
29+
* So either make the statistics component distinguishable for pluginNamespaces, or enable caching, to avoid to restore same data from DB.
2730
*/
2831
class StatisticsComponent
2932
{

Configuration/Services.yaml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ services:
3030
resource: '../Classes/ViewHelpers/*'
3131
public: true
3232
autowire: true
33+
shared: false
3334

3435
backend_controller:
3536
namespace: ApacheSolrForTypo3\Solr\Controller\Backend\Search\
@@ -41,14 +42,17 @@ services:
4142
ApacheSolrForTypo3\Solr\Domain\Search\ApacheSolrDocument\Builder:
4243
public: true
4344
autowire: true
45+
shared: false
4446

4547
ApacheSolrForTypo3\Solr\Domain\Search\Uri\SearchUriBuilder:
4648
public: true
4749
autowire: true
50+
shared: false
4851

4952
ApacheSolrForTypo3\Solr\Domain\Variants\IdBuilder:
5053
public: true
5154
autowire: true
55+
shared: false
5256

5357
# BE modules, plugins
5458
ApacheSolrForTypo3\Solr\Backend\SettingsPreviewOnPlugins:
@@ -58,16 +62,19 @@ services:
5862
- name: event.listener
5963
identifier: 'solr.plugin.be.settings.preview'
6064
event: TYPO3\CMS\Backend\View\Event\PageContentPreviewRenderingEvent
65+
shared: false
6166
# END: BE modules
6267

6368
viewhelpers_backend:
6469
namespace: ApacheSolrForTypo3\Solr\ViewHelpers\Backend\
6570
resource: '../Classes/ViewHelpers/Backend/*'
6671
public: true
6772
autowire: true
73+
shared: false
6874

6975
ApacheSolrForTypo3\Solr\Domain\Index\Queue\UpdateHandler\DataUpdateHandler:
7076
public: true
77+
shared: true
7178
arguments:
7279
$recordService: '@ApacheSolrForTypo3\Solr\Domain\Index\Queue\RecordMonitor\Helper\ConfigurationAwareRecordService'
7380
$frontendEnvironment: '@ApacheSolrForTypo3\Solr\FrontendEnvironment'
@@ -79,6 +86,7 @@ services:
7986
$dataHandler: '@TYPO3\CMS\Core\DataHandling\DataHandler'
8087
ApacheSolrForTypo3\Solr\Domain\Index\Queue\UpdateHandler\GarbageHandler:
8188
public: true
89+
shared: true
8290
arguments:
8391
$recordService: '@ApacheSolrForTypo3\Solr\Domain\Index\Queue\RecordMonitor\Helper\ConfigurationAwareRecordService'
8492
$frontendEnvironment: '@ApacheSolrForTypo3\Solr\FrontendEnvironment'
@@ -88,27 +96,33 @@ services:
8896
ApacheSolrForTypo3\Solr\Domain\Site\SiteHashService:
8997
public: true
9098
autowire: true
99+
shared: true
91100

92101
ApacheSolrForTypo3\Solr\IndexQueue\PageIndexerRequestHandler:
93102
public: true
94103
autowire: true
104+
shared: true
95105

96106
ApacheSolrForTypo3\Solr\EventListener\EnhancedRouting\CachedUrlModifier:
107+
shared: true
97108
tags:
98109
- name: event.listener
99110
identifier: 'solr.routing.cachedurl-modifier'
100111
event: ApacheSolrForTypo3\Solr\Event\Routing\BeforeVariableInCachedUrlAreReplacedEvent
101112
ApacheSolrForTypo3\Solr\EventListener\EnhancedRouting\CachedPathVariableModifier:
113+
shared: true
102114
tags:
103115
- name: event.listener
104116
identifier: 'solr.routing.cachedurl-modifier'
105117
event: ApacheSolrForTypo3\Solr\Event\Routing\BeforeCachedVariablesAreProcessedEvent
106118
ApacheSolrForTypo3\Solr\EventListener\EnhancedRouting\PostEnhancedUriProcessor:
119+
shared: true
107120
tags:
108121
- name: event.listener
109122
identifier: 'solr.routing.postenhanceduriprocessor-modifier'
110123
event: ApacheSolrForTypo3\Solr\Event\Routing\AfterUriIsProcessedEvent
111124
ApacheSolrForTypo3\Solr\Domain\Index\Queue\UpdateHandler\EventListener\NoProcessingEventListener:
125+
shared: true
112126
arguments:
113127
$extensionConfiguration: '@ApacheSolrForTypo3\Solr\System\Configuration\ExtensionConfiguration'
114128
$eventDispatcher: '@Psr\EventDispatcher\EventDispatcherInterface'
@@ -142,6 +156,7 @@ services:
142156
before: 'solr.index.updatehandler.immediateprocessingeventlistener,solr.index.updatehandler.delayedprocessingeventlistener'
143157
event: ApacheSolrForTypo3\Solr\Domain\Index\Queue\UpdateHandler\Events\RecordGarbageCheckEvent
144158
ApacheSolrForTypo3\Solr\Domain\Index\Queue\UpdateHandler\EventListener\ImmediateProcessingEventListener:
159+
shared: true
145160
arguments:
146161
$extensionConfiguration: '@ApacheSolrForTypo3\Solr\System\Configuration\ExtensionConfiguration'
147162
$eventDispatcher: '@Psr\EventDispatcher\EventDispatcherInterface'
@@ -175,6 +190,7 @@ services:
175190
before: 'solr.index.updatehandler.delayedprocessingeventlistener'
176191
event: ApacheSolrForTypo3\Solr\Domain\Index\Queue\UpdateHandler\Events\RecordGarbageCheckEvent
177192
ApacheSolrForTypo3\Solr\Domain\Index\Queue\UpdateHandler\EventListener\DelayedProcessingEventListener:
193+
shared: true
178194
arguments:
179195
$extensionConfiguration: '@ApacheSolrForTypo3\Solr\System\Configuration\ExtensionConfiguration'
180196
$eventDispatcher: '@Psr\EventDispatcher\EventDispatcherInterface'
@@ -204,61 +220,76 @@ services:
204220
# Register search components
205221
ApacheSolrForTypo3\Solr\Search\AccessComponent:
206222
autowire: true
223+
shared: false
207224
tags:
208225
- name: event.listener
209226
identifier: 'solr.search-component.access'
210227
ApacheSolrForTypo3\Solr\Search\AnalysisComponent:
211228
autowire: true
229+
shared: false
212230
tags:
213231
- name: event.listener
214232
identifier: 'solr.search-component.analysis'
215233
ApacheSolrForTypo3\Solr\Search\DebugComponent:
216234
autowire: true
235+
shared: false
217236
tags:
218237
- name: event.listener
219238
identifier: 'solr.search-component.debug'
220239
ApacheSolrForTypo3\Solr\Search\ElevationComponent:
221240
autowire: true
241+
shared: false
222242
tags:
223243
- name: event.listener
224244
identifier: 'solr.search-component.elevation'
225245
ApacheSolrForTypo3\Solr\Search\GroupingComponent:
226246
autowire: true
247+
shared: false
227248
tags:
228249
- name: event.listener
229250
identifier: 'solr.search-component.grouping'
230251
ApacheSolrForTypo3\Solr\Search\FacetingComponent:
231252
autowire: true
253+
# Uses FacetRegistry, which is singleton. @todo: See classes doc-comment
254+
shared: true
232255
tags:
233256
- name: event.listener
234257
identifier: 'solr.search-component.faceting'
235258
ApacheSolrForTypo3\Solr\Search\HighlightingComponent:
236259
autowire: true
260+
shared: false
237261
tags:
238262
- name: event.listener
239263
identifier: 'solr.search-component.highlighting'
240264
ApacheSolrForTypo3\Solr\Search\LastSearchesComponent:
241265
autowire: true
266+
# @todo: See classes doc-comment
267+
shared: false
242268
tags:
243269
- name: event.listener
244270
identifier: 'solr.search-component.last-searches'
245271
ApacheSolrForTypo3\Solr\Search\RelevanceComponent:
246272
autowire: true
273+
shared: false
247274
tags:
248275
- name: event.listener
249276
identifier: 'solr.search-component.relevance'
250277
ApacheSolrForTypo3\Solr\Search\SortingComponent:
251278
autowire: true
279+
shared: false
252280
tags:
253281
- name: event.listener
254282
identifier: 'solr.search-component.sorting'
255283
ApacheSolrForTypo3\Solr\Search\SpellcheckingComponent:
256284
autowire: true
285+
shared: false
257286
tags:
258287
- name: event.listener
259288
identifier: 'solr.search-component.spellchecking'
260289
ApacheSolrForTypo3\Solr\Search\StatisticsComponent:
261290
autowire: true
291+
# @todo: See classes doc-comment
292+
shared: true
262293
tags:
263294
- name: event.listener
264295
identifier: 'solr.search-component.statistics'
@@ -269,38 +300,46 @@ services:
269300
### Indexing
270301
ApacheSolrForTypo3\Solr\EventListener\PageIndexer\FrontendGroupsModifier:
271302
autowire: true
303+
shared: false
272304
tags:
273305
- name: event.listener
274306
identifier: 'solr.index.PageIndexer.FrontendUserAuthenticator'
275307

276308
ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\PageIndexer:
277309
autowire: true
310+
shared: true
278311
tags:
279312
- name: event.listener
280313
identifier: 'solr.index.FrontendHelper.PageIndexer.indexPageContentAfterCacheableContentIsGenerated'
281314
ApacheSolrForTypo3\Solr\Task\IndexQueueWorkerTaskAdditionalFieldProvider:
282315
public: true
316+
shared: true
283317
arguments:
284318
$siteRepository: '@ApacheSolrForTypo3\Solr\Domain\Site\SiteRepository'
285319

286320
ApacheSolrForTypo3\Solr\EventListener\PageIndexer\AdditionalFieldsForPageIndexing:
287321
autowire: true
322+
shared: false
288323
tags:
289324
- name: event.listener
290325
identifier: 'solr.index.AdditionalFieldsForPageIndexing'
291326

292327
ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\PageFieldMappingIndexer:
293328
autowire: true
329+
shared: false
294330
tags:
295331
- name: event.listener
296332
identifier: 'solr.index.PageFieldMappingIndexer'
297333

298334
ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper\UserGroupDetector:
299335
autowire: true
336+
# Only once usable in same request. No usage in other contexts.
337+
shared: true
300338
autoconfigure: true
301339

302340
ApacheSolrForTypo3\Solr\EventListener\Extbase\PersistenceEventListener:
303341
autowire: true
342+
shared: true
304343
tags:
305344
- name: event.listener
306345
identifier: 'solr.index.ExtbaseEntityPersisted'
@@ -311,25 +350,28 @@ services:
311350

312351
### EXT:solr content objects
313352
ApacheSolrForTypo3\Solr\ContentObject\Classification:
353+
shared: false
314354
tags:
315355
- name: frontend.contentobject
316356
identifier: 'SOLR_CLASSIFICATION'
317357
ApacheSolrForTypo3\Solr\ContentObject\Content:
358+
shared: false
318359
tags:
319360
- name: frontend.contentobject
320361
identifier: 'SOLR_CONTENT'
321362
ApacheSolrForTypo3\Solr\ContentObject\Multivalue:
363+
shared: false
322364
tags:
323365
- name: frontend.contentobject
324366
identifier: 'SOLR_MULTIVALUE'
325367
ApacheSolrForTypo3\Solr\ContentObject\Relation:
368+
shared: false
326369
arguments:
327370
$tcaService: '@ApacheSolrForTypo3\Solr\System\TCA\TCAService'
328371
tags:
329372
- name: frontend.contentobject
330373
identifier: 'SOLR_RELATION'
331374

332-
333375
# Reports: Status
334376
ApacheSolrForTypo3\Solr\Report\:
335377
resource: '../Classes/Report/*'

0 commit comments

Comments
 (0)