];
/**
- * Initialise $wgLocalFileRepo from backwards-compatible settings
+ * Shortcuts for $wgLocalFileRepo
*/
if ( !$wgLocalFileRepo ) {
$wgLocalFileRepo = [
'deletedHashLevels' => $wgHashedUploadDirectory ? 3 : 0
];
}
+
+if ( !isset( $wgLocalFileRepo['backend'] ) ) {
+ // Create a default FileBackend name.
+ // FileBackendGroup will register a default, if absent from $wgFileBackends.
+ $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
+}
+
/**
- * Initialise shared repo from backwards-compatible settings
+ * Shortcuts for $wgForeignFileRepos
*/
if ( $wgUseSharedUploads ) {
if ( $wgSharedUploadDBname ) {
'apiThumbCacheExpiry' => 0,
];
}
-/*
- * Add on default file backend config for file repos.
- * FileBackendGroup will handle initializing the backends.
- */
-if ( !isset( $wgLocalFileRepo['backend'] ) ) {
- $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
-}
foreach ( $wgForeignFileRepos as &$repo ) {
if ( !isset( $repo['directory'] ) && $repo['class'] === ForeignAPIRepo::class ) {
$repo['directory'] = $wgUploadDirectory; // b/c
}
if ( $wgNewUserLog ) {
- // Add a new log type
+ // Add new user log type
$wgLogTypes[] = 'newusers';
$wgLogNames['newusers'] = 'newuserlogpage';
$wgLogHeaders['newusers'] = 'newuserlogpagetext';
$wgLogActionsHandlers['newusers/autocreate'] = NewUsersLogFormatter::class;
}
+if ( $wgPageCreationLog ) {
+ // Add page creation log type
+ $wgLogTypes[] = 'create';
+ $wgLogActionsHandlers['create/create'] = LogFormatter::class;
+}
+
if ( $wgPageLanguageUseDB ) {
$wgLogTypes[] = 'pagelang';
$wgLogActionsHandlers['pagelang/pagelang'] = PageLangLogFormatter::class;
// Initialize the request object in $wgRequest
$wgRequest = RequestContext::getMain()->getRequest(); // BackCompat
// Set user IP/agent information for agent session consistency purposes
+$cpPosInfo = LBFactory::getCPInfoFromCookieValue(
+ // The cookie has no prefix and is set by MediaWiki::preOutputCommit()
+ $wgRequest->getCookie( 'cpPosIndex', '' ),
+ // Mitigate broken client-side cookie expiration handling (T190082)
+ time() - ChronologyProtector::POSITION_COOKIE_TTL
+);
MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->setRequestInfo( [
'IPAddress' => $wgRequest->getIP(),
'UserAgent' => $wgRequest->getHeader( 'User-Agent' ),
'ChronologyProtection' => $wgRequest->getHeader( 'ChronologyProtection' ),
- 'ChronologyPositionIndex' => $wgRequest->getInt(
- 'cpPosIndex',
- LBFactory::getCPIndexFromCookieValue(
- // The cookie has no prefix and is set by MediaWiki::preOutputCommit()
- $wgRequest->getCookie( 'cpPosIndex', '' ),
- // Mitigate broken client-side cookie expiration handling (T190082)
- time() - ChronologyProtector::POSITION_COOKIE_TTL
- )
- )
+ 'ChronologyPositionIndex' => $wgRequest->getInt( 'cpPosIndex', $cpPosInfo['index'] ),
+ 'ChronologyClientId' => $cpPosInfo['clientId']
] );
+unset( $cpPosInfo );
// 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
/**
* @var Language $wgContLang
+ * @deprecated since 1.32, use the ContentLanguage service directly
*/
-$wgContLang = Language::factory( $wgLanguageCode );
-$wgContLang->initContLang();
+$wgContLang = MediaWikiServices::getInstance()->getContentLanguage();
// Now that variant lists may be available...
$wgRequest->interpolateTitle();
if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
// If session.auto_start is there, we can't touch session name
if ( $wgPHPSessionHandling !== 'disable' && !wfIniGetBool( 'session.auto_start' ) ) {
- session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' );
+ session_name( $wgSessionName ?: $wgCookiePrefix . '_session' );
}
// Create the SessionManager singleton and set up our session handler,