1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SMW; |
4
|
|
|
|
5
|
|
|
use Closure; |
6
|
|
|
use Onoi\CallbackContainer\ContainerBuilder; |
7
|
|
|
use Onoi\CallbackContainer\CallbackContainerFactory; |
8
|
|
|
use Parser; |
9
|
|
|
use ParserOutput; |
10
|
|
|
use SMW\Maintenance\MaintenanceFactory; |
11
|
|
|
use SMW\MediaWiki\Jobs\JobFactory; |
12
|
|
|
use SMW\MediaWiki\MwCollaboratorFactory; |
13
|
|
|
use SMW\MediaWiki\PageCreator; |
14
|
|
|
use SMW\MediaWiki\TitleCreator; |
15
|
|
|
use SMW\Query\ProfileAnnotator\QueryProfileAnnotatorFactory; |
16
|
|
|
use SMWQueryParser as QueryParser; |
17
|
|
|
use Title; |
18
|
|
|
use SMW\Services\SharedServicesContainer; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Application instances access for internal and external use |
22
|
|
|
* |
23
|
|
|
* @license GNU GPL v2+ |
24
|
|
|
* @since 2.0 |
25
|
|
|
* |
26
|
|
|
* @author mwjames |
27
|
|
|
*/ |
28
|
|
|
class ApplicationFactory { |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var ApplicationFactory |
32
|
|
|
*/ |
33
|
|
|
private static $instance = null; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var ContainerBuilder |
37
|
|
|
*/ |
38
|
|
|
private $containerBuilder; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var string |
42
|
350 |
|
*/ |
43
|
350 |
|
private $servicesFileDir = ''; |
44
|
350 |
|
|
45
|
|
|
/** |
46
|
|
|
* @since 2.0 |
47
|
|
|
* |
48
|
|
|
* @param ContainerBuilder|null $containerBuilder |
49
|
|
|
* @param string $servicesFileDir |
50
|
|
|
*/ |
51
|
|
|
public function __construct( ContainerBuilder $containerBuilder = null, $servicesFileDir = '' ) { |
52
|
|
|
$this->containerBuilder = $containerBuilder; |
53
|
|
|
$this->servicesFileDir = $servicesFileDir; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* This method returns the global instance of the application factory. |
58
|
|
|
* |
59
|
|
|
* Reliance on global state is needed at entry points into SMW such as |
60
|
382 |
|
* hook handlers, special pages and jobs, since there we tend to not |
61
|
|
|
* have control over the object lifecycle. Pragmatically we might also |
62
|
382 |
|
* want to use this when refactoring legacy code that already has the |
63
|
350 |
|
* global state dependency. For new code very special justification is |
64
|
|
|
* required to rely on global state. |
65
|
|
|
* |
66
|
382 |
|
* @since 2.0 |
67
|
|
|
* |
68
|
|
|
* @return self |
69
|
|
|
*/ |
70
|
|
|
public static function getInstance() { |
|
|
|
|
71
|
|
|
|
72
|
370 |
|
if ( self::$instance !== null ) { |
73
|
|
|
return self::$instance; |
74
|
370 |
|
} |
75
|
370 |
|
|
76
|
|
|
$servicesFileDir = $GLOBALS['smwgServicesFileDir']; |
77
|
|
|
|
78
|
370 |
|
$containerBuilder = self::newContainerBuilder( |
79
|
370 |
|
new CallbackContainerFactory(), |
80
|
|
|
$servicesFileDir |
81
|
|
|
); |
82
|
|
|
|
83
|
|
|
return self::$instance = new self( $containerBuilder, $servicesFileDir ); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
323 |
|
* @since 2.0 |
88
|
323 |
|
*/ |
89
|
323 |
|
public static function clear() { |
90
|
|
|
|
91
|
|
|
if ( self::$instance !== null ) { |
92
|
|
|
self::$instance->getSettings()->clear(); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
self::$instance = null; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @since 2.0 |
100
|
|
|
* |
101
|
|
|
* @param string $objectName |
102
|
|
|
* @param callable|array $objectSignature |
103
|
280 |
|
*/ |
104
|
280 |
|
public function registerObject( $objectName, $objectSignature ) { |
105
|
|
|
$this->containerBuilder->registerObject( $objectName, $objectSignature ); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @since 2.5 |
110
|
|
|
* |
111
|
|
|
* @param string $file |
112
|
|
|
*/ |
113
|
|
|
public function registerFromFile( $file ) { |
114
|
|
|
$this->containerBuilder->registerFromFile( $file ); |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @private |
119
|
9 |
|
* |
120
|
9 |
|
* @note Services called via this function are for internal use only and |
121
|
|
|
* not to be relied upon for external access. |
122
|
|
|
* |
123
|
|
|
* |
124
|
|
|
* @param string $serviceName |
125
|
|
|
* |
126
|
|
|
* @return mixed |
127
|
|
|
*/ |
128
|
231 |
|
public function singleton( $serviceName ) { |
|
|
|
|
129
|
231 |
|
return call_user_func_array( array( $this->containerBuilder, 'singleton' ), func_get_args() ); |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @private |
134
|
|
|
* |
135
|
|
|
* @note Services called via this function are for internal use only and |
136
|
|
|
* not to be relied upon for external access. |
137
|
235 |
|
* |
138
|
235 |
|
* @since 2.5 |
139
|
|
|
* |
140
|
|
|
* @param string $serviceName |
141
|
|
|
* |
142
|
|
|
* @return mixed |
143
|
|
|
*/ |
144
|
|
|
public function create( $serviceName ) { |
|
|
|
|
145
|
|
|
return call_user_func_array( array( $this->containerBuilder, 'create' ), func_get_args() ); |
146
|
|
|
} |
147
|
|
|
|
148
|
15 |
|
/** |
149
|
15 |
|
* @since 2.0 |
150
|
|
|
* |
151
|
|
|
* @return SerializerFactory |
152
|
|
|
*/ |
153
|
|
|
public function newSerializerFactory() { |
154
|
|
|
return new SerializerFactory(); |
155
|
|
|
} |
156
|
|
|
|
157
|
9 |
|
/** |
158
|
9 |
|
* @since 2.0 |
159
|
|
|
* |
160
|
|
|
* @return JobFactory |
161
|
|
|
*/ |
162
|
|
|
public function newJobFactory() { |
163
|
|
|
return $this->containerBuilder->create( 'JobFactory' ); |
164
|
|
|
} |
165
|
|
|
|
166
|
305 |
|
/** |
167
|
305 |
|
* @since 2.1 |
168
|
|
|
* |
169
|
|
|
* @param Parser $parser |
170
|
|
|
* |
171
|
|
|
* @return ParserFunctionFactory |
172
|
|
|
*/ |
173
|
|
|
public function newParserFunctionFactory( Parser $parser ) { |
174
|
|
|
return new ParserFunctionFactory( $parser ); |
175
|
209 |
|
} |
176
|
209 |
|
|
177
|
|
|
/** |
178
|
|
|
* @since 2.2 |
179
|
|
|
* |
180
|
|
|
* @return MaintenanceFactory |
181
|
|
|
*/ |
182
|
|
|
public function newMaintenanceFactory() { |
183
|
|
|
return new MaintenanceFactory(); |
184
|
|
|
} |
185
|
|
|
|
186
|
100 |
|
/** |
187
|
100 |
|
* @since 2.2 |
188
|
|
|
* |
189
|
|
|
* @return CacheFactory |
190
|
|
|
*/ |
191
|
|
|
public function newCacheFactory() { |
192
|
|
|
return $this->containerBuilder->create( 'CacheFactory', $this->getSettings()->get( 'smwgCacheType' ) ); |
|
|
|
|
193
|
|
|
} |
194
|
|
|
|
195
|
346 |
|
/** |
196
|
346 |
|
* @since 2.2 |
197
|
|
|
* |
198
|
|
|
* @return CacheFactory |
199
|
|
|
*/ |
200
|
|
|
public function getCacheFactory() { |
201
|
|
|
return $this->containerBuilder->singleton( 'CacheFactory', $this->getSettings()->get( 'smwgCacheType' ) ); |
|
|
|
|
202
|
|
|
} |
203
|
|
|
|
204
|
375 |
|
/** |
205
|
375 |
|
* @since 2.5 |
206
|
|
|
* |
207
|
|
|
* @param string|null $source |
208
|
|
|
* |
209
|
|
|
* @return QuerySourceFactory |
210
|
|
|
*/ |
211
|
|
|
public function getQuerySourceFactory( $source = null ) { |
|
|
|
|
212
|
|
|
return $this->containerBuilder->singleton( 'QuerySourceFactory' ); |
213
|
6 |
|
} |
214
|
6 |
|
|
215
|
|
|
/** |
216
|
|
|
* @since 2.0 |
217
|
|
|
* |
218
|
|
|
* @return Store |
219
|
|
|
*/ |
220
|
|
|
public function getStore( $store = null ) { |
221
|
|
|
return $this->containerBuilder->singleton( 'Store', $store ); |
|
|
|
|
222
|
224 |
|
} |
223
|
224 |
|
|
224
|
|
|
/** |
225
|
|
|
* @since 2.0 |
226
|
|
|
* |
227
|
|
|
* @return Settings |
228
|
|
|
*/ |
229
|
|
|
public function getSettings() { |
230
|
|
|
return $this->containerBuilder->singleton( 'Settings' ); |
231
|
10 |
|
} |
232
|
10 |
|
|
233
|
|
|
/** |
234
|
|
|
* @since 2.0 |
235
|
|
|
* |
236
|
|
|
* @return TitleCreator |
237
|
|
|
*/ |
238
|
|
|
public function newTitleCreator() { |
239
|
|
|
return $this->containerBuilder->create( 'TitleCreator', $this->newPageCreator() ); |
|
|
|
|
240
|
6 |
|
} |
241
|
6 |
|
|
242
|
|
|
/** |
243
|
|
|
* @since 2.0 |
244
|
|
|
* |
245
|
|
|
* @return PageCreator |
246
|
|
|
*/ |
247
|
|
|
public function newPageCreator() { |
248
|
|
|
return $this->containerBuilder->create( 'PageCreator' ); |
249
|
211 |
|
} |
250
|
211 |
|
|
251
|
|
|
/** |
252
|
|
|
* @since 2.5 |
253
|
|
|
* |
254
|
|
|
* @return PageUpdater |
255
|
|
|
*/ |
256
|
|
|
public function newPageUpdater() { |
|
|
|
|
257
|
|
|
|
258
|
218 |
|
$pageUpdater = $this->containerBuilder->create( |
259
|
|
|
'PageUpdater', |
260
|
218 |
|
$this->getStore()->getConnection( 'mw.db' ) |
|
|
|
|
261
|
|
|
); |
262
|
218 |
|
|
263
|
|
|
$pageUpdater->setLogger( |
264
|
218 |
|
$this->getMediaWikiLogger() |
265
|
218 |
|
); |
266
|
|
|
|
267
|
|
|
$pageUpdater->isCommandLineMode( |
268
|
218 |
|
$GLOBALS['wgCommandLineMode'] |
269
|
218 |
|
); |
270
|
|
|
|
271
|
|
|
// https://phabricator.wikimedia.org/T154427 |
272
|
|
|
// It is unclear what changed in MW 1.29 but it has been observed that |
273
|
218 |
|
// executing a HTMLCacheUpdate from within an transaction can lead to a |
274
|
|
|
// "ErrorException ... 1 buffered job ... HTMLCacheUpdateJob never |
275
|
218 |
|
// inserted" hence disable the update functionality |
276
|
218 |
|
$pageUpdater->isHtmlCacheUpdate( |
277
|
|
|
false |
278
|
|
|
); |
279
|
218 |
|
|
280
|
|
|
return $pageUpdater; |
281
|
|
|
} |
282
|
|
|
|
283
|
|
|
/** |
284
|
|
|
* @since 2.5 |
285
|
|
|
* |
286
|
|
|
* @return IteratorFactory |
287
|
234 |
|
*/ |
288
|
234 |
|
public function getIteratorFactory() { |
289
|
|
|
return $this->containerBuilder->singleton( 'IteratorFactory' ); |
290
|
|
|
} |
291
|
|
|
|
292
|
|
|
/** |
293
|
|
|
* @since 2.5 |
294
|
|
|
* |
295
|
|
|
* @return DataValueFactory |
296
|
30 |
|
*/ |
297
|
30 |
|
public function getDataValueFactory() { |
298
|
|
|
return DataValueFactory::getInstance(); |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
/** |
302
|
|
|
* @since 2.0 |
303
|
|
|
* |
304
|
|
|
* @return Cache |
305
|
|
|
*/ |
306
|
|
|
public function getCache( $cacheType = null ) { |
307
|
220 |
|
return $this->containerBuilder->singleton( 'Cache', $cacheType ); |
|
|
|
|
308
|
220 |
|
} |
309
|
|
|
|
310
|
|
|
/** |
311
|
|
|
* @since 2.0 |
312
|
|
|
* |
313
|
|
|
* @return InTextAnnotationParser |
314
|
|
|
*/ |
315
|
|
|
public function newInTextAnnotationParser( ParserData $parserData ) { |
316
|
273 |
|
|
317
|
273 |
|
$mwCollaboratorFactory = $this->newMwCollaboratorFactory(); |
318
|
|
|
|
319
|
|
|
$linksProcessor = $this->containerBuilder->create( 'LinksProcessor' ); |
320
|
|
|
|
321
|
|
|
$linksProcessor->isStrictMode( |
322
|
|
|
$this->getSettings()->get( 'smwgEnabledInTextAnnotationParserStrictMode' ) |
323
|
|
|
); |
324
|
|
|
|
325
|
221 |
|
$inTextAnnotationParser = new InTextAnnotationParser( |
326
|
221 |
|
$parserData, |
327
|
|
|
$linksProcessor, |
328
|
|
|
$mwCollaboratorFactory->newMagicWordsFinder(), |
329
|
|
|
$mwCollaboratorFactory->newRedirectTargetFinder() |
330
|
|
|
); |
331
|
|
|
|
332
|
|
|
// 2.5+ Changed modus operandi |
333
|
|
|
$linksInValues = $this->getSettings()->get( 'smwgLinksInValues' ); |
334
|
245 |
|
|
335
|
245 |
|
$inTextAnnotationParser->enabledLinksInValues( |
336
|
|
|
$linksInValues === true ? SMW_LINV_PCRE : $linksInValues |
337
|
|
|
); |
338
|
|
|
|
339
|
|
|
return $inTextAnnotationParser; |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
/** |
343
|
251 |
|
* @since 2.0 |
344
|
251 |
|
* |
345
|
|
|
* @return ParserData |
346
|
|
|
*/ |
347
|
|
|
public function newParserData( Title $title, ParserOutput $parserOutput ) { |
348
|
|
|
return $this->containerBuilder->create( 'ParserData', $title, $parserOutput ); |
|
|
|
|
349
|
|
|
} |
350
|
|
|
|
351
|
|
|
/** |
352
|
286 |
|
* @since 2.0 |
353
|
286 |
|
* |
354
|
|
|
* @return ContentParser |
355
|
|
|
*/ |
356
|
|
|
public function newContentParser( Title $title ) { |
357
|
|
|
return $this->containerBuilder->create( 'ContentParser', $title ); |
|
|
|
|
358
|
|
|
} |
359
|
|
|
|
360
|
|
|
/** |
361
|
240 |
|
* @since 2.1 |
362
|
240 |
|
* |
363
|
|
|
* @param SemanticData $semanticData |
364
|
|
|
* |
365
|
|
|
* @return StoreUpdater |
366
|
|
|
*/ |
367
|
|
|
public function newStoreUpdater( SemanticData $semanticData ) { |
368
|
|
|
return new StoreUpdater( $this->getStore(), $semanticData ); |
369
|
|
|
} |
370
|
242 |
|
|
371
|
242 |
|
/** |
372
|
|
|
* @since 2.1 |
373
|
|
|
* |
374
|
|
|
* @return MwCollaboratorFactory |
375
|
|
|
*/ |
376
|
|
|
public function newMwCollaboratorFactory() { |
377
|
|
|
return new MwCollaboratorFactory( $this ); |
378
|
|
|
} |
379
|
309 |
|
|
380
|
309 |
|
/** |
381
|
|
|
* @since 2.1 |
382
|
|
|
* |
383
|
|
|
* @return NamespaceExaminer |
384
|
|
|
*/ |
385
|
|
|
public function getNamespaceExaminer() { |
386
|
|
|
return $this->containerBuilder->create( 'NamespaceExaminer' ); |
387
|
|
|
} |
388
|
1 |
|
|
389
|
1 |
|
/** |
390
|
|
|
* @since 2.4 |
391
|
|
|
* |
392
|
|
|
* @return PropertySpecificationLookup |
393
|
|
|
*/ |
394
|
|
|
public function getPropertySpecificationLookup() { |
395
|
|
|
return $this->containerBuilder->singleton( 'PropertySpecificationLookup' ); |
396
|
|
|
} |
397
|
|
|
|
398
|
|
|
/** |
399
|
270 |
|
* @since 2.4 |
400
|
|
|
* |
401
|
270 |
|
* @return PropertyHierarchyLookup |
402
|
270 |
|
*/ |
403
|
|
|
public function newPropertyHierarchyLookup() { |
404
|
|
|
return $this->containerBuilder->create( 'PropertyHierarchyLookup' ); |
405
|
|
|
} |
406
|
270 |
|
|
407
|
270 |
|
/** |
408
|
|
|
* @since 2.5 |
409
|
|
|
* |
410
|
270 |
|
* @return PropertyLabelFinder |
411
|
270 |
|
*/ |
412
|
|
|
public function getPropertyLabelFinder() { |
413
|
|
|
return $this->containerBuilder->singleton( 'PropertyLabelFinder' ); |
414
|
270 |
|
} |
415
|
|
|
|
416
|
|
|
/** |
417
|
|
|
* @since 2.4 |
418
|
|
|
* |
419
|
|
|
* @return CachedPropertyValuesPrefetcher |
420
|
|
|
*/ |
421
|
|
|
public function getCachedPropertyValuesPrefetcher() { |
422
|
|
|
return $this->containerBuilder->singleton( 'CachedPropertyValuesPrefetcher' ); |
423
|
|
|
} |
424
|
|
|
|
425
|
|
|
/** |
426
|
|
|
* @since 2.4 |
427
|
|
|
* |
428
|
|
|
* @return MediaWikiNsContentReader |
429
|
|
|
*/ |
430
|
|
|
public function getMediaWikiNsContentReader() { |
431
|
|
|
return $this->containerBuilder->singleton( 'MediaWikiNsContentReader' ); |
432
|
120 |
|
} |
433
|
120 |
|
|
434
|
|
|
/** |
435
|
|
|
* @since 2.4 |
436
|
|
|
* |
437
|
|
|
* @return InMemoryPoolCache |
438
|
|
|
*/ |
439
|
|
|
public function getInMemoryPoolCache() { |
440
|
|
|
return $this->containerBuilder->singleton( 'InMemoryPoolCache' ); |
441
|
245 |
|
} |
442
|
245 |
|
|
443
|
|
|
/** |
444
|
|
|
* @since 2.5 |
445
|
|
|
* |
446
|
|
|
* @return \createBalancer |
447
|
|
|
*/ |
448
|
|
|
public function getLoadBalancer() { |
449
|
|
|
return $this->containerBuilder->singleton( 'DBLoadBalancer' ); |
450
|
305 |
|
} |
451
|
305 |
|
|
452
|
|
|
/** |
453
|
|
|
* @since 2.4 |
454
|
350 |
|
* |
455
|
|
|
* @param Closure $callback |
456
|
350 |
|
* |
457
|
350 |
|
* @return DeferredCallableUpdate |
458
|
|
|
*/ |
459
|
|
|
public function newDeferredCallableUpdate( Closure $callback ) { |
|
|
|
|
460
|
350 |
|
|
461
|
|
|
$store = $this->getStore(); |
462
|
|
|
|
463
|
|
|
$deferredCallableUpdate = $this->containerBuilder->create( |
464
|
|
|
'DeferredCallableUpdate', |
465
|
|
|
$callback, |
|
|
|
|
466
|
|
|
$store->getConnection( 'mw.db' ) |
467
|
|
|
); |
468
|
|
|
|
469
|
|
|
$deferredCallableUpdate->enabledDeferredUpdate( |
470
|
|
|
$this->getSettings()->get( 'smwgEnabledDeferredUpdate' ) |
471
|
|
|
); |
472
|
|
|
|
473
|
|
|
$deferredCallableUpdate->setLogger( |
474
|
|
|
$this->getMediaWikiLogger() |
475
|
|
|
); |
476
|
|
|
|
477
|
|
|
$deferredCallableUpdate->isCommandLineMode( |
478
|
|
|
$store->getOptions()->has( 'isCommandLineMode' ) ? $store->getOptions()->get( 'isCommandLineMode' ) : $GLOBALS['wgCommandLineMode'] |
479
|
|
|
); |
480
|
|
|
|
481
|
|
|
return $deferredCallableUpdate; |
482
|
|
|
} |
483
|
|
|
|
484
|
|
|
/** |
485
|
|
|
* @deprecated since 2.5, use QueryFactory::newQueryParser |
486
|
|
|
* @since 2.1 |
487
|
|
|
* |
488
|
|
|
* @return QueryParser |
489
|
|
|
*/ |
490
|
|
|
public function newQueryParser() { |
491
|
|
|
return $this->getQueryFactory()->newQueryParser(); |
492
|
|
|
} |
493
|
|
|
|
494
|
|
|
/** |
495
|
|
|
* @since 2.5 |
496
|
|
|
* |
497
|
|
|
* @return DataItemFactory |
498
|
|
|
*/ |
499
|
|
|
public function getDataItemFactory() { |
500
|
|
|
return $this->containerBuilder->singleton( 'DataItemFactory' ); |
501
|
|
|
} |
502
|
|
|
|
503
|
|
|
/** |
504
|
|
|
* @since 2.5 |
505
|
|
|
* |
506
|
|
|
* @return QueryFactory |
507
|
|
|
*/ |
508
|
|
|
public function getQueryFactory() { |
509
|
|
|
return $this->containerBuilder->singleton( 'QueryFactory' ); |
510
|
|
|
} |
511
|
|
|
|
512
|
|
|
/** |
513
|
|
|
* @since 2.5 |
514
|
|
|
* |
515
|
|
|
* @return LoggerInterface |
516
|
|
|
*/ |
517
|
|
|
public function getMediaWikiLogger() { |
518
|
|
|
return $this->containerBuilder->singleton( 'MediaWikiLogger' ); |
519
|
|
|
} |
520
|
|
|
|
521
|
|
|
private static function newContainerBuilder( CallbackContainerFactory $callbackContainerFactory, $servicesFileDir ) { |
522
|
|
|
|
523
|
|
|
$containerBuilder = $callbackContainerFactory->newCallbackContainerBuilder(); |
524
|
|
|
|
525
|
|
|
$containerBuilder->registerCallbackContainer( new SharedServicesContainer() ); |
526
|
|
|
$containerBuilder->registerFromFile( $servicesFileDir . '/' . 'MediaWikiServices.php' ); |
527
|
|
|
$containerBuilder->registerFromFile( $servicesFileDir . '/' . 'ImporterServices.php' ); |
528
|
|
|
|
529
|
|
|
// $containerBuilder = $callbackContainerFactory->newLoggableContainerBuilder( |
|
|
|
|
530
|
|
|
// $containerBuilder, |
531
|
|
|
// $callbackContainerFactory->newBacktraceSniffer( 10 ), |
|
|
|
|
532
|
|
|
// $callbackContainerFactory->newCallFuncMemorySniffer() |
|
|
|
|
533
|
|
|
// ); |
534
|
|
|
// $containerBuilder->setLogger( $containerBuilder->singleton( 'MediaWikiLogger' ) ); |
|
|
|
|
535
|
|
|
|
536
|
|
|
return $containerBuilder; |
537
|
|
|
} |
538
|
|
|
|
539
|
|
|
} |
540
|
|
|
|
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: