// So extensions (and other code) can check whether they're running in API mode
define( 'MW_API', true );
-// Bail on old versions of PHP, or if composer has not been run yet to install
-// dependencies. Using dirname( __FILE__ ) here because __DIR__ is PHP5.3+.
-require_once dirname( __FILE__ ) . '/includes/PHPVersionCheck.php';
-wfEntryPointCheck( 'api.php' );
-
require __DIR__ . '/includes/WebStart.php';
$starttime = microtime( true );
$processor = new ApiMain( RequestContext::getMain(), $wgEnableWriteAPI );
// Last chance hook before executing the API
- Hooks::run( 'ApiBeforeMain', array( &$processor ) );
+ Hooks::run( 'ApiBeforeMain', [ &$processor ] );
if ( !$processor instanceof ApiMain ) {
throw new MWException( 'ApiBeforeMain hook set $processor to a non-ApiMain class' );
}
$processor->execute();
}
-if ( function_exists( 'fastcgi_finish_request' ) ) {
- fastcgi_finish_request();
-}
-
-JobQueueGroup::pushLazyJobs();
-
-// Execute any deferred updates
-DeferredUpdates::doUpdates();
-
// Log what the user did, for book-keeping purposes.
$endtime = microtime( true );
-wfLogProfilingData();
-
// Log the request
if ( $wgAPIRequestLog ) {
- $items = array(
+ $items = [
wfTimestamp( TS_MW ),
$endtime - $starttime,
$wgRequest->getIP(),
$wgRequest->getHeader( 'User-agent' )
- );
+ ];
$items[] = $wgRequest->wasPosted() ? 'POST' : 'GET';
if ( $processor ) {
try {
wfDebug( "Logged API request to $wgAPIRequestLog\n" );
}
-// Shut down the database. foo()->bar() syntax is not supported in PHP4: we won't ever actually
-// get here to worry about whether this should be = or =&, but the file has to parse properly.
-$lb = wfGetLBFactory();
-$lb->shutdown();
+$mediawiki = new MediaWiki();
+$mediawiki->doPostOutputShutdown( 'fast' );