32 'mb_substr' =>
'mbstring',
33 'xml_parser_create' =>
'xml',
34 'ctype_digit' =>
'ctype',
35 'json_decode' =>
'json',
37 'mime_content_type' =>
'fileinfo',
80 ( defined(
'HHVM_VERSION' ) && $impl !==
'PHP' ) ||
84 'implementation' =>
'HHVM',
85 'version' => defined(
'HHVM_VERSION' ) ? HHVM_VERSION :
'undefined',
86 'vendor' =>
'Facebook',
87 'upstreamSupported' =>
'3.18.5',
88 'minSupported' =>
'3.18.5',
89 'upgradeURL' =>
'https://docs.hhvm.com/hhvm/installation/introduction',
93 'implementation' =>
'PHP',
94 'version' => PHP_VERSION,
95 'vendor' =>
'the PHP Group',
96 'upstreamSupported' =>
'7.3.0',
97 'minSupported' =>
'7.0.13',
98 'upgradeURL' =>
'https://secure.php.net/downloads.php',
107 $minimumVersion = $phpInfo[
'minSupported'];
108 $otherInfo = $this->
getPHPInfo( $phpInfo[
'implementation'] ===
'HHVM' ?
'PHP' :
'HHVM' );
110 !function_exists(
'version_compare' )
111 || version_compare( $phpInfo[
'version'], $minimumVersion ) < 0
113 $shortText =
"MediaWiki $this->mwVersion requires at least {$phpInfo['implementation']}"
114 .
" version $minimumVersion or {$otherInfo['implementation']} version "
115 .
"{$otherInfo['minSupported']}, you are using {$phpInfo['implementation']} "
116 .
"{$phpInfo['version']}.";
118 $longText =
"Error: You might be using an older {$phpInfo['implementation']} version "
119 .
"({$phpInfo['implementation']} {$phpInfo['version']}). \n"
120 .
"MediaWiki $this->mwVersion needs {$phpInfo['implementation']}"
121 .
" $minimumVersion or higher or {$otherInfo['implementation']} version "
122 .
"{$otherInfo['minSupported']}.\n\nCheck if you have a"
123 .
" newer php executable with a different name.\n\n";
127 Please consider <a
href=
"{$phpInfo['upgradeURL']}">upgrading your
copy of
128 {$phpInfo[
'implementation']}</a>.
129 {$phpInfo[
'implementation']} versions less than {$phpInfo[
'upstreamSupported']} are no
130 longer supported by {$phpInfo[
'vendor']} and will not receive
134 If
for some reason you are unable to upgrade your {$phpInfo[
'implementation']}
version,
135 you will need to <a
href=
"https://www.mediawiki.org/wiki/Download">download</a> an
137 See our <a
href=
"https://www.mediawiki.org/wiki/Compatibility#PHP">compatibility page</a>
138 for details of which versions are compatible with prior versions of {$phpInfo[
'implementation']}.
142 "Supported {$phpInfo['implementation']} versions",
154 if ( !file_exists( dirname( __FILE__ ) .
'/../vendor/autoload.php' ) ) {
155 $shortText =
"Installing some external dependencies (e.g. via composer) is required.";
157 $longText =
"Error: You are missing some external dependencies. \n"
158 .
"MediaWiki now also has some external dependencies that need to be installed\n"
159 .
"via composer or from a separate git repo. Please see\n"
160 .
"https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries\n"
161 .
"for help on installing the required components.";
165 MediaWiki now also has
some external dependencies that need to be installed via
166 composer or from a separate git repo. Please see
167 <a
href=
"https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries">mediawiki.org</a>
168 for help on installing the required components.
172 $this->
triggerError(
'External dependencies', $shortText, $longText, $longHtml );
180 $missingExtensions =
array();
181 foreach ( $this->functionsExtensionsMapping as $function => $extension ) {
182 if ( !function_exists( $function ) ) {
183 $missingExtensions[] = $extension;
187 if ( $missingExtensions ) {
188 $shortText =
"Installing some PHP extensions is required.";
190 $missingExtText =
'';
191 $missingExtHtml =
'';
192 $baseUrl =
'https://secure.php.net';
193 foreach ( $missingExtensions as
$ext ) {
194 $missingExtText .=
" * $ext <$baseUrl/$ext>\n";
195 $missingExtHtml .=
"<li><b>$ext</b> "
196 .
"(<a href=\"$baseUrl/$ext\">more information</a>)</li>";
199 $cliText =
"Error: Missing one or more required components of PHP.\n"
200 .
"You are missing a required extension to PHP that MediaWiki needs.\n"
201 .
"Please install:\n" . $missingExtText;
204 You are missing a required extension to
PHP that
MediaWiki
205 requires to run. Please install:
211 $this->
triggerError(
'Required components', $shortText, $cliText, $longHtml );
219 $protocol = isset( $_SERVER[
'SERVER_PROTOCOL'] ) ? $_SERVER[
'SERVER_PROTOCOL'] :
'HTTP/1.0';
221 header(
"$protocol 500 MediaWiki configuration Error" );
223 header(
'Cache-control: none' );
224 header(
'Pragma: no-cache' );
236 $pathinfo = pathinfo( $_SERVER[
'SCRIPT_NAME'] );
237 if ( $this->entryPoint ==
'mw-config/index.php' ) {
238 $dirname = dirname( $pathinfo[
'dirname'] );
240 $dirname = $pathinfo[
'dirname'];
243 htmlspecialchars( str_replace(
'//',
'/', $dirname .
'/' ) .
244 'resources/assets/mediawiki.png' );
245 $shortHtml = htmlspecialchars( $shortText );
247 header(
'Content-type: text/html; charset=UTF-8' );
249 $finalOutput = <<<HTML
251<html lang=
"en" dir=
"ltr">
253 <meta charset=
"UTF-8" />
254 <title>
MediaWiki {$this->mwVersion}</title>
255 <
style media=
'screen'>
258 background-
color: #fff;
259 font-family: sans-serif;
276 <img src=
"{$encLogo}" alt=
'The MediaWiki logo' />
277 <h1>
MediaWiki {$this->mwVersion}
internal error</h1>
308 switch ( $this->entryPoint ) {
310 $finalOutput = $longText;
313 case 'mw-config/index.php':
319 $finalOutput =
"/* $shortText */";
324 $finalOutput = $shortText;
327 echo
"$finalOutput\n";
341 $phpVersionCheck->setEntryPoint( $entryPoint );
342 $phpVersionCheck->checkRequiredPHPVersion();
343 $phpVersionCheck->checkVendorExistence();
344 $phpVersionCheck->checkExtensionExistence();
in the sidebar</td >< td > font color
and give any other recipients of the Program a copy of this License along with the Program You may charge a fee for the physical act of transferring a copy
wfEntryPointCheck( $entryPoint)
Check php version and that external dependencies are installed, and display an informative error if e...
triggerError( $title, $shortText, $longText, $longHtml)
Display something vaguely comprehensible in the event of a totally unrecoverable error.
outputHTMLHeader()
Output headers that prevents error pages to be cached.
string $entryPoint
Which entry point we are protecting.
checkExtensionExistence()
Displays an error, if a PHP extension does not exist.
checkRequiredPHPVersion()
Displays an error, if the installed php version does not meet the minimum requirement.
checkVendorExistence()
Displays an error, if the vendor/autoload.php file could not be found.
$functionsExtensionsMapping
getPHPInfo( $impl=false)
Returns the version of the installed php implementation.
getIndexErrorOutput( $title, $longHtml, $shortText)
Returns an error page, which is suitable for output to the end user via a web browser.
setEntryPoint( $entryPoint)
The ContentHandler facility adds support for arbitrary content types on wiki instead of relying on wikitext for everything It was introduced in MediaWiki Each kind of and so on Built in content types as usual *javascript user provided javascript code *json simple implementation for use by etc *css user provided css code *text plain text In PHP
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these updates(as a Java servelet could)
I won t presume to tell you how to I m just describing the methods I chose to use for myself If you do choose to follow these it will probably be easier for you to collaborate with others on the but if you want to contribute without by all means do which work well I also use K &R brace matching style I know that s a religious issue for some
the array() calling protocol came about after MediaWiki 1.4rc1.
if(!is_readable( $file)) $ext