X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSetup.php;h=cc6915a74b3c620203683f2abc1460a9fc19ff00;hb=c122357c7263f4ea6d7d7a43fa2df7dfb8cc09b4;hp=4936b0b11a49f3177d448fb3884b5513789103e4;hpb=f036c5b324e2b2d240edf8d5eeb7fc2af3d88c47;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Setup.php b/includes/Setup.php index 4936b0b11a..cc6915a74b 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -249,12 +249,12 @@ $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK; */ $wgLockManagers[] = [ 'name' => 'fsLockManager', - 'class' => 'FSLockManager', + 'class' => FSLockManager::class, 'lockDirectory' => "{$wgUploadDirectory}/lockdir", ]; $wgLockManagers[] = [ 'name' => 'nullLockManager', - 'class' => 'NullLockManager', + 'class' => NullLockManager::class, ]; /** @@ -276,7 +276,7 @@ $wgGalleryOptions += [ */ if ( !$wgLocalFileRepo ) { $wgLocalFileRepo = [ - 'class' => 'LocalRepo', + 'class' => LocalRepo::class, 'name' => 'local', 'directory' => $wgUploadDirectory, 'scriptDirUrl' => $wgScriptPath, @@ -295,7 +295,7 @@ if ( !$wgLocalFileRepo ) { if ( $wgUseSharedUploads ) { if ( $wgSharedUploadDBname ) { $wgForeignFileRepos[] = [ - 'class' => 'ForeignDBRepo', + 'class' => ForeignDBRepo::class, 'name' => 'shared', 'directory' => $wgSharedUploadDirectory, 'url' => $wgSharedUploadPath, @@ -315,7 +315,7 @@ if ( $wgUseSharedUploads ) { ]; } else { $wgForeignFileRepos[] = [ - 'class' => 'FileRepo', + 'class' => FileRepo::class, 'name' => 'shared', 'directory' => $wgSharedUploadDirectory, 'url' => $wgSharedUploadPath, @@ -329,7 +329,7 @@ if ( $wgUseSharedUploads ) { } if ( $wgUseInstantCommons ) { $wgForeignFileRepos[] = [ - 'class' => 'ForeignAPIRepo', + 'class' => ForeignAPIRepo::class, 'name' => 'wikimediacommons', 'apibase' => 'https://commons.wikimedia.org/w/api.php', 'url' => 'https://upload.wikimedia.org/wikipedia/commons', @@ -349,7 +349,7 @@ if ( !isset( $wgLocalFileRepo['backend'] ) ) { $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend'; } foreach ( $wgForeignFileRepos as &$repo ) { - if ( !isset( $repo['directory'] ) && $repo['class'] === 'ForeignAPIRepo' ) { + if ( !isset( $repo['directory'] ) && $repo['class'] === ForeignAPIRepo::class ) { $repo['directory'] = $wgUploadDirectory; // b/c } if ( !isset( $repo['backend'] ) ) { @@ -360,6 +360,7 @@ unset( $repo ); // no global pollution; destroy reference // Convert this deprecated setting to modern system if ( $wgExperimentalHtmlIds ) { + wfDeprecated( '$wgExperimentalHtmlIds', '1.30' ); $wgFragmentMode = [ 'html5-legacy', 'html5' ]; } @@ -527,9 +528,9 @@ $wgJsMimeType = 'text/javascript'; $wgFileExtensions = array_values( array_diff( $wgFileExtensions, $wgFileBlacklist ) ); if ( $wgInvalidateCacheOnLocalSettingsChange ) { - MediaWiki\suppressWarnings(); + Wikimedia\suppressWarnings(); $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', filemtime( "$IP/LocalSettings.php" ) ) ); - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); } if ( $wgNewUserLog ) { @@ -537,16 +538,16 @@ if ( $wgNewUserLog ) { $wgLogTypes[] = 'newusers'; $wgLogNames['newusers'] = 'newuserlogpage'; $wgLogHeaders['newusers'] = 'newuserlogpagetext'; - $wgLogActionsHandlers['newusers/newusers'] = 'NewUsersLogFormatter'; - $wgLogActionsHandlers['newusers/create'] = 'NewUsersLogFormatter'; - $wgLogActionsHandlers['newusers/create2'] = 'NewUsersLogFormatter'; - $wgLogActionsHandlers['newusers/byemail'] = 'NewUsersLogFormatter'; - $wgLogActionsHandlers['newusers/autocreate'] = 'NewUsersLogFormatter'; + $wgLogActionsHandlers['newusers/newusers'] = NewUsersLogFormatter::class; + $wgLogActionsHandlers['newusers/create'] = NewUsersLogFormatter::class; + $wgLogActionsHandlers['newusers/create2'] = NewUsersLogFormatter::class; + $wgLogActionsHandlers['newusers/byemail'] = NewUsersLogFormatter::class; + $wgLogActionsHandlers['newusers/autocreate'] = NewUsersLogFormatter::class; } if ( $wgPageLanguageUseDB ) { $wgLogTypes[] = 'pagelang'; - $wgLogActionsHandlers['pagelang/pagelang'] = 'PageLangLogFormatter'; + $wgLogActionsHandlers['pagelang/pagelang'] = PageLangLogFormatter::class; } if ( $wgCookieSecure === 'detect' ) { @@ -697,7 +698,7 @@ if ( $wgMainWANCache === false ) { // Sites using multiple datacenters can configure a relayer. $wgMainWANCache = 'mediawiki-main-default'; $wgWANObjectCaches[$wgMainWANCache] = [ - 'class' => 'WANObjectCache', + 'class' => WANObjectCache::class, 'cacheId' => $wgMainCacheType, 'channels' => [ 'purge' => 'wancache-main-default-purge' ] ]; @@ -716,9 +717,9 @@ wfMemoryLimit(); * explicitly set. Inspired by phpMyAdmin's treatment of the problem. */ if ( is_null( $wgLocaltimezone ) ) { - MediaWiki\suppressWarnings(); + Wikimedia\suppressWarnings(); $wgLocaltimezone = date_default_timezone_get(); - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); } date_default_timezone_set( $wgLocaltimezone ); @@ -735,20 +736,22 @@ if ( !$wgDBerrorLogTZ ) { // Initialize the request object in $wgRequest $wgRequest = RequestContext::getMain()->getRequest(); // BackCompat -// Set user IP/agent information for causal consistency purposes. -// The cpPosTime cookie has no prefix and is set by MediaWiki::preOutputCommit(). -$cpPosTime = $wgRequest->getFloat( 'cpPosTime', $wgRequest->getCookie( 'cpPosTime', '' ) ); +// Set user IP/agent information for agent session consistency purposes MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->setRequestInfo( [ 'IPAddress' => $wgRequest->getIP(), 'UserAgent' => $wgRequest->getHeader( 'User-Agent' ), 'ChronologyProtection' => $wgRequest->getHeader( 'ChronologyProtection' ), - 'ChronologyPositionTime' => $cpPosTime + // The cpPosIndex cookie has no prefix and is set by MediaWiki::preOutputCommit() + 'ChronologyPositionIndex' => + $wgRequest->getInt( 'cpPosIndex', (int)$wgRequest->getCookie( 'cpPosIndex', '' ) ) ] ); -// Make sure that caching does not compromise the consistency improvements -if ( $cpPosTime ) { +// Make sure that object caching does not undermine the ChronologyProtector improvements +if ( $wgRequest->getCookie( 'UseDC', '' ) === 'master' ) { + // The user is pinned to the primary DC, meaning that they made recent changes which should + // be reflected in their subsequent web requests. Avoid the use of interim cache keys because + // they use a blind TTL and could be stale if an object changes twice in a short time span. MediaWikiServices::getInstance()->getMainWANObjectCache()->useInterimHoldOffCaching( false ); } -unset( $cpPosTime ); // Useful debug output if ( $wgCommandLineMode ) { @@ -871,7 +874,7 @@ if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) { ) { // Start the PHP-session for backwards compatibility session_id( $session->getId() ); - MediaWiki\quietCall( 'session_start' ); + Wikimedia\quietCall( 'session_start' ); } unset( $session );