mail: Avoid use of global state and use MediaWiki services DI