MediaWiki  REL1_24
WebStart.php
Go to the documentation of this file.
00001 <?php
00029 # Die if register_globals is enabled (PHP <=5.3)
00030 # This must be done before any globals are set by the code
00031 if ( ini_get( 'register_globals' ) ) {
00032     die( 'MediaWiki does not support installations where register_globals is enabled. '
00033         . 'Please see <a href="https://www.mediawiki.org/wiki/register_globals">mediawiki.org</a> '
00034         . 'for help on how to disable it.' );
00035 }
00036 
00037 # bug 15461: Make IE8 turn off content sniffing. Everybody else should ignore this
00038 # We're adding it here so that it's *always* set, even for alternate entry
00039 # points and when $wgOut gets disabled or overridden.
00040 header( 'X-Content-Type-Options: nosniff' );
00041 
00042 $wgRequestTime = microtime( true );
00043 unset( $IP );
00044 
00045 # Valid web server entry point, enable includes.
00046 # Please don't move this line to includes/Defines.php. This line essentially
00047 # defines a valid entry point. If you put it in includes/Defines.php, then
00048 # any script that includes it becomes an entry point, thereby defeating
00049 # its purpose.
00050 define( 'MEDIAWIKI', true );
00051 
00052 # Full path to working directory.
00053 # Makes it possible to for example to have effective exclude path in apc.
00054 # __DIR__ breaks symlinked includes, but realpath() returns false
00055 # if we don't have permissions on parent directories.
00056 $IP = getenv( 'MW_INSTALL_PATH' );
00057 if ( $IP === false ) {
00058     $IP = realpath( '.' ) ?: dirname( __DIR__ );
00059 }
00060 
00061 # Load the profiler
00062 require_once "$IP/includes/profiler/Profiler.php";
00063 $wgRUstart = wfGetRusage() ?: array();
00064 
00065 # Start the autoloader, so that extensions can derive classes from core files
00066 require_once "$IP/includes/AutoLoader.php";
00067 
00068 # Load up some global defines.
00069 require_once "$IP/includes/Defines.php";
00070 
00071 # Start the profiler
00072 $wgProfiler = array();
00073 if ( file_exists( "$IP/StartProfiler.php" ) ) {
00074     require "$IP/StartProfiler.php";
00075 }
00076 
00077 wfProfileIn( 'WebStart.php-conf' );
00078 
00079 # Load default settings
00080 require_once "$IP/includes/DefaultSettings.php";
00081 
00082 # Load composer's autoloader if present
00083 if ( is_readable( "$IP/vendor/autoload.php" ) ) {
00084     require_once "$IP/vendor/autoload.php";
00085 }
00086 
00087 if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
00088     # Use a callback function to configure MediaWiki
00089     call_user_func( MW_CONFIG_CALLBACK );
00090 } else {
00091     if ( !defined( 'MW_CONFIG_FILE' ) ) {
00092         define( 'MW_CONFIG_FILE', "$IP/LocalSettings.php" );
00093     }
00094 
00095     # LocalSettings.php is the per site customization file. If it does not exist
00096     # the wiki installer needs to be launched or the generated file uploaded to
00097     # the root wiki directory. Give a hint, if it is not readable by the server.
00098     if ( !is_readable( MW_CONFIG_FILE ) ) {
00099         require_once "$IP/includes/templates/NoLocalSettings.php";
00100         die();
00101     }
00102 
00103     # Include site settings. $IP may be changed (hopefully before the AutoLoader is invoked)
00104     require_once MW_CONFIG_FILE;
00105 }
00106 
00107 wfProfileOut( 'WebStart.php-conf' );
00108 
00109 wfProfileIn( 'WebStart.php-ob_start' );
00110 # Initialise output buffering
00111 # Check that there is no previous output or previously set up buffers, because
00112 # that would cause us to potentially mix gzip and non-gzip output, creating a
00113 # big mess.
00114 if ( !defined( 'MW_NO_OUTPUT_BUFFER' ) && ob_get_level() == 0 ) {
00115     require_once "$IP/includes/OutputHandler.php";
00116     ob_start( 'wfOutputHandler' );
00117 }
00118 wfProfileOut( 'WebStart.php-ob_start' );
00119 
00120 if ( !defined( 'MW_NO_SETUP' ) ) {
00121     require_once "$IP/includes/Setup.php";
00122 }