00001 <?php
00002
00037
00038 require (dirname(__FILE__) . '/includes/WebStart.php');
00039
00040 wfProfileIn('api.php');
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 if( isset( $_SERVER['SCRIPT_URL'] ) ) {
00055 $url = $_SERVER['SCRIPT_URL'];
00056 } else {
00057 $url = $_SERVER['PHP_SELF'];
00058 }
00059 if( strcmp( "$wgScriptPath/api$wgScriptExtension", $url ) ) {
00060 wfHttpError( 403, 'Forbidden',
00061 'API must be accessed through the primary script entry point.' );
00062 return;
00063 }
00064
00065
00066 if (!$wgEnableAPI) {
00067 echo 'MediaWiki API is not enabled for this site. Add the following line to your LocalSettings.php';
00068 echo '<pre><b>$wgEnableAPI=true;</b></pre>';
00069 die(1);
00070 }
00071
00072
00073 define('MW_API', true);
00074
00075
00076
00077 $wgTitle = Title::newFromText('API');
00078
00079
00080
00081
00082
00083 $processor = new ApiMain($wgRequest, $wgEnableWriteAPI);
00084
00085
00086 $processor->execute();
00087
00088
00089 wfDoUpdates();
00090
00091
00092 wfProfileOut('api.php');
00093 wfLogProfilingData();
00094
00095
00096 wfGetLBFactory()->shutdown();
00097