3 * Main wiki script; see docs/design.txt
6 $wgRequestTime = microtime();
8 # getrusage() does not exist on the Window$ platform, catching this
9 if ( function_exists ( 'getrusage' ) ) {
10 $wgRUstart = getrusage();
16 @ini_set
( 'allow_url_fopen', 0 ); # For security...
18 if ( isset( $_REQUEST['GLOBALS'] ) ) {
19 die( '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>');
22 # Valid web server entry point, enable includes.
23 # Please don't move this line to includes/Defines.php. This line essentially defines
24 # a valid entry point. If you put it in includes/Defines.php, then any script that includes
25 # it becomes an entry point, thereby defeating its purpose.
26 define( 'MEDIAWIKI', true );
27 require_once( './includes/Defines.php' );
29 if( !file_exists( 'LocalSettings.php' ) ) {
31 require_once( 'includes/DefaultSettings.php' ); # used for printing the version
33 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
34 <html xmlns
='http://www.w3.org/1999/xhtml' xml
:lang
='en' lang
='en'>
36 <title
>MediaWiki
<?php
echo $wgVersion ?
></title
>
37 <meta http
-equiv
='Content-Type' content
='text/html; charset=utf-8' />
38 <style type
='text/css' media
='screen, projection'>
41 background
-color
: #fff;
42 font
-family
: sans
-serif
;
52 <img src
='skins/common/images/mediawiki.png' alt
='The MediaWiki logo' />
54 <h1
>MediaWiki
<?php
echo $wgVersion ?
></h1
>
57 if ( file_exists( 'config/LocalSettings.php' ) ) {
58 echo( "To complete the installation, move <tt>config/LocalSettings.php</tt> to the parent directory." );
60 echo( "Please <a href='config/index.php' title='setup'>setup the wiki</a> first." );
71 require_once( './LocalSettings.php' );
72 require_once( 'includes/Setup.php' );
74 wfProfileIn( 'main-misc-setup' );
75 OutputPage
::setEncodings(); # Not really used yet
78 $action = $wgRequest->getVal( 'action', 'view' );
79 $title = $wgRequest->getVal( 'title' );
81 if ($wgRequest->getVal( 'printable' ) == 'yes') {
82 $wgOut->setPrintable();
85 if ( '' == $title && 'delete' != $action ) {
86 $wgTitle = Title
::newFromText( wfMsgForContent( 'mainpage' ) );
87 } elseif ( $curid = $wgRequest->getInt( 'curid' ) ) {
88 # URLs like this are generated by RC, because rc_title isn't always accurate
89 $wgTitle = Title
::newFromID( $curid );
91 $wgTitle = Title
::newFromURL( $title );
92 /* check variant links so that interwiki links don't have to worry about
93 the possible different language variants
95 if( count($wgContLang->getVariants()) > 1 && !is_null($wgTitle) && $wgTitle->getArticleID() == 0 )
96 $wgContLang->findVariantLink( $title, $wgTitle );
99 wfProfileOut( 'main-misc-setup' );
102 # Initialize MediaWiki base class
103 require_once( "includes/Wiki.php" );
104 $mediaWiki = new MediaWiki();
106 # Setting global variables in mediaWiki
107 $mediaWiki->setVal( "Server", $wgServer );
108 $mediaWiki->setVal( "DisableInternalSearch", $wgDisableInternalSearch );
109 $mediaWiki->setVal( "action", $action );
110 $mediaWiki->setVal( "SquidMaxage", $wgSquidMaxage );
111 $mediaWiki->setVal( "EnableDublinCoreRdf", $wgEnableDublinCoreRdf );
112 $mediaWiki->setVal( "EnableCreativeCommonsRdf", $wgEnableCreativeCommonsRdf );
113 $mediaWiki->setVal( "CommandLineMode", $wgCommandLineMode );
114 $mediaWiki->setVal( "UseExternalEditor", $wgUseExternalEditor );
115 $mediaWiki->setVal( "DisabledActions", $wgDisabledActions );
117 $wgArticle = $mediaWiki->initialize ( $wgTitle, $wgOut, $wgUser, $wgRequest );
118 $mediaWiki->finalCleanup ( $wgDeferredUpdateList , $wgLoadBalancer , $wgOut ) ;
120 # Not sure when $wgPostCommitUpdateList gets set, so I keep this separate from finalCleanup
121 $mediaWiki->doUpdates( $wgPostCommitUpdateList );
123 $mediaWiki->restInPeace( $wgLoadBalancer );