Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 16 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| ResourceLoaderEntryPoint | |
0.00% |
0 / 16 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| execute | |
0.00% |
0 / 15 |
|
0.00% |
0 / 1 |
2 | |||
| doPrepareForOutput | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * @license GPL-2.0-or-later |
| 4 | * @file |
| 5 | */ |
| 6 | |
| 7 | namespace MediaWiki\ResourceLoader; |
| 8 | |
| 9 | use MediaWiki\MediaWikiEntryPoint; |
| 10 | use MediaWiki\Profiler\Profiler; |
| 11 | |
| 12 | /** |
| 13 | * Entry point implementation for @ref ResourceLoader, which serves static CSS/JavaScript |
| 14 | * via @ref MediaWiki\ResourceLoader\Module Module subclasses. |
| 15 | * |
| 16 | * @see load.php |
| 17 | * @ingroup ResourceLoader |
| 18 | * @ingroup entrypoint |
| 19 | */ |
| 20 | class ResourceLoaderEntryPoint extends MediaWikiEntryPoint { |
| 21 | |
| 22 | /** |
| 23 | * Main entry point |
| 24 | */ |
| 25 | public function execute() { |
| 26 | $services = $this->getServiceContainer(); |
| 27 | |
| 28 | // Disable ChronologyProtector so that we don't wait for unrelated MediaWiki |
| 29 | // writes when getting database connections for ResourceLoader. (T192611) |
| 30 | $services->getChronologyProtector()->setEnabled( false ); |
| 31 | |
| 32 | $resourceLoader = $services->getResourceLoader(); |
| 33 | $context = new Context( |
| 34 | $resourceLoader, |
| 35 | $this->getRequest(), |
| 36 | array_keys( $services->getSkinFactory()->getInstalledSkins() ) |
| 37 | ); |
| 38 | |
| 39 | // T390929 |
| 40 | $extraHeaders = []; |
| 41 | $hookRunner = new HookRunner( $services->getHookContainer() ); |
| 42 | $hookRunner->onResourceLoaderBeforeResponse( $context, $extraHeaders ); |
| 43 | |
| 44 | // Respond to ResourceLoader request |
| 45 | $resourceLoader->respond( $context, $extraHeaders ); |
| 46 | |
| 47 | // Append any visible profiling data in a manner appropriate for the Content-Type |
| 48 | $profiler = Profiler::instance(); |
| 49 | $profiler->setAllowOutput(); |
| 50 | $profiler->logDataPageOutputOnly(); |
| 51 | } |
| 52 | |
| 53 | protected function doPrepareForOutput() { |
| 54 | // No-op. |
| 55 | // Do not call parent::doPrepareForOutput() to avoid |
| 56 | // commitMainTransaction() getting called. |
| 57 | } |
| 58 | } |