It's a holdover from the PHP 5 era.
It may still be needed or it may not...
# Try configuration cache $filename = "/tmp/mw-cache-$wmgVersionNumber/conf-$wgDBname"; if ( defined( 'HHVM_VERSION' ) ) { $filename .= '-hhvm'; } $globals = false; if ( @filemtime( $filename ) >= filemtime( "$wmfConfigDir/InitialiseSettings.php" ) ) { $cacheRecord = @file_get_contents( $filename ); if ( $cacheRecord !== false ) { $globals = unserialize( $cacheRecord ); } } if ( !$globals ) { # Get configuration from SiteConfiguration object require( "$wmfConfigDir/InitialiseSettings.php" ); $wikiTags = []; foreach ( [ 'private', 'fishbowl', 'special', 'closed', 'flow', 'flaggedrevs', 'small', 'medium', 'large', 'wikimania', 'wikidata', 'wikidataclient', 'visualeditor-nondefault', 'commonsuploads', 'nonbetafeatures', 'group0', 'group1', 'group2', 'wikipedia', 'nonglobal', 'wikitech', 'nonecho', 'mobilemainpagelegacy', 'compact-language-links', 'nowikidatadescriptiontaglines', 'related-articles-footer-blacklisted-skins', 'top6-wikipedia' ] as $tag ) { $dblist = MWWikiversions::readDbListFile( $tag ); if ( in_array( $wgDBname, $dblist ) ) { $wikiTags[] = $tag; } } $dbSuffix = ( $site === 'wikipedia' ) ? 'wiki' : $site; $confParams = [ 'lang' => $lang, 'docRoot' => $_SERVER['DOCUMENT_ROOT'], 'site' => $site, 'stdlogo' => "//{$wmfHostnames['upload']}/$site/$lang/b/bc/Wiki.png" , ]; // Add a per-language tag as well $wikiTags[] = $wgConf->get( 'wgLanguageCode', $wgDBname, $dbSuffix, $confParams, $wikiTags ); $globals = $wgConf->getAll( $wgDBname, $dbSuffix, $confParams, $wikiTags ); # Save cache @mkdir( '/tmp/mw-cache-' . $wmgVersionNumber ); $tmpFile = tempnam( '/tmp/', "conf-$wmgVersionNumber-$wgDBname" ); if ( $tmpFile && file_put_contents( $tmpFile, serialize( $globals ) ) ) { if ( !rename( $tmpFile, $filename ) ) { // T136258: Rename failed, cleanup temp file unlink( $tmpFile ); }; } } extract( $globals );
- Clean up and refactor to improve testing and reduce duplication.
- Refactor to one entry method that covers all wgConf/tmpfile/globals setting/loading/computation.
- Draft change without intermediary json tmpfile cache and compare.
- Improve performance of hot SiteConfiguration code.
- Improve performance of hot dblist loading code.
- If cache no longer useful:
- Remove caching code and associated opcache/mtime complexity.
- Consider removing SiteConfiguration::loadFulllData, $wgConf->loadFullData() calls, and wmfLoadInitialiseSettings() function; which currently exist only so as to separate the cached extraction for the current wiki from the rest of the data. This shouldn't be needed anymore.
See also:
T311788: MW wmf-config tmp cache stays outdated after Scap deploy (opcache revalidation is off)
T236104: Cache of wmf-config/InitialiseSettings often 1 step behind