Debian Codegraph @

includes/MediaWiki.php

raw symbols SCIP
1 <?php
2 /**
3 * Helper class for the index.php entry point.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 */
22
23 use MediaWiki\Context\IContextSource;
24 use MediaWiki\Context\RequestContext;
25 use MediaWiki\EntryPointEnvironment;
26 use MediaWiki\MediaWikiEntryPoint;
27 use MediaWiki\MediaWikiServices;
28
29 /**
30 * Backwards compatibility shim for use by extensions that created a MediaWiki object just in order to call
31 * doPostOutputShutdown().
32 *
33 * @deprecated since 1.42, use MediaWikiEntryPoint instead
34 */
35 class MediaWiki extends MediaWikiEntryPoint {
36
37 public function __construct(
38 ?IContextSource $context = null,
39 ?EntryPointEnvironment $environment = null
40 ) {
41 $context ??= RequestContext::getMain();
42 $environment ??= new EntryPointEnvironment();
43
44 parent::__construct( $context, $environment, MediaWikiServices::getInstance() );
45 }
46
47 /**
48 * @return never
49 */
50 protected function execute() {
51 throw new LogicException(
52 'The backwards-compat MediaWiki class does not implement the execute() method'
53 );
54 }
55
56 /**
57 * Overwritten to make public, for backwards compatibility
58 *
59 * @deprecated since 1.42, extensions should have no need to call this.
60 * Subclasses of MediaWikiEntryPoint in core should generally
61 * call postOutputShutdown() instead.
62 */
63 public function restInPeace() {
64 parent::restInPeace();
65 }
66
67 /**
68 * Overwritten to make public, for backwards compatibility.
69 *
70 * @deprecated since 1.42, extensions should have no need to call this.
71 */
72 public function doPostOutputShutdown() {
73 parent::doPostOutputShutdown();
74 }
75
76 /**
77 * This function commits all DB and session changes as needed *before* the
78 * client can receive a response (in case DB commit fails) and thus also before
79 * the response can trigger a subsequent related request by the client.
80 *
81 * @param IContextSource $context
82 *
83 * @since 1.27
84 * @deprecated since 1.42, extensions should have no need to call this.
85 * Subclasses of MediaWikiEntryPoint in core should generally
86 * call prepareForOutput() instead.
87 */
88 public static function preOutputCommit( IContextSource $context ) {
89 $entryPoint = new static( $context );
90 $entryPoint->prepareForOutput();
91 }
92
93 }