MediaWiki REL1_41
UserGroupManagerFactory.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\User;
22
28use Psr\Log\LoggerInterface;
31
39 private ServiceOptions $options;
40 private ReadOnlyMode $readOnlyMode;
41 private ILBFactory $dbLoadBalancerFactory;
42 private UserEditTracker $userEditTracker;
43 private GroupPermissionsLookup $groupPermissionLookup;
44 private JobQueueGroupFactory $jobQueueGroupFactory;
45 private LoggerInterface $logger;
46
48 private $clearCacheCallbacks;
49
50 private HookContainer $hookContainer;
51 private TempUserConfig $tempUserConfig;
52
65 public function __construct(
66 ServiceOptions $options,
67 ReadOnlyMode $readOnlyMode,
68 ILBFactory $dbLoadBalancerFactory,
69 HookContainer $hookContainer,
70 UserEditTracker $userEditTracker,
71 GroupPermissionsLookup $groupPermissionsLookup,
72 JobQueueGroupFactory $jobQueueGroupFactory,
73 LoggerInterface $logger,
74 TempUserConfig $tempUserConfig,
75 array $clearCacheCallbacks = []
76 ) {
77 $this->options = $options;
78 $this->readOnlyMode = $readOnlyMode;
79 $this->dbLoadBalancerFactory = $dbLoadBalancerFactory;
80 $this->hookContainer = $hookContainer;
81 $this->userEditTracker = $userEditTracker;
82 $this->groupPermissionLookup = $groupPermissionsLookup;
83 $this->jobQueueGroupFactory = $jobQueueGroupFactory;
84 $this->logger = $logger;
85 $this->tempUserConfig = $tempUserConfig;
86 $this->clearCacheCallbacks = $clearCacheCallbacks;
87 }
88
93 public function getUserGroupManager( $wikiId = UserIdentity::LOCAL ): UserGroupManager {
94 if ( is_string( $wikiId ) && $this->dbLoadBalancerFactory->getLocalDomainID() === $wikiId ) {
95 $wikiId = UserIdentity::LOCAL;
96 }
97
98 // TODO: Once UserRightsProxy is removed, cache the instance per wiki.
99 return new UserGroupManager(
100 $this->options,
101 $this->readOnlyMode,
102 $this->dbLoadBalancerFactory,
103 $this->hookContainer,
104 $this->userEditTracker,
105 $this->groupPermissionLookup,
106 $this->jobQueueGroupFactory->makeJobQueueGroup( $wikiId ),
107 $this->logger,
108 $this->tempUserConfig,
109 $this->clearCacheCallbacks,
110 $wikiId
111 );
112 }
113}
if(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:88
A class for passing options to services.
Class to construct JobQueueGroups.
Track info about user edit counts and timings.
Factory service for UserGroupManager instances.
getUserGroupManager( $wikiId=UserIdentity::LOCAL)
__construct(ServiceOptions $options, ReadOnlyMode $readOnlyMode, ILBFactory $dbLoadBalancerFactory, HookContainer $hookContainer, UserEditTracker $userEditTracker, GroupPermissionsLookup $groupPermissionsLookup, JobQueueGroupFactory $jobQueueGroupFactory, LoggerInterface $logger, TempUserConfig $tempUserConfig, array $clearCacheCallbacks=[])
Determine whether a site is currently in read-only mode.
Interface for temporary user creation config and name matching.
Manager of ILoadBalancer objects and, indirectly, IDatabase connections.
Utility class for bot passwords.