MediaWiki
REL1_24
|
00001 <?php 00041 function wfPHPVersionError( $type ) { 00042 $mwVersion = '1.24'; 00043 $minimumVersionPHP = '5.3.2'; 00044 00045 $phpVersion = PHP_VERSION; 00046 $protocol = isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0'; 00047 $message = "MediaWiki $mwVersion requires at least " 00048 . "PHP version $minimumVersionPHP, you are using PHP $phpVersion."; 00049 00050 if ( $type == 'cli' ) { 00051 $finalOutput = "You are using PHP version $phpVersion " 00052 . "but MediaWiki $mwVersion needs PHP $minimumVersionPHP or higher. ABORTING.\n" 00053 . "Check if you have a newer php executable with a different name, such as php5.\n"; 00054 } elseif ( $type == 'index.php' || $type == 'mw-config/index.php' ) { 00055 $pathinfo = pathinfo( $_SERVER['SCRIPT_NAME'] ); 00056 if ( $type == 'mw-config/index.php' ) { 00057 $dirname = dirname( $pathinfo['dirname'] ); 00058 } else { 00059 $dirname = $pathinfo['dirname']; 00060 } 00061 $encLogo = htmlspecialchars( 00062 str_replace( '//', '/', $dirname . '/' ) . 00063 'resources/assets/mediawiki.png' 00064 ); 00065 00066 header( "$protocol 500 MediaWiki configuration Error" ); 00067 header( 'Content-type: text/html; charset=UTF-8' ); 00068 // Don't cache error pages! They cause no end of trouble... 00069 header( 'Cache-control: none' ); 00070 header( 'Pragma: no-cache' ); 00071 00072 $finalOutput = <<<HTML 00073 <!DOCTYPE html> 00074 <html lang="en" dir="ltr"> 00075 <head> 00076 <meta charset="UTF-8" /> 00077 <title>MediaWiki {$mwVersion}</title> 00078 <style media='screen'> 00079 body { 00080 color: #000; 00081 background-color: #fff; 00082 font-family: sans-serif; 00083 padding: 2em; 00084 text-align: center; 00085 } 00086 p, img, h1 { 00087 text-align: left; 00088 margin: 0.5em 0; 00089 } 00090 h1 { 00091 font-size: 120%; 00092 } 00093 </style> 00094 </head> 00095 <body> 00096 <img src="{$encLogo}" alt='The MediaWiki logo' /> 00097 <h1>MediaWiki {$mwVersion} internal error</h1> 00098 <div class='error'> 00099 <p> 00100 {$message} 00101 </p> 00102 <p> 00103 Please consider <a href="http://www.php.net/downloads.php">upgrading your copy of PHP</a>. 00104 PHP versions less than 5.3.0 are no longer supported by the PHP Group and will not receive 00105 security or bugfix updates. 00106 </p> 00107 <p> 00108 If for some reason you are unable to upgrade your PHP version, you will need to 00109 <a href="https://www.mediawiki.org/wiki/Download">download</a> an older version 00110 of MediaWiki from our website. See our 00111 <a href="https://www.mediawiki.org/wiki/Compatibility#PHP">compatibility page</a> 00112 for details of which versions are compatible with prior versions of PHP. 00113 </p> 00114 </div> 00115 </body> 00116 </html> 00117 HTML; 00118 // Handle everything that's not index.php 00119 } else { 00120 // So nothing thinks this is JS or CSS 00121 $finalOutput = ( $type == 'load.php' ) ? "/* $message */" : $message; 00122 header( "$protocol 500 MediaWiki configuration Error" ); 00123 } 00124 echo "$finalOutput\n"; 00125 die( 1 ); 00126 }