|
11 | 11 | use OC\AppFramework\Utility\TimeFactory; |
12 | 12 | use OC\Authentication\Events\AppPasswordCreatedEvent; |
13 | 13 | use OC\Authentication\Token\IProvider; |
14 | | -use OC\Server; |
| 14 | +use OC\Settings\Manager; |
15 | 15 | use OCA\Settings\ConfigLexicon; |
16 | 16 | use OCA\Settings\Hooks; |
17 | 17 | use OCA\Settings\Listener\AppPasswordCreatedActivityListener; |
|
84 | 84 | use OCP\AppFramework\Bootstrap\IBootContext; |
85 | 85 | use OCP\AppFramework\Bootstrap\IBootstrap; |
86 | 86 | use OCP\AppFramework\Bootstrap\IRegistrationContext; |
87 | | -use OCP\AppFramework\IAppContainer; |
88 | 87 | use OCP\Defaults; |
89 | 88 | use OCP\Group\Events\GroupDeletedEvent; |
90 | 89 | use OCP\Group\Events\UserAddedEvent; |
91 | 90 | use OCP\Group\Events\UserRemovedEvent; |
92 | | -use OCP\IServerContainer; |
| 91 | +use OCP\IConfig; |
| 92 | +use OCP\IURLGenerator; |
| 93 | +use OCP\L10N\IFactory; |
| 94 | +use OCP\Mail\IMailer; |
| 95 | +use OCP\Security\ICrypto; |
| 96 | +use OCP\Security\ISecureRandom; |
93 | 97 | use OCP\Settings\Events\DeclarativeSettingsGetValueEvent; |
94 | 98 | use OCP\Settings\Events\DeclarativeSettingsSetValueEvent; |
95 | 99 | use OCP\Settings\IManager; |
96 | 100 | use OCP\User\Events\PasswordUpdatedEvent; |
97 | 101 | use OCP\User\Events\UserChangedEvent; |
98 | 102 | use OCP\Util; |
| 103 | +use Psr\Container\ContainerInterface; |
99 | 104 |
|
100 | 105 | class Application extends App implements IBootstrap { |
101 | 106 | public const APP_ID = 'settings'; |
102 | 107 |
|
103 | | - /** |
104 | | - * @param array $urlParams |
105 | | - */ |
106 | 108 | public function __construct(array $urlParams = []) { |
107 | 109 | parent::__construct(self::APP_ID, $urlParams); |
108 | 110 | } |
@@ -139,32 +141,23 @@ public function register(IRegistrationContext $context): void { |
139 | 141 | /** |
140 | 142 | * Core class wrappers |
141 | 143 | */ |
142 | | - $context->registerService(IProvider::class, function (IAppContainer $appContainer) { |
143 | | - /** @var IServerContainer $serverContainer */ |
144 | | - $serverContainer = $appContainer->query(IServerContainer::class); |
145 | | - return $serverContainer->query(IProvider::class); |
| 144 | + $context->registerService(IProvider::class, function (ContainerInterface $appContainer) { |
| 145 | + return $appContainer->get(IProvider::class); |
146 | 146 | }); |
147 | | - $context->registerService(IManager::class, function (IAppContainer $appContainer) { |
148 | | - /** @var IServerContainer $serverContainer */ |
149 | | - $serverContainer = $appContainer->query(IServerContainer::class); |
150 | | - return $serverContainer->getSettingsManager(); |
| 147 | + $context->registerService(IManager::class, function (ContainerInterface $appContainer) { |
| 148 | + return $appContainer->get(Manager::class); |
151 | 149 | }); |
152 | 150 |
|
153 | | - $context->registerService(NewUserMailHelper::class, function (IAppContainer $appContainer) { |
154 | | - /** @var Server $server */ |
155 | | - $server = $appContainer->query(IServerContainer::class); |
156 | | - /** @var Defaults $defaults */ |
157 | | - $defaults = $server->query(Defaults::class); |
158 | | - |
| 151 | + $context->registerService(NewUserMailHelper::class, function (ContainerInterface $appContainer) { |
159 | 152 | return new NewUserMailHelper( |
160 | | - $defaults, |
161 | | - $server->getURLGenerator(), |
162 | | - $server->getL10NFactory(), |
163 | | - $server->getMailer(), |
164 | | - $server->getSecureRandom(), |
| 153 | + $appContainer->get(Defaults::class), |
| 154 | + $appContainer->get(IURlGenerator::class), |
| 155 | + $appContainer->get(IFactory::class), |
| 156 | + $appContainer->get(IMailer::class), |
| 157 | + $appContainer->get(ISecureRandom::class), |
165 | 158 | new TimeFactory(), |
166 | | - $server->getConfig(), |
167 | | - $server->getCrypto(), |
| 159 | + $appContainer->get(IConfig::class), |
| 160 | + $appContainer->get(ICrypto::class), |
168 | 161 | Util::getDefaultEmailAddress('no-reply') |
169 | 162 | ); |
170 | 163 | }); |
|
0 commit comments