X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=api.php;h=6e75fb746ae672de4f99b3bc18b6b718fa17a9a1;hb=da572fe7a46c3be4d55e31dc355c5f1675cdc251;hp=ea2f60aef2de0c455a58f40a3c872e9c23868102;hpb=786a37c5778e2fc69b48010236199621449ebba0;p=lhc%2Fweb%2Fwiklou.git diff --git a/api.php b/api.php index ea2f60aef2..6e75fb746a 100644 --- a/api.php +++ b/api.php @@ -35,13 +35,6 @@ use MediaWiki\Logger\LegacyLogger; // So extensions (and other code) can check whether they're running in API mode define( 'MW_API', true ); -// Bail if PHP is too low -if ( !function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '5.3.3' ) < 0 ) { - // We need to use dirname( __FILE__ ) here cause __DIR__ is PHP5.3+ - require dirname( __FILE__ ) . '/includes/PHPVersionError.php'; - wfPHPVersionError( 'api.php' ); -} - require __DIR__ . '/includes/WebStart.php'; $starttime = microtime( true ); @@ -75,7 +68,7 @@ try { $processor = new ApiMain( RequestContext::getMain(), $wgEnableWriteAPI ); // Last chance hook before executing the API - wfRunHooks( 'ApiBeforeMain', array( &$processor ) ); + Hooks::run( 'ApiBeforeMain', [ &$processor ] ); if ( !$processor instanceof ApiMain ) { throw new MWException( 'ApiBeforeMain hook set $processor to a non-ApiMain class' ); } @@ -90,26 +83,17 @@ if ( $processor ) { $processor->execute(); } -if ( function_exists( 'fastcgi_finish_request' ) ) { - fastcgi_finish_request(); -} - -// 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 { @@ -130,7 +114,5 @@ if ( $wgAPIRequestLog ) { 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' );