33 'mb_substr' =>
'mbstring',
34 'xml_parser_create' =>
'xml',
35 'ctype_digit' =>
'ctype',
36 'json_decode' =>
'json',
38 'mime_content_type' =>
'fileinfo',
81 ( defined(
'HHVM_VERSION' ) && $impl !==
'PHP' ) ||
85 'implementation' =>
'HHVM',
86 'version' => defined(
'HHVM_VERSION' ) ? HHVM_VERSION :
'undefined',
87 'vendor' =>
'Facebook',
88 'upstreamSupported' =>
'3.18.5',
89 'minSupported' =>
'3.18.5',
90 'upgradeURL' =>
'https://docs.hhvm.com/hhvm/installation/introduction',
94 'implementation' =>
'PHP',
95 'version' => PHP_VERSION,
96 'vendor' =>
'the PHP Group',
97 'upstreamSupported' =>
'5.6.0',
98 'minSupported' =>
'7.0.13',
99 'upgradeURL' =>
'https://secure.php.net/downloads.php',
108 $minimumVersion = $phpInfo[
'minSupported'];
109 $otherInfo = $this->
getPHPInfo( $phpInfo[
'implementation'] ===
'HHVM' ?
'PHP' :
'HHVM' );
111 !function_exists(
'version_compare' )
112 || version_compare( $phpInfo[
'version'], $minimumVersion ) < 0
114 $shortText =
"MediaWiki $this->mwVersion requires at least {$phpInfo['implementation']}"
115 .
" version $minimumVersion or {$otherInfo['implementation']} version "
116 .
"{$otherInfo['minSupported']}, you are using {$phpInfo['implementation']} "
117 .
"{$phpInfo['version']}.";
119 $longText =
"Error: You might be using an older {$phpInfo['implementation']} version "
120 .
"({$phpInfo['implementation']} {$phpInfo['version']}). \n"
121 .
"MediaWiki $this->mwVersion needs {$phpInfo['implementation']}"
122 .
" $minimumVersion or higher or {$otherInfo['implementation']} version "
123 .
"{$otherInfo['minSupported']}.\n\nCheck if you have a"
124 .
" newer php executable with a different name.\n\n";
128 Please consider <a
href=
"{$phpInfo['upgradeURL']}">upgrading your
copy of
129 {$phpInfo[
'implementation']}</a>.
130 {$phpInfo[
'implementation']} versions less than {$phpInfo[
'upstreamSupported']} are no
131 longer supported by {$phpInfo[
'vendor']} and will not receive
132 security or bugfix updates.
135 If
for some reason you are unable to upgrade your {$phpInfo[
'implementation']}
version,
136 you will need to <a
href=
"https://www.mediawiki.org/wiki/Download">download</a> an
138 See our <a
href=
"https://www.mediawiki.org/wiki/Compatibility#PHP">compatibility page</a>
139 for details of which versions are compatible with prior versions of {$phpInfo[
'implementation']}.
143 "Supported {$phpInfo['implementation']} versions",
155 if ( !file_exists( dirname( __FILE__ ) .
'/../vendor/autoload.php' ) ) {
156 $shortText =
"Installing some external dependencies (e.g. via composer) is required.";
158 $longText =
"Error: You are missing some external dependencies. \n"
159 .
"MediaWiki now also has some external dependencies that need to be installed\n"
160 .
"via composer or from a separate git repo. Please see\n"
161 .
"https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries\n"
162 .
"for help on installing the required components.";
166 MediaWiki now also has some external dependencies that need to be installed via
167 composer or from a separate git repo. Please see
168 <a
href=
"https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries">mediawiki.org</a>
169 for help on installing the required components.
173 $this->
triggerError(
'External dependencies', $shortText, $longText, $longHtml );
181 $missingExtensions =
array();
182 foreach ( $this->functionsExtensionsMapping as $function => $extension ) {
183 if ( !function_exists( $function ) ) {
184 $missingExtensions[] = $extension;
188 if ( $missingExtensions ) {
189 $shortText =
"Installing some PHP extensions is required.";
191 $missingExtText =
'';
192 $missingExtHtml =
'';
193 $baseUrl =
'https://secure.php.net';
194 foreach ( $missingExtensions as
$ext ) {
195 $missingExtText .=
" * $ext <$baseUrl/$ext>\n";
196 $missingExtHtml .=
"<li><b>$ext</b> "
197 .
"(<a href=\"$baseUrl/$ext\">more information</a>)</li>";
200 $cliText =
"Error: Missing one or more required components of PHP.\n"
201 .
"You are missing a required extension to PHP that MediaWiki needs.\n"
202 .
"Please install:\n" . $missingExtText;
205 You are missing a required extension to
PHP that
MediaWiki
206 requires to run. Please install:
212 $this->
triggerError(
'Required components', $shortText, $cliText, $longHtml );
220 $protocol = isset( $_SERVER[
'SERVER_PROTOCOL'] ) ? $_SERVER[
'SERVER_PROTOCOL'] :
'HTTP/1.0';
222 header(
"$protocol 500 MediaWiki configuration Error" );
224 header(
'Cache-control: none' );
225 header(
'Pragma: no-cache' );
237 $pathinfo = pathinfo( $_SERVER[
'SCRIPT_NAME'] );
238 if ( $this->entryPoint ==
'mw-config/index.php' ) {
239 $dirname = dirname( $pathinfo[
'dirname'] );
241 $dirname = $pathinfo[
'dirname'];
244 htmlspecialchars( str_replace(
'//',
'/', $dirname .
'/' ) .
245 'resources/assets/mediawiki.png' );
246 $shortHtml = htmlspecialchars( $shortText );
248 header(
'Content-type: text/html; charset=UTF-8' );
250 $finalOutput = <<<HTML
252<html lang=
"en" dir=
"ltr">
254 <meta charset=
"UTF-8" />
255 <title>
MediaWiki {$this->mwVersion}</title>
256 <
style media=
'screen'>
259 background-
color: #fff;
260 font-family: sans-serif;
277 <img src=
"{$encLogo}" alt=
'The MediaWiki logo' />
278 <h1>
MediaWiki {$this->mwVersion}
internal error</h1>
309 switch ( $this->entryPoint ) {
311 $finalOutput = $longText;
314 case 'mw-config/index.php':
320 $finalOutput =
"/* $shortText */";
325 $finalOutput = $shortText;
328 echo
"$finalOutput\n";
342 $phpVersionCheck->setEntryPoint( $entryPoint );
343 $phpVersionCheck->checkRequiredPHPVersion();
344 $phpVersionCheck->checkVendorExistence();
345 $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
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
if(!is_readable( $file)) $ext