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 $wgTitle = $mediaWiki->checkInitialQueries( $title, $action );
00061 if( $wgTitle === NULL ) {
00062 unset( $wgTitle );
00063 }
00064
00065 wfProfileOut( 'main-misc-setup' );
00066
00067 #
00068 # Send Ajax requests to the Ajax dispatcher.
00069 #
00070 if( $wgUseAjax && $action == 'ajax' ) {
00071 require_once( $IP . '/includes/AjaxDispatcher.php' );
00072 $dispatcher = new AjaxDispatcher();
00073 $dispatcher->performAction();
00074 $mediaWiki->restInPeace();
00075 exit;
00076 }
00077
00078 if( $wgUseFileCache && isset( $wgTitle ) ) {
00079 wfProfileIn( 'main-try-filecache' );
00080
00081
00082 if( $action != 'raw' && HTMLFileCache::useFileCache() ) {
00083
00084 $cache = new HTMLFileCache( $wgTitle, $action );
00085 if( $cache->isFileCacheGood( ) ) {
00086
00087 if( !$wgOut->checkLastModified( $cache->fileCacheTime() ) ) {
00088 $cache->loadFromFileCache();
00089 }
00090 # Do any stats increment/watchlist stuff
00091 $wgArticle = MediaWiki::articleFromTitle( $wgTitle );
00092 $wgArticle->viewUpdates();
00093 # Tell $wgOut that output is taken care of
00094 wfProfileOut( 'main-try-filecache' );
00095 $mediaWiki->restInPeace();
00096 exit;
00097 }
00098 }
00099 wfProfileOut( 'main-try-filecache' );
00100 }
00101
00102 # Setting global variables in mediaWiki
00103 $mediaWiki->setVal( 'action', $action );
00104 $mediaWiki->setVal( 'CommandLineMode', $wgCommandLineMode );
00105 $mediaWiki->setVal( 'DisabledActions', $wgDisabledActions );
00106 $mediaWiki->setVal( 'DisableHardRedirects', $wgDisableHardRedirects );
00107 $mediaWiki->setVal( 'DisableInternalSearch', $wgDisableInternalSearch );
00108 $mediaWiki->setVal( 'EnableCreativeCommonsRdf', $wgEnableCreativeCommonsRdf );
00109 $mediaWiki->setVal( 'EnableDublinCoreRdf', $wgEnableDublinCoreRdf );
00110 $mediaWiki->setVal( 'JobRunRate', $wgJobRunRate );
00111 $mediaWiki->setVal( 'Server', $wgServer );
00112 $mediaWiki->setVal( 'SquidMaxage', $wgSquidMaxage );
00113 $mediaWiki->setVal( 'UseExternalEditor', $wgUseExternalEditor );
00114 $mediaWiki->setVal( 'UsePathInfo', $wgUsePathInfo );
00115
00116 $mediaWiki->initialize( $wgTitle, $wgArticle, $wgOut, $wgUser, $wgRequest );
00117 $mediaWiki->finalCleanup( $wgDeferredUpdateList, $wgOut );
00118
00119 # Not sure when $wgPostCommitUpdateList gets set, so I keep this separate from finalCleanup
00120 $mediaWiki->doUpdates( $wgPostCommitUpdateList );
00121
00122 $mediaWiki->restInPeace();
00123