Page MenuHomePhabricator

Cleanup hacks for T49647?
Closed, ResolvedPublic

Description

Followup T49647: meta.m.wikimedia.org user login doesn't work from CommonSettings.php

	// Hack for T49647
	if ( $wgCentralAuthCookieDomain == 'commons.wikimedia.org' ) {
		$wgCentralAuthCookieDomain = 'commons.m.wikimedia.org';
	} elseif ( $wgCentralAuthCookieDomain == 'meta.wikimedia.org' ) {
		$wgCentralAuthCookieDomain = 'meta.m.wikimedia.org';
	}

	// Better hack for T49647
	$wgHooks['WebResponseSetCookie'][] = static function ( &$name, &$value, &$expire, &$options ) {
		if ( isset( $options['domain'] ) ) {
			if ( $options['domain'] == 'commons.wikimedia.org' ) {
				$options['domain'] = 'commons.m.wikimedia.org';
			} elseif ( $options['domain'] == 'meta.wikimedia.org' ) {
				$options['domain'] = 'meta.m.wikimedia.org';
			}
		}
	};

Are both neeeded?

Event Timeline

It looks like after https://gerrit.wikimedia.org/r/c/mediawiki/core/+/269859 we can remove the first set of conditionals?

Similar code in CommonSettings-labs.php too

	if ( preg_match( $domainRegexp, $wgCentralAuthCookieDomain ) ) {
		$wgCentralAuthCookieDomain = preg_replace( $domainRegexp, $mobileDomain, $wgCentralAuthCookieDomain );
	}
	$wgHooks['WebResponseSetCookie'][] = static function ( &$name, &$value, &$expire, &$options ) use ( $domainRegexp, $mobileDomain ) {
		if ( isset( $options['domain'] ) && preg_match( $domainRegexp, $options['domain'] ) ) {
			$options['domain'] = preg_replace( $domainRegexp, $mobileDomain, $options['domain'] );
		}
	};
matmarex claimed this task.
matmarex subscribed.

Done in https://gerrit.wikimedia.org/r/c/operations/mediawiki-config/+/967302 (I didn't know there was a task for it)