Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| MediaWiki | |
0.00% |
0 / 10 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| execute | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| restInPeace | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| doPostOutputShutdown | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| preOutputCommit | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Helper class for the index.php entry point. |
| 4 | * |
| 5 | * @license GPL-2.0-or-later |
| 6 | * @file |
| 7 | */ |
| 8 | |
| 9 | use MediaWiki\Context\IContextSource; |
| 10 | use MediaWiki\Context\RequestContext; |
| 11 | use MediaWiki\EntryPointEnvironment; |
| 12 | use MediaWiki\MediaWikiEntryPoint; |
| 13 | use MediaWiki\MediaWikiServices; |
| 14 | |
| 15 | /** |
| 16 | * Backwards compatibility shim for use by extensions that created a MediaWiki object just in order to call |
| 17 | * doPostOutputShutdown(). |
| 18 | * |
| 19 | * @deprecated since 1.42, use MediaWikiEntryPoint instead |
| 20 | */ |
| 21 | class MediaWiki extends MediaWikiEntryPoint { |
| 22 | |
| 23 | public function __construct( |
| 24 | ?IContextSource $context = null, |
| 25 | ?EntryPointEnvironment $environment = null |
| 26 | ) { |
| 27 | $context ??= RequestContext::getMain(); |
| 28 | $environment ??= new EntryPointEnvironment(); |
| 29 | |
| 30 | parent::__construct( $context, $environment, MediaWikiServices::getInstance() ); |
| 31 | } |
| 32 | |
| 33 | protected function execute(): never { |
| 34 | throw new LogicException( |
| 35 | 'The backwards-compat MediaWiki class does not implement the execute() method' |
| 36 | ); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Overwritten to make public, for backwards compatibility |
| 41 | * |
| 42 | * @deprecated since 1.42, extensions should have no need to call this. |
| 43 | * Subclasses of MediaWikiEntryPoint in core should generally |
| 44 | * call postOutputShutdown() instead. |
| 45 | */ |
| 46 | public function restInPeace() { |
| 47 | parent::restInPeace(); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Overwritten to make public, for backwards compatibility. |
| 52 | * |
| 53 | * @deprecated since 1.42, extensions should have no need to call this. |
| 54 | */ |
| 55 | public function doPostOutputShutdown() { |
| 56 | parent::doPostOutputShutdown(); |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * This function commits all DB and session changes as needed *before* the |
| 61 | * client can receive a response (in case DB commit fails) and thus also before |
| 62 | * the response can trigger a subsequent related request by the client. |
| 63 | * |
| 64 | * @param IContextSource $context |
| 65 | * |
| 66 | * @since 1.27 |
| 67 | * @deprecated since 1.42, extensions should have no need to call this. |
| 68 | * Subclasses of MediaWikiEntryPoint in core should generally |
| 69 | * call prepareForOutput() instead. |
| 70 | */ |
| 71 | public static function preOutputCommit( IContextSource $context ) { |
| 72 | $entryPoint = new static( $context ); |
| 73 | $entryPoint->prepareForOutput(); |
| 74 | } |
| 75 | |
| 76 | } |