X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=load.php;h=974771f9781c832a9c82dba243f5c419641e8fc1;hb=a5be382adfdad4678eec18413c6a118cb3284daf;hp=43c2fafce817a999276364e1acd7ba299f415664;hpb=4618f70793d1178ca4c646ef397cf17b1cc70b44;p=lhc%2Fweb%2Fwiklou.git diff --git a/load.php b/load.php index 43c2fafce8..974771f978 100644 --- a/load.php +++ b/load.php @@ -23,23 +23,34 @@ */ use MediaWiki\Logger\LoggerFactory; +use MediaWiki\MediaWikiServices; -require __DIR__ . '/includes/WebStart.php'; +// This endpoint is supposed to be independent of request cookies and other +// details of the session. Enforce this constraint with respect to session use. +define( 'MW_NO_SESSION', 1 ); +require __DIR__ . '/includes/WebStart.php'; // URL safety checks if ( !$wgRequest->checkUrlExtension() ) { return; } -// Respond to resource loading request. -// foo()->bar() syntax is not supported in PHP4, and this file needs to *parse* in PHP4. -$configFactory = ConfigFactory::getDefaultInstance(); +// Don't initialise ChronologyProtector from object cache, and +// don't wait for unrelated MediaWiki writes when querying ResourceLoader. +MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->setRequestInfo( [ + 'ChronologyProtection' => 'false', +] ); + +// Set up ResourceLoader $resourceLoader = new ResourceLoader( - $configFactory->makeConfig( 'main' ), + ConfigFactory::getDefaultInstance()->makeConfig( 'main' ), LoggerFactory::getInstance( 'resourceloader' ) ); -$resourceLoader->respond( new ResourceLoaderContext( $resourceLoader, $wgRequest ) ); +$context = new ResourceLoaderContext( $resourceLoader, $wgRequest ); + +// Respond to ResourceLoader request +$resourceLoader->respond( $context ); Profiler::instance()->setTemplated( true );