00001 <?php
00002
00040 # Initialise common code
00041 $preIP = dirname( __FILE__ );
00042 require_once( "$preIP/includes/WebStart.php" );
00043
00044 # Initialize MediaWiki base class
00045 require_once( "$preIP/includes/Wiki.php" );
00046 $mediaWiki = new MediaWiki();
00047
00048 wfProfileIn( 'main-misc-setup' );
00049 OutputPage::setEncodings(); # Not really used yet
00050
00051 $maxLag = $wgRequest->getVal( 'maxlag' );
00052 if( !is_null( $maxLag ) && !$mediaWiki->checkMaxLag( $maxLag ) ) {
00053 exit;
00054 }
00055
00056 # Query string fields
00057 $action = $wgRequest->getVal( 'action', 'view' );
00058 $title = $wgRequest->getVal( 'title' );
00059
00060 # Set title from request parameters
00061 $wgTitle = $mediaWiki->checkInitialQueries( $title, $action );
00062 if( $wgTitle === null ) {
00063 unset( $wgTitle );
00064 }
00065
00066 wfProfileOut( 'main-misc-setup' );
00067
00068 #
00069 # Send Ajax requests to the Ajax dispatcher.
00070 #
00071 if( $wgUseAjax && $action == 'ajax' ) {
00072 require_once( $IP . '/includes/AjaxDispatcher.php' );
00073 $dispatcher = new AjaxDispatcher();
00074 $dispatcher->performAction();
00075 $mediaWiki->restInPeace();
00076 exit;
00077 }
00078
00079 if( $wgUseFileCache && isset( $wgTitle ) ) {
00080 wfProfileIn( 'main-try-filecache' );
00081
00082
00083 if( $action != 'raw' && HTMLFileCache::useFileCache() ) {
00084
00085 $cache = new HTMLFileCache( $wgTitle, $action );
00086 if( $cache->isFileCacheGood( ) ) {
00087
00088 if( !$wgOut->checkLastModified( $cache->fileCacheTime() ) ) {
00089 $cache->loadFromFileCache();
00090 }
00091 # Do any stats increment/watchlist stuff
00092 $wgArticle = MediaWiki::articleFromTitle( $wgTitle );
00093 $wgArticle->viewUpdates();
00094 # Tell $wgOut that output is taken care of
00095 wfProfileOut( 'main-try-filecache' );
00096 $mediaWiki->restInPeace();
00097 exit;
00098 }
00099 }
00100 wfProfileOut( 'main-try-filecache' );
00101 }
00102
00103 # Setting global variables in mediaWiki
00104 $mediaWiki->setVal( 'action', $action );
00105 $mediaWiki->setVal( 'CommandLineMode', $wgCommandLineMode );
00106 $mediaWiki->setVal( 'DisabledActions', $wgDisabledActions );
00107 $mediaWiki->setVal( 'DisableHardRedirects', $wgDisableHardRedirects );
00108 $mediaWiki->setVal( 'DisableInternalSearch', $wgDisableInternalSearch );
00109 $mediaWiki->setVal( 'EnableCreativeCommonsRdf', $wgEnableCreativeCommonsRdf );
00110 $mediaWiki->setVal( 'EnableDublinCoreRdf', $wgEnableDublinCoreRdf );
00111 $mediaWiki->setVal( 'JobRunRate', $wgJobRunRate );
00112 $mediaWiki->setVal( 'Server', $wgServer );
00113 $mediaWiki->setVal( 'SquidMaxage', $wgSquidMaxage );
00114 $mediaWiki->setVal( 'UseExternalEditor', $wgUseExternalEditor );
00115 $mediaWiki->setVal( 'UsePathInfo', $wgUsePathInfo );
00116
00117 $mediaWiki->performRequestForTitle( $wgTitle, $wgArticle, $wgOut, $wgUser, $wgRequest );
00118 $mediaWiki->finalCleanup( $wgDeferredUpdateList, $wgOut );
00119
00120 # Not sure when $wgPostCommitUpdateList gets set, so I keep this separate from finalCleanup
00121 $mediaWiki->doUpdates( $wgPostCommitUpdateList );
00122
00123 $mediaWiki->restInPeace();
00124