34 'mb_substr' =>
'mbstring',
35 'utf8_encode' =>
'xml',
36 'ctype_digit' =>
'ctype',
37 'json_decode' =>
'json',
39 'mime_content_type' =>
'fileinfo',
83 ( defined(
'HHVM_VERSION' ) && $impl !==
'PHP' ) ||
87 'implementation' =>
'HHVM',
88 'version' => defined(
'HHVM_VERSION' ) ? HHVM_VERSION :
'undefined',
89 'vendor' =>
'Facebook',
90 'upstreamSupported' =>
'3.6.5',
91 'minSupported' =>
'3.6.5',
92 'upgradeURL' =>
'https://docs.hhvm.com/hhvm/installation/introduction',
96 'implementation' =>
'PHP',
97 'version' => PHP_VERSION,
98 'vendor' =>
'the PHP Group',
99 'upstreamSupported' =>
'5.5.0',
100 'minSupported' =>
'5.5.9',
101 'upgradeURL' =>
'https://secure.php.net/downloads.php',
112 $minimumVersion = $phpInfo[
'minSupported'];
113 $otherInfo = $this->
getPHPInfo( $phpInfo[
'implementation'] ===
'HHVM' ?
'PHP' :
'HHVM' );
115 !function_exists(
'version_compare' )
116 || version_compare( $phpInfo[
'version'], $minimumVersion ) < 0
118 $shortText =
"MediaWiki $this->mwVersion requires at least {$phpInfo['implementation']}"
119 .
" version $minimumVersion or {$otherInfo['implementation']} version "
120 .
"{$otherInfo['minSupported']}, you are using {$phpInfo['implementation']} "
121 .
"{$phpInfo['version']}.";
123 $longText =
"Error: You might be using an older {$phpInfo['implementation']} version. \n"
124 .
"MediaWiki $this->mwVersion needs {$phpInfo['implementation']}"
125 .
" $minimumVersion or higher or {$otherInfo['implementation']} version "
126 .
"{$otherInfo['minSupported']}.\n\nCheck if you have a"
127 .
" newer php executable with a different name, such as php5.\n\n";
130 Please consider <a
href=
"{$phpInfo['upgradeURL']}">upgrading your
copy of
131 {$phpInfo[
'implementation']}</a>.
132 {$phpInfo[
'implementation']} versions less than {$phpInfo[
'upstreamSupported']} are no
133 longer supported by {$phpInfo[
'vendor']} and will not receive
137 If
for some reason you are unable to upgrade your {$phpInfo[
'implementation']}
version,
138 you will need to <a
href=
"https://www.mediawiki.org/wiki/Download">download</a> an
140 See our <a
href=
"https://www.mediawiki.org/wiki/Compatibility#PHP">compatibility page</a>
141 for details of which versions are compatible with prior versions of {$phpInfo[
'implementation']}.
144 "Supported {$phpInfo['implementation']} versions",
158 if ( !file_exists( dirname( __FILE__ ) .
'/../vendor/autoload.php' ) ) {
159 $shortText =
"Installing some external dependencies (e.g. via composer) is required.";
161 $longText =
"Error: You are missing some external dependencies. \n"
162 .
"MediaWiki now also has some external dependencies that need to be installed\n"
163 .
"via composer or from a separate git repo. Please see\n"
164 .
"https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries\n"
165 .
"for help on installing the required components.";
168 MediaWiki now also has
some external dependencies that need to be installed via
169 composer or from a separate git repo. Please see
170 <a
href=
"https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries">mediawiki.org</a>
171 for help on installing the required components.
174 $this->
triggerError(
'External dependencies', $shortText, $longText, $longHtml );
184 $missingExtensions =
array();
185 foreach ( $this->functionsExtensionsMapping as $function => $extension ) {
186 if ( !function_exists( $function ) ) {
187 $missingExtensions[] = $extension;
191 if ( $missingExtensions ) {
192 $shortText =
"Installing some PHP extensions is required.";
194 $missingExtText =
'';
195 $missingExtHtml =
'';
196 $baseUrl =
'https://secure.php.net';
197 foreach ( $missingExtensions as
$ext ) {
198 $missingExtText .=
" * $ext <$baseUrl/$ext>\n";
199 $missingExtHtml .=
"<li><b>$ext</b> "
200 .
"(<a href=\"$baseUrl/$ext\">more information</a>)</li>";
203 $cliText =
"Error: Missing one or more required components of PHP.\n"
204 .
"You are missing a required extension to PHP that MediaWiki needs.\n"
205 .
"Please install:\n" . $missingExtText;
208 You are missing a required extension to
PHP that
MediaWiki
209 requires to run. Please install:
215 $this->
triggerError(
'Required components', $shortText, $cliText, $longHtml );
223 $protocol = isset( $_SERVER[
'SERVER_PROTOCOL'] ) ? $_SERVER[
'SERVER_PROTOCOL'] :
'HTTP/1.0';
225 header(
"$protocol 500 MediaWiki configuration Error" );
227 header(
'Cache-control: none' );
228 header(
'Pragma: no-cache' );
240 $pathinfo = pathinfo( $_SERVER[
'SCRIPT_NAME'] );
241 if ( $this->entryPoint ==
'mw-config/index.php' ) {
242 $dirname = dirname( $pathinfo[
'dirname'] );
244 $dirname = $pathinfo[
'dirname'];
247 htmlspecialchars( str_replace(
'//',
'/', $dirname .
'/' ) .
248 'resources/assets/mediawiki.png' );
249 $shortHtml = htmlspecialchars( $shortText );
251 header(
'Content-type: text/html; charset=UTF-8' );
253 $finalOutput = <<<HTML
255<html lang=
"en" dir=
"ltr">
257 <meta charset=
"UTF-8" />
258 <title>
MediaWiki {$this->mwVersion}</title>
259 <
style media=
'screen'>
262 background-
color: #fff;
263 font-family: sans-serif;
280 <img src=
"{$encLogo}" alt=
'The MediaWiki logo' />
281 <h1>
MediaWiki {$this->mwVersion}
internal error</h1>
312 switch ( $this->entryPoint ) {
314 $finalOutput = $longText;
317 case 'mw-config/index.php':
323 $finalOutput =
"/* $shortText */";
328 $finalOutput = $shortText;
331 echo
"$finalOutput\n";
345 $phpVersionCheck->setEntryPoint( $entryPoint );
346 $phpVersionCheck->checkRequiredPHPVersion();
347 $phpVersionCheck->checkVendorExistence();
348 $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.