|
@@ -256,7 +256,7 @@ discard block |
|
|
block discarded – undo |
|
256
|
256
|
// To find out if we are running from CLI or not |
|
257
|
257
|
$this->registerParameter('isCLI', \OC::$CLI); |
|
258
|
258
|
|
|
259
|
|
- $this->registerService(\OCP\IServerContainer::class, function (IServerContainer $c) { |
|
|
259
|
+ $this->registerService(\OCP\IServerContainer::class, function(IServerContainer $c) { |
|
260
|
260
|
return $c; |
|
261
|
261
|
}); |
|
262
|
262
|
|
|
@@ -277,7 +277,7 @@ discard block |
|
|
block discarded – undo |
|
277
|
277
|
$this->registerAlias(IActionFactory::class, ActionFactory::class); |
|
278
|
278
|
|
|
279
|
279
|
|
|
280
|
|
- $this->registerService(IPreview::class, function (Server $c) { |
|
|
280
|
+ $this->registerService(IPreview::class, function(Server $c) { |
|
281
|
281
|
return new PreviewManager( |
|
282
|
282
|
$c->getConfig(), |
|
283
|
283
|
$c->getRootFolder(), |
|
@@ -289,13 +289,13 @@ discard block |
|
|
block discarded – undo |
|
289
|
289
|
}); |
|
290
|
290
|
$this->registerDeprecatedAlias('PreviewManager', IPreview::class); |
|
291
|
291
|
|
|
292
|
|
- $this->registerService(\OC\Preview\Watcher::class, function (Server $c) { |
|
|
292
|
+ $this->registerService(\OC\Preview\Watcher::class, function(Server $c) { |
|
293
|
293
|
return new \OC\Preview\Watcher( |
|
294
|
294
|
new \OC\Preview\Storage\Root($c->getRootFolder(), $c->getSystemConfig(), 'preview') |
|
295
|
295
|
); |
|
296
|
296
|
}); |
|
297
|
297
|
|
|
298
|
|
- $this->registerService(\OCP\Encryption\IManager::class, function (Server $c) { |
|
|
298
|
+ $this->registerService(\OCP\Encryption\IManager::class, function(Server $c) { |
|
299
|
299
|
$view = new View(); |
|
300
|
300
|
$util = new Encryption\Util( |
|
301
|
301
|
$view, |
|
@@ -314,7 +314,7 @@ discard block |
|
|
block discarded – undo |
|
314
|
314
|
}); |
|
315
|
315
|
$this->registerDeprecatedAlias('EncryptionManager', \OCP\Encryption\IManager::class); |
|
316
|
316
|
|
|
317
|
|
- $this->registerService('EncryptionFileHelper', function (Server $c) { |
|
|
317
|
+ $this->registerService('EncryptionFileHelper', function(Server $c) { |
|
318
|
318
|
$util = new Encryption\Util( |
|
319
|
319
|
new View(), |
|
320
|
320
|
$c->getUserManager(), |
|
@@ -328,7 +328,7 @@ discard block |
|
|
block discarded – undo |
|
328
|
328
|
); |
|
329
|
329
|
}); |
|
330
|
330
|
|
|
331
|
|
- $this->registerService('EncryptionKeyStorage', function (Server $c) { |
|
|
331
|
+ $this->registerService('EncryptionKeyStorage', function(Server $c) { |
|
332
|
332
|
$view = new View(); |
|
333
|
333
|
$util = new Encryption\Util( |
|
334
|
334
|
$view, |
|
@@ -339,30 +339,30 @@ discard block |
|
|
block discarded – undo |
|
339
|
339
|
|
|
340
|
340
|
return new Encryption\Keys\Storage($view, $util); |
|
341
|
341
|
}); |
|
342
|
|
- $this->registerService('TagMapper', function (Server $c) { |
|
|
342
|
+ $this->registerService('TagMapper', function(Server $c) { |
|
343
|
343
|
return new TagMapper($c->getDatabaseConnection()); |
|
344
|
344
|
}); |
|
345
|
345
|
|
|
346
|
|
- $this->registerService(\OCP\ITagManager::class, function (Server $c) { |
|
|
346
|
+ $this->registerService(\OCP\ITagManager::class, function(Server $c) { |
|
347
|
347
|
$tagMapper = $c->query('TagMapper'); |
|
348
|
348
|
return new TagManager($tagMapper, $c->getUserSession()); |
|
349
|
349
|
}); |
|
350
|
350
|
$this->registerDeprecatedAlias('TagManager', \OCP\ITagManager::class); |
|
351
|
351
|
|
|
352
|
|
- $this->registerService('SystemTagManagerFactory', function (Server $c) { |
|
|
352
|
+ $this->registerService('SystemTagManagerFactory', function(Server $c) { |
|
353
|
353
|
$config = $c->getConfig(); |
|
354
|
354
|
$factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class); |
|
355
|
355
|
return new $factoryClass($this); |
|
356
|
356
|
}); |
|
357
|
|
- $this->registerService(ISystemTagManager::class, function (Server $c) { |
|
|
357
|
+ $this->registerService(ISystemTagManager::class, function(Server $c) { |
|
358
|
358
|
return $c->query('SystemTagManagerFactory')->getManager(); |
|
359
|
359
|
}); |
|
360
|
360
|
$this->registerDeprecatedAlias('SystemTagManager', ISystemTagManager::class); |
|
361
|
361
|
|
|
362
|
|
- $this->registerService(ISystemTagObjectMapper::class, function (Server $c) { |
|
|
362
|
+ $this->registerService(ISystemTagObjectMapper::class, function(Server $c) { |
|
363
|
363
|
return $c->query('SystemTagManagerFactory')->getObjectMapper(); |
|
364
|
364
|
}); |
|
365
|
|
- $this->registerService('RootFolder', function (Server $c) { |
|
|
365
|
+ $this->registerService('RootFolder', function(Server $c) { |
|
366
|
366
|
$manager = \OC\Files\Filesystem::getMountManager(null); |
|
367
|
367
|
$view = new View(); |
|
368
|
368
|
$root = new Root( |
|
@@ -379,7 +379,7 @@ discard block |
|
|
block discarded – undo |
|
379
|
379
|
|
|
380
|
380
|
return $root; |
|
381
|
381
|
}); |
|
382
|
|
- $this->registerService(HookConnector::class, function (Server $c) { |
|
|
382
|
+ $this->registerService(HookConnector::class, function(Server $c) { |
|
383
|
383
|
return new HookConnector( |
|
384
|
384
|
$c->query(IRootFolder::class), |
|
385
|
385
|
new View(), |
|
@@ -390,8 +390,8 @@ discard block |
|
|
block discarded – undo |
|
390
|
390
|
|
|
391
|
391
|
$this->registerDeprecatedAlias('SystemTagObjectMapper', ISystemTagObjectMapper::class); |
|
392
|
392
|
|
|
393
|
|
- $this->registerService(IRootFolder::class, function (Server $c) { |
|
394
|
|
- return new LazyRoot(function () use ($c) { |
|
|
393
|
+ $this->registerService(IRootFolder::class, function(Server $c) { |
|
|
394
|
+ return new LazyRoot(function() use ($c) { |
|
395
|
395
|
return $c->query('RootFolder'); |
|
396
|
396
|
}); |
|
397
|
397
|
}); |
|
@@ -400,44 +400,44 @@ discard block |
|
|
block discarded – undo |
|
400
|
400
|
$this->registerDeprecatedAlias('UserManager', \OC\User\Manager::class); |
|
401
|
401
|
$this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class); |
|
402
|
402
|
|
|
403
|
|
- $this->registerService(\OCP\IGroupManager::class, function (Server $c) { |
|
|
403
|
+ $this->registerService(\OCP\IGroupManager::class, function(Server $c) { |
|
404
|
404
|
$groupManager = new \OC\Group\Manager($this->getUserManager(), $c->getEventDispatcher(), $this->getLogger()); |
|
405
|
|
- $groupManager->listen('\OC\Group', 'preCreate', function ($gid) { |
|
|
405
|
+ $groupManager->listen('\OC\Group', 'preCreate', function($gid) { |
|
406
|
406
|
\OC_Hook::emit('OC_Group', 'pre_createGroup', ['run' => true, 'gid' => $gid]); |
|
407
|
407
|
|
|
408
|
408
|
/** @var IEventDispatcher $dispatcher */ |
|
409
|
409
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
410
|
410
|
$dispatcher->dispatchTyped(new BeforeGroupCreatedEvent($gid)); |
|
411
|
411
|
}); |
|
412
|
|
- $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $group) { |
|
|
412
|
+ $groupManager->listen('\OC\Group', 'postCreate', function(\OC\Group\Group $group) { |
|
413
|
413
|
\OC_Hook::emit('OC_User', 'post_createGroup', ['gid' => $group->getGID()]); |
|
414
|
414
|
|
|
415
|
415
|
/** @var IEventDispatcher $dispatcher */ |
|
416
|
416
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
417
|
417
|
$dispatcher->dispatchTyped(new GroupCreatedEvent($group)); |
|
418
|
418
|
}); |
|
419
|
|
- $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) { |
|
|
419
|
+ $groupManager->listen('\OC\Group', 'preDelete', function(\OC\Group\Group $group) { |
|
420
|
420
|
\OC_Hook::emit('OC_Group', 'pre_deleteGroup', ['run' => true, 'gid' => $group->getGID()]); |
|
421
|
421
|
|
|
422
|
422
|
/** @var IEventDispatcher $dispatcher */ |
|
423
|
423
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
424
|
424
|
$dispatcher->dispatchTyped(new BeforeGroupDeletedEvent($group)); |
|
425
|
425
|
}); |
|
426
|
|
- $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) { |
|
|
426
|
+ $groupManager->listen('\OC\Group', 'postDelete', function(\OC\Group\Group $group) { |
|
427
|
427
|
\OC_Hook::emit('OC_User', 'post_deleteGroup', ['gid' => $group->getGID()]); |
|
428
|
428
|
|
|
429
|
429
|
/** @var IEventDispatcher $dispatcher */ |
|
430
|
430
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
431
|
431
|
$dispatcher->dispatchTyped(new GroupDeletedEvent($group)); |
|
432
|
432
|
}); |
|
433
|
|
- $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
|
433
|
+ $groupManager->listen('\OC\Group', 'preAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
434
|
434
|
\OC_Hook::emit('OC_Group', 'pre_addToGroup', ['run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID()]); |
|
435
|
435
|
|
|
436
|
436
|
/** @var IEventDispatcher $dispatcher */ |
|
437
|
437
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
438
|
438
|
$dispatcher->dispatchTyped(new BeforeUserAddedEvent($group, $user)); |
|
439
|
439
|
}); |
|
440
|
|
- $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
|
440
|
+ $groupManager->listen('\OC\Group', 'postAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
441
|
441
|
\OC_Hook::emit('OC_Group', 'post_addToGroup', ['uid' => $user->getUID(), 'gid' => $group->getGID()]); |
|
442
|
442
|
//Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks |
|
443
|
443
|
\OC_Hook::emit('OC_User', 'post_addToGroup', ['uid' => $user->getUID(), 'gid' => $group->getGID()]); |
|
@@ -446,12 +446,12 @@ discard block |
|
|
block discarded – undo |
|
446
|
446
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
447
|
447
|
$dispatcher->dispatchTyped(new UserAddedEvent($group, $user)); |
|
448
|
448
|
}); |
|
449
|
|
- $groupManager->listen('\OC\Group', 'preRemoveUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
|
449
|
+ $groupManager->listen('\OC\Group', 'preRemoveUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
450
|
450
|
/** @var IEventDispatcher $dispatcher */ |
|
451
|
451
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
452
|
452
|
$dispatcher->dispatchTyped(new BeforeUserRemovedEvent($group, $user)); |
|
453
|
453
|
}); |
|
454
|
|
- $groupManager->listen('\OC\Group', 'postRemoveUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
|
454
|
+ $groupManager->listen('\OC\Group', 'postRemoveUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
455
|
455
|
/** @var IEventDispatcher $dispatcher */ |
|
456
|
456
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
457
|
457
|
$dispatcher->dispatchTyped(new UserRemovedEvent($group, $user)); |
|
@@ -460,7 +460,7 @@ discard block |
|
|
block discarded – undo |
|
460
|
460
|
}); |
|
461
|
461
|
$this->registerDeprecatedAlias('GroupManager', \OCP\IGroupManager::class); |
|
462
|
462
|
|
|
463
|
|
- $this->registerService(Store::class, function (Server $c) { |
|
|
463
|
+ $this->registerService(Store::class, function(Server $c) { |
|
464
|
464
|
$session = $c->getSession(); |
|
465
|
465
|
if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
466
|
466
|
$tokenProvider = $c->query(IProvider::class); |
|
@@ -471,13 +471,13 @@ discard block |
|
|
block discarded – undo |
|
471
|
471
|
return new Store($session, $logger, $tokenProvider); |
|
472
|
472
|
}); |
|
473
|
473
|
$this->registerAlias(IStore::class, Store::class); |
|
474
|
|
- $this->registerService(Authentication\Token\DefaultTokenMapper::class, function (Server $c) { |
|
|
474
|
+ $this->registerService(Authentication\Token\DefaultTokenMapper::class, function(Server $c) { |
|
475
|
475
|
$dbConnection = $c->getDatabaseConnection(); |
|
476
|
476
|
return new Authentication\Token\DefaultTokenMapper($dbConnection); |
|
477
|
477
|
}); |
|
478
|
478
|
$this->registerAlias(IProvider::class, Authentication\Token\Manager::class); |
|
479
|
479
|
|
|
480
|
|
- $this->registerService(\OC\User\Session::class, function (Server $c) { |
|
|
480
|
+ $this->registerService(\OC\User\Session::class, function(Server $c) { |
|
481
|
481
|
$manager = $c->getUserManager(); |
|
482
|
482
|
$session = new \OC\Session\Memory(''); |
|
483
|
483
|
$timeFactory = new TimeFactory(); |
|
@@ -502,14 +502,14 @@ discard block |
|
|
block discarded – undo |
|
502
|
502
|
$c->getLogger(), |
|
503
|
503
|
$c->query(IEventDispatcher::class) |
|
504
|
504
|
); |
|
505
|
|
- $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { |
|
|
505
|
+ $userSession->listen('\OC\User', 'preCreateUser', function($uid, $password) { |
|
506
|
506
|
\OC_Hook::emit('OC_User', 'pre_createUser', ['run' => true, 'uid' => $uid, 'password' => $password]); |
|
507
|
507
|
|
|
508
|
508
|
/** @var IEventDispatcher $dispatcher */ |
|
509
|
509
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
510
|
510
|
$dispatcher->dispatchTyped(new BeforeUserCreatedEvent($uid, $password)); |
|
511
|
511
|
}); |
|
512
|
|
- $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) { |
|
|
512
|
+ $userSession->listen('\OC\User', 'postCreateUser', function($user, $password) { |
|
513
|
513
|
/** @var $user \OC\User\User */ |
|
514
|
514
|
\OC_Hook::emit('OC_User', 'post_createUser', ['uid' => $user->getUID(), 'password' => $password]); |
|
515
|
515
|
|
|
@@ -517,7 +517,7 @@ discard block |
|
|
block discarded – undo |
|
517
|
517
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
518
|
518
|
$dispatcher->dispatchTyped(new UserCreatedEvent($user, $password)); |
|
519
|
519
|
}); |
|
520
|
|
- $userSession->listen('\OC\User', 'preDelete', function ($user) use ($legacyDispatcher) { |
|
|
520
|
+ $userSession->listen('\OC\User', 'preDelete', function($user) use ($legacyDispatcher) { |
|
521
|
521
|
/** @var $user \OC\User\User */ |
|
522
|
522
|
\OC_Hook::emit('OC_User', 'pre_deleteUser', ['run' => true, 'uid' => $user->getUID()]); |
|
523
|
523
|
$legacyDispatcher->dispatch('OCP\IUser::preDelete', new GenericEvent($user)); |
|
@@ -526,7 +526,7 @@ discard block |
|
|
block discarded – undo |
|
526
|
526
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
527
|
527
|
$dispatcher->dispatchTyped(new BeforeUserDeletedEvent($user)); |
|
528
|
528
|
}); |
|
529
|
|
- $userSession->listen('\OC\User', 'postDelete', function ($user) { |
|
|
529
|
+ $userSession->listen('\OC\User', 'postDelete', function($user) { |
|
530
|
530
|
/** @var $user \OC\User\User */ |
|
531
|
531
|
\OC_Hook::emit('OC_User', 'post_deleteUser', ['uid' => $user->getUID()]); |
|
532
|
532
|
|
|
@@ -534,7 +534,7 @@ discard block |
|
|
block discarded – undo |
|
534
|
534
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
535
|
535
|
$dispatcher->dispatchTyped(new UserDeletedEvent($user)); |
|
536
|
536
|
}); |
|
537
|
|
- $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) { |
|
|
537
|
+ $userSession->listen('\OC\User', 'preSetPassword', function($user, $password, $recoveryPassword) { |
|
538
|
538
|
/** @var $user \OC\User\User */ |
|
539
|
539
|
\OC_Hook::emit('OC_User', 'pre_setPassword', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword]); |
|
540
|
540
|
|
|
@@ -542,7 +542,7 @@ discard block |
|
|
block discarded – undo |
|
542
|
542
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
543
|
543
|
$dispatcher->dispatchTyped(new BeforePasswordUpdatedEvent($user, $password, $recoveryPassword)); |
|
544
|
544
|
}); |
|
545
|
|
- $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) { |
|
|
545
|
+ $userSession->listen('\OC\User', 'postSetPassword', function($user, $password, $recoveryPassword) { |
|
546
|
546
|
/** @var $user \OC\User\User */ |
|
547
|
547
|
\OC_Hook::emit('OC_User', 'post_setPassword', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword]); |
|
548
|
548
|
|
|
@@ -550,14 +550,14 @@ discard block |
|
|
block discarded – undo |
|
550
|
550
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
551
|
551
|
$dispatcher->dispatchTyped(new PasswordUpdatedEvent($user, $password, $recoveryPassword)); |
|
552
|
552
|
}); |
|
553
|
|
- $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) { |
|
|
553
|
+ $userSession->listen('\OC\User', 'preLogin', function($uid, $password) { |
|
554
|
554
|
\OC_Hook::emit('OC_User', 'pre_login', ['run' => true, 'uid' => $uid, 'password' => $password]); |
|
555
|
555
|
|
|
556
|
556
|
/** @var IEventDispatcher $dispatcher */ |
|
557
|
557
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
558
|
558
|
$dispatcher->dispatchTyped(new BeforeUserLoggedInEvent($uid, $password)); |
|
559
|
559
|
}); |
|
560
|
|
- $userSession->listen('\OC\User', 'postLogin', function ($user, $password, $isTokenLogin) { |
|
|
560
|
+ $userSession->listen('\OC\User', 'postLogin', function($user, $password, $isTokenLogin) { |
|
561
|
561
|
/** @var $user \OC\User\User */ |
|
562
|
562
|
\OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'isTokenLogin' => $isTokenLogin]); |
|
563
|
563
|
|
|
@@ -565,12 +565,12 @@ discard block |
|
|
block discarded – undo |
|
565
|
565
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
566
|
566
|
$dispatcher->dispatchTyped(new UserLoggedInEvent($user, $password, $isTokenLogin)); |
|
567
|
567
|
}); |
|
568
|
|
- $userSession->listen('\OC\User', 'preRememberedLogin', function ($uid) { |
|
|
568
|
+ $userSession->listen('\OC\User', 'preRememberedLogin', function($uid) { |
|
569
|
569
|
/** @var IEventDispatcher $dispatcher */ |
|
570
|
570
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
571
|
571
|
$dispatcher->dispatchTyped(new BeforeUserLoggedInWithCookieEvent($uid)); |
|
572
|
572
|
}); |
|
573
|
|
- $userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) { |
|
|
573
|
+ $userSession->listen('\OC\User', 'postRememberedLogin', function($user, $password) { |
|
574
|
574
|
/** @var $user \OC\User\User */ |
|
575
|
575
|
\OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $user->getUID(), 'password' => $password]); |
|
576
|
576
|
|
|
@@ -578,19 +578,19 @@ discard block |
|
|
block discarded – undo |
|
578
|
578
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
579
|
579
|
$dispatcher->dispatchTyped(new UserLoggedInWithCookieEvent($user, $password)); |
|
580
|
580
|
}); |
|
581
|
|
- $userSession->listen('\OC\User', 'logout', function ($user) { |
|
|
581
|
+ $userSession->listen('\OC\User', 'logout', function($user) { |
|
582
|
582
|
\OC_Hook::emit('OC_User', 'logout', []); |
|
583
|
583
|
|
|
584
|
584
|
/** @var IEventDispatcher $dispatcher */ |
|
585
|
585
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
586
|
586
|
$dispatcher->dispatchTyped(new BeforeUserLoggedOutEvent($user)); |
|
587
|
587
|
}); |
|
588
|
|
- $userSession->listen('\OC\User', 'postLogout', function ($user) { |
|
|
588
|
+ $userSession->listen('\OC\User', 'postLogout', function($user) { |
|
589
|
589
|
/** @var IEventDispatcher $dispatcher */ |
|
590
|
590
|
$dispatcher = $this->query(IEventDispatcher::class); |
|
591
|
591
|
$dispatcher->dispatchTyped(new UserLoggedOutEvent($user)); |
|
592
|
592
|
}); |
|
593
|
|
- $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) { |
|
|
593
|
+ $userSession->listen('\OC\User', 'changeUser', function($user, $feature, $value, $oldValue) { |
|
594
|
594
|
/** @var $user \OC\User\User */ |
|
595
|
595
|
\OC_Hook::emit('OC_User', 'changeUser', ['run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue]); |
|
596
|
596
|
|
|
@@ -608,7 +608,7 @@ discard block |
|
|
block discarded – undo |
|
608
|
608
|
$this->registerAlias(INavigationManager::class, \OC\NavigationManager::class); |
|
609
|
609
|
$this->registerDeprecatedAlias('NavigationManager', INavigationManager::class); |
|
610
|
610
|
|
|
611
|
|
- $this->registerService(\OC\AllConfig::class, function (Server $c) { |
|
|
611
|
+ $this->registerService(\OC\AllConfig::class, function(Server $c) { |
|
612
|
612
|
return new \OC\AllConfig( |
|
613
|
613
|
$c->getSystemConfig() |
|
614
|
614
|
); |
|
@@ -616,18 +616,18 @@ discard block |
|
|
block discarded – undo |
|
616
|
616
|
$this->registerDeprecatedAlias('AllConfig', \OC\AllConfig::class); |
|
617
|
617
|
$this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class); |
|
618
|
618
|
|
|
619
|
|
- $this->registerService(\OC\SystemConfig::class, function ($c) use ($config) { |
|
|
619
|
+ $this->registerService(\OC\SystemConfig::class, function($c) use ($config) { |
|
620
|
620
|
return new \OC\SystemConfig($config); |
|
621
|
621
|
}); |
|
622
|
622
|
$this->registerDeprecatedAlias('SystemConfig', \OC\SystemConfig::class); |
|
623
|
623
|
|
|
624
|
|
- $this->registerService(\OC\AppConfig::class, function (Server $c) { |
|
|
624
|
+ $this->registerService(\OC\AppConfig::class, function(Server $c) { |
|
625
|
625
|
return new \OC\AppConfig($c->getDatabaseConnection()); |
|
626
|
626
|
}); |
|
627
|
627
|
$this->registerDeprecatedAlias('AppConfig', \OC\AppConfig::class); |
|
628
|
628
|
$this->registerAlias(IAppConfig::class, \OC\AppConfig::class); |
|
629
|
629
|
|
|
630
|
|
- $this->registerService(IFactory::class, function (Server $c) { |
|
|
630
|
+ $this->registerService(IFactory::class, function(Server $c) { |
|
631
|
631
|
return new \OC\L10N\Factory( |
|
632
|
632
|
$c->getConfig(), |
|
633
|
633
|
$c->getRequest(), |
|
@@ -637,7 +637,7 @@ discard block |
|
|
block discarded – undo |
|
637
|
637
|
}); |
|
638
|
638
|
$this->registerDeprecatedAlias('L10NFactory', IFactory::class); |
|
639
|
639
|
|
|
640
|
|
- $this->registerService(IURLGenerator::class, function (Server $c) { |
|
|
640
|
+ $this->registerService(IURLGenerator::class, function(Server $c) { |
|
641
|
641
|
$config = $c->getConfig(); |
|
642
|
642
|
$cacheFactory = $c->getMemCacheFactory(); |
|
643
|
643
|
$request = $c->getRequest(); |
|
@@ -652,12 +652,12 @@ discard block |
|
|
block discarded – undo |
|
652
|
652
|
$this->registerDeprecatedAlias('AppFetcher', AppFetcher::class); |
|
653
|
653
|
$this->registerDeprecatedAlias('CategoryFetcher', CategoryFetcher::class); |
|
654
|
654
|
|
|
655
|
|
- $this->registerService(ICache::class, function ($c) { |
|
|
655
|
+ $this->registerService(ICache::class, function($c) { |
|
656
|
656
|
return new Cache\File(); |
|
657
|
657
|
}); |
|
658
|
658
|
$this->registerDeprecatedAlias('UserCache', ICache::class); |
|
659
|
659
|
|
|
660
|
|
- $this->registerService(Factory::class, function (Server $c) { |
|
|
660
|
+ $this->registerService(Factory::class, function(Server $c) { |
|
661
|
661
|
$arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(), |
|
662
|
662
|
ArrayCache::class, |
|
663
|
663
|
ArrayCache::class, |
|
@@ -671,7 +671,7 @@ discard block |
|
|
block discarded – undo |
|
671
|
671
|
$version = implode(',', $v); |
|
672
|
672
|
$instanceId = \OC_Util::getInstanceId(); |
|
673
|
673
|
$path = \OC::$SERVERROOT; |
|
674
|
|
- $prefix = md5($instanceId . '-' . $version . '-' . $path); |
|
|
674
|
+ $prefix = md5($instanceId.'-'.$version.'-'.$path); |
|
675
|
675
|
return new \OC\Memcache\Factory($prefix, $c->getLogger(), |
|
676
|
676
|
$config->getSystemValue('memcache.local', null), |
|
677
|
677
|
$config->getSystemValue('memcache.distributed', null), |
|
@@ -683,12 +683,12 @@ discard block |
|
|
block discarded – undo |
|
683
|
683
|
$this->registerDeprecatedAlias('MemCacheFactory', Factory::class); |
|
684
|
684
|
$this->registerAlias(ICacheFactory::class, Factory::class); |
|
685
|
685
|
|
|
686
|
|
- $this->registerService('RedisFactory', function (Server $c) { |
|
|
686
|
+ $this->registerService('RedisFactory', function(Server $c) { |
|
687
|
687
|
$systemConfig = $c->getSystemConfig(); |
|
688
|
688
|
return new RedisFactory($systemConfig); |
|
689
|
689
|
}); |
|
690
|
690
|
|
|
691
|
|
- $this->registerService(\OCP\Activity\IManager::class, function (Server $c) { |
|
|
691
|
+ $this->registerService(\OCP\Activity\IManager::class, function(Server $c) { |
|
692
|
692
|
return new \OC\Activity\Manager( |
|
693
|
693
|
$c->getRequest(), |
|
694
|
694
|
$c->getUserSession(), |
|
@@ -698,14 +698,14 @@ discard block |
|
|
block discarded – undo |
|
698
|
698
|
}); |
|
699
|
699
|
$this->registerDeprecatedAlias('ActivityManager', \OCP\Activity\IManager::class); |
|
700
|
700
|
|
|
701
|
|
- $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) { |
|
|
701
|
+ $this->registerService(\OCP\Activity\IEventMerger::class, function(Server $c) { |
|
702
|
702
|
return new \OC\Activity\EventMerger( |
|
703
|
703
|
$c->getL10N('lib') |
|
704
|
704
|
); |
|
705
|
705
|
}); |
|
706
|
706
|
$this->registerAlias(IValidator::class, Validator::class); |
|
707
|
707
|
|
|
708
|
|
- $this->registerService(AvatarManager::class, function (Server $c) { |
|
|
708
|
+ $this->registerService(AvatarManager::class, function(Server $c) { |
|
709
|
709
|
return new AvatarManager( |
|
710
|
710
|
$c->query(\OC\User\Manager::class), |
|
711
|
711
|
$c->getAppDataDir('avatar'), |
|
@@ -720,7 +720,7 @@ discard block |
|
|
block discarded – undo |
|
720
|
720
|
$this->registerAlias(\OCP\Support\CrashReport\IRegistry::class, \OC\Support\CrashReport\Registry::class); |
|
721
|
721
|
$this->registerAlias(\OCP\Support\Subscription\IRegistry::class, \OC\Support\Subscription\Registry::class); |
|
722
|
722
|
|
|
723
|
|
- $this->registerService(\OC\Log::class, function (Server $c) { |
|
|
723
|
+ $this->registerService(\OC\Log::class, function(Server $c) { |
|
724
|
724
|
$logType = $c->query(AllConfig::class)->getSystemValue('log_type', 'file'); |
|
725
|
725
|
$factory = new LogFactory($c, $this->getSystemConfig()); |
|
726
|
726
|
$logger = $factory->get($logType); |
|
@@ -733,11 +733,11 @@ discard block |
|
|
block discarded – undo |
|
733
|
733
|
// PSR-3 logger |
|
734
|
734
|
$this->registerAlias(LoggerInterface::class, PsrLoggerAdapter::class); |
|
735
|
735
|
|
|
736
|
|
- $this->registerService(ILogFactory::class, function (Server $c) { |
|
|
736
|
+ $this->registerService(ILogFactory::class, function(Server $c) { |
|
737
|
737
|
return new LogFactory($c, $this->getSystemConfig()); |
|
738
|
738
|
}); |
|
739
|
739
|
|
|
740
|
|
- $this->registerService(IJobList::class, function (Server $c) { |
|
|
740
|
+ $this->registerService(IJobList::class, function(Server $c) { |
|
741
|
741
|
$config = $c->getConfig(); |
|
742
|
742
|
return new \OC\BackgroundJob\JobList( |
|
743
|
743
|
$c->getDatabaseConnection(), |
|
@@ -747,7 +747,7 @@ discard block |
|
|
block discarded – undo |
|
747
|
747
|
}); |
|
748
|
748
|
$this->registerDeprecatedAlias('JobList', IJobList::class); |
|
749
|
749
|
|
|
750
|
|
- $this->registerService(IRouter::class, function (Server $c) { |
|
|
750
|
+ $this->registerService(IRouter::class, function(Server $c) { |
|
751
|
751
|
$cacheFactory = $c->getMemCacheFactory(); |
|
752
|
752
|
$logger = $c->getLogger(); |
|
753
|
753
|
if ($cacheFactory->isLocalCacheAvailable()) { |
|
@@ -759,39 +759,39 @@ discard block |
|
|
block discarded – undo |
|
759
|
759
|
}); |
|
760
|
760
|
$this->registerDeprecatedAlias('Router', IRouter::class); |
|
761
|
761
|
|
|
762
|
|
- $this->registerService(ISearch::class, function ($c) { |
|
|
762
|
+ $this->registerService(ISearch::class, function($c) { |
|
763
|
763
|
return new Search(); |
|
764
|
764
|
}); |
|
765
|
765
|
$this->registerDeprecatedAlias('Search', ISearch::class); |
|
766
|
766
|
|
|
767
|
|
- $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) { |
|
|
767
|
+ $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function($c) { |
|
768
|
768
|
return new \OC\Security\RateLimiting\Backend\MemoryCache( |
|
769
|
769
|
$this->getMemCacheFactory(), |
|
770
|
770
|
new \OC\AppFramework\Utility\TimeFactory() |
|
771
|
771
|
); |
|
772
|
772
|
}); |
|
773
|
773
|
|
|
774
|
|
- $this->registerService(\OCP\Security\ISecureRandom::class, function ($c) { |
|
|
774
|
+ $this->registerService(\OCP\Security\ISecureRandom::class, function($c) { |
|
775
|
775
|
return new SecureRandom(); |
|
776
|
776
|
}); |
|
777
|
777
|
$this->registerDeprecatedAlias('SecureRandom', \OCP\Security\ISecureRandom::class); |
|
778
|
778
|
|
|
779
|
|
- $this->registerService(ICrypto::class, function (Server $c) { |
|
|
779
|
+ $this->registerService(ICrypto::class, function(Server $c) { |
|
780
|
780
|
return new Crypto($c->getConfig(), $c->getSecureRandom()); |
|
781
|
781
|
}); |
|
782
|
782
|
$this->registerDeprecatedAlias('Crypto', ICrypto::class); |
|
783
|
783
|
|
|
784
|
|
- $this->registerService(IHasher::class, function (Server $c) { |
|
|
784
|
+ $this->registerService(IHasher::class, function(Server $c) { |
|
785
|
785
|
return new Hasher($c->getConfig()); |
|
786
|
786
|
}); |
|
787
|
787
|
$this->registerDeprecatedAlias('Hasher', IHasher::class); |
|
788
|
788
|
|
|
789
|
|
- $this->registerService(ICredentialsManager::class, function (Server $c) { |
|
|
789
|
+ $this->registerService(ICredentialsManager::class, function(Server $c) { |
|
790
|
790
|
return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection()); |
|
791
|
791
|
}); |
|
792
|
792
|
$this->registerDeprecatedAlias('CredentialsManager', ICredentialsManager::class); |
|
793
|
793
|
|
|
794
|
|
- $this->registerService(IDBConnection::class, function (Server $c) { |
|
|
794
|
+ $this->registerService(IDBConnection::class, function(Server $c) { |
|
795
|
795
|
$systemConfig = $c->getSystemConfig(); |
|
796
|
796
|
$factory = new \OC\DB\ConnectionFactory($systemConfig); |
|
797
|
797
|
$type = $systemConfig->getValue('dbtype', 'sqlite'); |
|
@@ -806,7 +806,7 @@ discard block |
|
|
block discarded – undo |
|
806
|
806
|
$this->registerDeprecatedAlias('DatabaseConnection', IDBConnection::class); |
|
807
|
807
|
|
|
808
|
808
|
|
|
809
|
|
- $this->registerService(IClientService::class, function (Server $c) { |
|
|
809
|
+ $this->registerService(IClientService::class, function(Server $c) { |
|
810
|
810
|
$user = \OC_User::getUser(); |
|
811
|
811
|
$uid = $user ? $user : null; |
|
812
|
812
|
return new ClientService( |
|
@@ -822,7 +822,7 @@ discard block |
|
|
block discarded – undo |
|
822
|
822
|
); |
|
823
|
823
|
}); |
|
824
|
824
|
$this->registerDeprecatedAlias('HttpClientService', IClientService::class); |
|
825
|
|
- $this->registerService(IEventLogger::class, function (Server $c) { |
|
|
825
|
+ $this->registerService(IEventLogger::class, function(Server $c) { |
|
826
|
826
|
$eventLogger = new EventLogger(); |
|
827
|
827
|
if ($c->getSystemConfig()->getValue('debug', false)) { |
|
828
|
828
|
// In debug mode, module is being activated by default |
|
@@ -832,7 +832,7 @@ discard block |
|
|
block discarded – undo |
|
832
|
832
|
}); |
|
833
|
833
|
$this->registerDeprecatedAlias('EventLogger', IEventLogger::class); |
|
834
|
834
|
|
|
835
|
|
- $this->registerService(IQueryLogger::class, function (Server $c) { |
|
|
835
|
+ $this->registerService(IQueryLogger::class, function(Server $c) { |
|
836
|
836
|
$queryLogger = new QueryLogger(); |
|
837
|
837
|
if ($c->getSystemConfig()->getValue('debug', false)) { |
|
838
|
838
|
// In debug mode, module is being activated by default |
|
@@ -842,7 +842,7 @@ discard block |
|
|
block discarded – undo |
|
842
|
842
|
}); |
|
843
|
843
|
$this->registerDeprecatedAlias('QueryLogger', IQueryLogger::class); |
|
844
|
844
|
|
|
845
|
|
- $this->registerService(TempManager::class, function (Server $c) { |
|
|
845
|
+ $this->registerService(TempManager::class, function(Server $c) { |
|
846
|
846
|
return new TempManager( |
|
847
|
847
|
$c->getLogger(), |
|
848
|
848
|
$c->getConfig() |
|
@@ -851,7 +851,7 @@ discard block |
|
|
block discarded – undo |
|
851
|
851
|
$this->registerDeprecatedAlias('TempManager', TempManager::class); |
|
852
|
852
|
$this->registerAlias(ITempManager::class, TempManager::class); |
|
853
|
853
|
|
|
854
|
|
- $this->registerService(AppManager::class, function (Server $c) { |
|
|
854
|
+ $this->registerService(AppManager::class, function(Server $c) { |
|
855
|
855
|
return new \OC\App\AppManager( |
|
856
|
856
|
$c->getUserSession(), |
|
857
|
857
|
$c->getConfig(), |
|
@@ -865,7 +865,7 @@ discard block |
|
|
block discarded – undo |
|
865
|
865
|
$this->registerDeprecatedAlias('AppManager', AppManager::class); |
|
866
|
866
|
$this->registerAlias(IAppManager::class, AppManager::class); |
|
867
|
867
|
|
|
868
|
|
- $this->registerService(IDateTimeZone::class, function (Server $c) { |
|
|
868
|
+ $this->registerService(IDateTimeZone::class, function(Server $c) { |
|
869
|
869
|
return new DateTimeZone( |
|
870
|
870
|
$c->getConfig(), |
|
871
|
871
|
$c->getSession() |
|
@@ -873,7 +873,7 @@ discard block |
|
|
block discarded – undo |
|
873
|
873
|
}); |
|
874
|
874
|
$this->registerDeprecatedAlias('DateTimeZone', IDateTimeZone::class); |
|
875
|
875
|
|
|
876
|
|
- $this->registerService(IDateTimeFormatter::class, function (Server $c) { |
|
|
876
|
+ $this->registerService(IDateTimeFormatter::class, function(Server $c) { |
|
877
|
877
|
$language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null); |
|
878
|
878
|
|
|
879
|
879
|
return new DateTimeFormatter( |
|
@@ -883,7 +883,7 @@ discard block |
|
|
block discarded – undo |
|
883
|
883
|
}); |
|
884
|
884
|
$this->registerDeprecatedAlias('DateTimeFormatter', IDateTimeFormatter::class); |
|
885
|
885
|
|
|
886
|
|
- $this->registerService(IUserMountCache::class, function (Server $c) { |
|
|
886
|
+ $this->registerService(IUserMountCache::class, function(Server $c) { |
|
887
|
887
|
$mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger()); |
|
888
|
888
|
$listener = new UserMountCacheListener($mountCache); |
|
889
|
889
|
$listener->listen($c->getUserManager()); |
|
@@ -891,7 +891,7 @@ discard block |
|
|
block discarded – undo |
|
891
|
891
|
}); |
|
892
|
892
|
$this->registerDeprecatedAlias('UserMountCache', IUserMountCache::class); |
|
893
|
893
|
|
|
894
|
|
- $this->registerService(IMountProviderCollection::class, function (Server $c) { |
|
|
894
|
+ $this->registerService(IMountProviderCollection::class, function(Server $c) { |
|
895
|
895
|
$loader = \OC\Files\Filesystem::getLoader(); |
|
896
|
896
|
$mountCache = $c->query(IUserMountCache::class); |
|
897
|
897
|
$manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); |
|
@@ -907,10 +907,10 @@ discard block |
|
|
block discarded – undo |
|
907
|
907
|
}); |
|
908
|
908
|
$this->registerDeprecatedAlias('MountConfigManager', IMountProviderCollection::class); |
|
909
|
909
|
|
|
910
|
|
- $this->registerService('IniWrapper', function ($c) { |
|
|
910
|
+ $this->registerService('IniWrapper', function($c) { |
|
911
|
911
|
return new IniGetWrapper(); |
|
912
|
912
|
}); |
|
913
|
|
- $this->registerService('AsyncCommandBus', function (Server $c) { |
|
|
913
|
+ $this->registerService('AsyncCommandBus', function(Server $c) { |
|
914
|
914
|
$busClass = $c->getConfig()->getSystemValue('commandbus'); |
|
915
|
915
|
if ($busClass) { |
|
916
|
916
|
list($app, $class) = explode('::', $busClass, 2); |
|
@@ -925,10 +925,10 @@ discard block |
|
|
block discarded – undo |
|
925
|
925
|
return new CronBus($jobList); |
|
926
|
926
|
} |
|
927
|
927
|
}); |
|
928
|
|
- $this->registerService('TrustedDomainHelper', function ($c) { |
|
|
928
|
+ $this->registerService('TrustedDomainHelper', function($c) { |
|
929
|
929
|
return new TrustedDomainHelper($this->getConfig()); |
|
930
|
930
|
}); |
|
931
|
|
- $this->registerService(Throttler::class, function (Server $c) { |
|
|
931
|
+ $this->registerService(Throttler::class, function(Server $c) { |
|
932
|
932
|
return new Throttler( |
|
933
|
933
|
$c->getDatabaseConnection(), |
|
934
|
934
|
new TimeFactory(), |
|
@@ -937,7 +937,7 @@ discard block |
|
|
block discarded – undo |
|
937
|
937
|
); |
|
938
|
938
|
}); |
|
939
|
939
|
$this->registerDeprecatedAlias('Throttler', Throttler::class); |
|
940
|
|
- $this->registerService('IntegrityCodeChecker', function (Server $c) { |
|
|
940
|
+ $this->registerService('IntegrityCodeChecker', function(Server $c) { |
|
941
|
941
|
// IConfig and IAppManager requires a working database. This code |
|
942
|
942
|
// might however be called when ownCloud is not yet setup. |
|
943
|
943
|
if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
@@ -959,7 +959,7 @@ discard block |
|
|
block discarded – undo |
|
959
|
959
|
$c->getMimeTypeDetector() |
|
960
|
960
|
); |
|
961
|
961
|
}); |
|
962
|
|
- $this->registerService(\OCP\IRequest::class, function ($c) { |
|
|
962
|
+ $this->registerService(\OCP\IRequest::class, function($c) { |
|
963
|
963
|
if (isset($this['urlParams'])) { |
|
964
|
964
|
$urlParams = $this['urlParams']; |
|
965
|
965
|
} else { |
|
@@ -995,7 +995,7 @@ discard block |
|
|
block discarded – undo |
|
995
|
995
|
}); |
|
996
|
996
|
$this->registerDeprecatedAlias('Request', \OCP\IRequest::class); |
|
997
|
997
|
|
|
998
|
|
- $this->registerService(IMailer::class, function (Server $c) { |
|
|
998
|
+ $this->registerService(IMailer::class, function(Server $c) { |
|
999
|
999
|
return new Mailer( |
|
1000
|
1000
|
$c->getConfig(), |
|
1001
|
1001
|
$c->getLogger(), |
|
@@ -1008,7 +1008,7 @@ discard block |
|
|
block discarded – undo |
|
1008
|
1008
|
}); |
|
1009
|
1009
|
$this->registerDeprecatedAlias('Mailer', IMailer::class); |
|
1010
|
1010
|
|
|
1011
|
|
- $this->registerService('LDAPProvider', function (Server $c) { |
|
|
1011
|
+ $this->registerService('LDAPProvider', function(Server $c) { |
|
1012
|
1012
|
$config = $c->getConfig(); |
|
1013
|
1013
|
$factoryClass = $config->getSystemValue('ldapProviderFactory', null); |
|
1014
|
1014
|
if (is_null($factoryClass)) { |
|
@@ -1018,7 +1018,7 @@ discard block |
|
|
block discarded – undo |
|
1018
|
1018
|
$factory = new $factoryClass($this); |
|
1019
|
1019
|
return $factory->getLDAPProvider(); |
|
1020
|
1020
|
}); |
|
1021
|
|
- $this->registerService(ILockingProvider::class, function (Server $c) { |
|
|
1021
|
+ $this->registerService(ILockingProvider::class, function(Server $c) { |
|
1022
|
1022
|
$ini = $c->getIniWrapper(); |
|
1023
|
1023
|
$config = $c->getConfig(); |
|
1024
|
1024
|
$ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); |
|
@@ -1041,31 +1041,31 @@ discard block |
|
|
block discarded – undo |
|
1041
|
1041
|
}); |
|
1042
|
1042
|
$this->registerDeprecatedAlias('LockingProvider', ILockingProvider::class); |
|
1043
|
1043
|
|
|
1044
|
|
- $this->registerService(IMountManager::class, function () { |
|
|
1044
|
+ $this->registerService(IMountManager::class, function() { |
|
1045
|
1045
|
return new \OC\Files\Mount\Manager(); |
|
1046
|
1046
|
}); |
|
1047
|
1047
|
$this->registerDeprecatedAlias('MountManager', IMountManager::class); |
|
1048
|
1048
|
|
|
1049
|
|
- $this->registerService(IMimeTypeDetector::class, function (Server $c) { |
|
|
1049
|
+ $this->registerService(IMimeTypeDetector::class, function(Server $c) { |
|
1050
|
1050
|
return new \OC\Files\Type\Detection( |
|
1051
|
1051
|
$c->getURLGenerator(), |
|
1052
|
1052
|
$c->getLogger(), |
|
1053
|
1053
|
\OC::$configDir, |
|
1054
|
|
- \OC::$SERVERROOT . '/resources/config/' |
|
|
1054
|
+ \OC::$SERVERROOT.'/resources/config/' |
|
1055
|
1055
|
); |
|
1056
|
1056
|
}); |
|
1057
|
1057
|
$this->registerDeprecatedAlias('MimeTypeDetector', IMimeTypeDetector::class); |
|
1058
|
1058
|
|
|
1059
|
|
- $this->registerService(IMimeTypeLoader::class, function (Server $c) { |
|
|
1059
|
+ $this->registerService(IMimeTypeLoader::class, function(Server $c) { |
|
1060
|
1060
|
return new \OC\Files\Type\Loader( |
|
1061
|
1061
|
$c->getDatabaseConnection() |
|
1062
|
1062
|
); |
|
1063
|
1063
|
}); |
|
1064
|
1064
|
$this->registerDeprecatedAlias('MimeTypeLoader', IMimeTypeLoader::class); |
|
1065
|
|
- $this->registerService(BundleFetcher::class, function () { |
|
|
1065
|
+ $this->registerService(BundleFetcher::class, function() { |
|
1066
|
1066
|
return new BundleFetcher($this->getL10N('lib')); |
|
1067
|
1067
|
}); |
|
1068
|
|
- $this->registerService(\OCP\Notification\IManager::class, function (Server $c) { |
|
|
1068
|
+ $this->registerService(\OCP\Notification\IManager::class, function(Server $c) { |
|
1069
|
1069
|
return new Manager( |
|
1070
|
1070
|
$c->query(IValidator::class), |
|
1071
|
1071
|
$c->getLogger() |
|
@@ -1073,26 +1073,26 @@ discard block |
|
|
block discarded – undo |
|
1073
|
1073
|
}); |
|
1074
|
1074
|
$this->registerDeprecatedAlias('NotificationManager', \OCP\Notification\IManager::class); |
|
1075
|
1075
|
|
|
1076
|
|
- $this->registerService(CapabilitiesManager::class, function (Server $c) { |
|
|
1076
|
+ $this->registerService(CapabilitiesManager::class, function(Server $c) { |
|
1077
|
1077
|
$manager = new CapabilitiesManager($c->getLogger()); |
|
1078
|
|
- $manager->registerCapability(function () use ($c) { |
|
|
1078
|
+ $manager->registerCapability(function() use ($c) { |
|
1079
|
1079
|
return new \OC\OCS\CoreCapabilities($c->getConfig()); |
|
1080
|
1080
|
}); |
|
1081
|
|
- $manager->registerCapability(function () use ($c) { |
|
|
1081
|
+ $manager->registerCapability(function() use ($c) { |
|
1082
|
1082
|
return $c->query(\OC\Security\Bruteforce\Capabilities::class); |
|
1083
|
1083
|
}); |
|
1084
|
1084
|
return $manager; |
|
1085
|
1085
|
}); |
|
1086
|
1086
|
$this->registerDeprecatedAlias('CapabilitiesManager', CapabilitiesManager::class); |
|
1087
|
1087
|
|
|
1088
|
|
- $this->registerService(ICommentsManager::class, function (Server $c) { |
|
|
1088
|
+ $this->registerService(ICommentsManager::class, function(Server $c) { |
|
1089
|
1089
|
$config = $c->getConfig(); |
|
1090
|
1090
|
$factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class); |
|
1091
|
1091
|
/** @var \OCP\Comments\ICommentsManagerFactory $factory */ |
|
1092
|
1092
|
$factory = new $factoryClass($this); |
|
1093
|
1093
|
$manager = $factory->getManager(); |
|
1094
|
1094
|
|
|
1095
|
|
- $manager->registerDisplayNameResolver('user', function ($id) use ($c) { |
|
|
1095
|
+ $manager->registerDisplayNameResolver('user', function($id) use ($c) { |
|
1096
|
1096
|
$manager = $c->getUserManager(); |
|
1097
|
1097
|
$user = $manager->get($id); |
|
1098
|
1098
|
if (is_null($user)) { |
|
@@ -1108,7 +1108,7 @@ discard block |
|
|
block discarded – undo |
|
1108
|
1108
|
}); |
|
1109
|
1109
|
$this->registerDeprecatedAlias('CommentsManager', ICommentsManager::class); |
|
1110
|
1110
|
|
|
1111
|
|
- $this->registerService('ThemingDefaults', function (Server $c) { |
|
|
1111
|
+ $this->registerService('ThemingDefaults', function(Server $c) { |
|
1112
|
1112
|
/* |
|
1113
|
1113
|
* Dark magic for autoloader. |
|
1114
|
1114
|
* If we do a class_exists it will try to load the class which will |
|
@@ -1136,7 +1136,7 @@ discard block |
|
|
block discarded – undo |
|
1136
|
1136
|
} |
|
1137
|
1137
|
return new \OC_Defaults(); |
|
1138
|
1138
|
}); |
|
1139
|
|
- $this->registerService(SCSSCacher::class, function (Server $c) { |
|
|
1139
|
+ $this->registerService(SCSSCacher::class, function(Server $c) { |
|
1140
|
1140
|
return new SCSSCacher( |
|
1141
|
1141
|
$c->getLogger(), |
|
1142
|
1142
|
$c->query(\OC\Files\AppData\Factory::class), |
|
@@ -1149,7 +1149,7 @@ discard block |
|
|
block discarded – undo |
|
1149
|
1149
|
new TimeFactory() |
|
1150
|
1150
|
); |
|
1151
|
1151
|
}); |
|
1152
|
|
- $this->registerService(JSCombiner::class, function (Server $c) { |
|
|
1152
|
+ $this->registerService(JSCombiner::class, function(Server $c) { |
|
1153
|
1153
|
return new JSCombiner( |
|
1154
|
1154
|
$c->getAppDataDir('js'), |
|
1155
|
1155
|
$c->getURLGenerator(), |
|
@@ -1162,7 +1162,7 @@ discard block |
|
|
block discarded – undo |
|
1162
|
1162
|
$this->registerDeprecatedAlias('EventDispatcher', \OC\EventDispatcher\SymfonyAdapter::class); |
|
1163
|
1163
|
$this->registerAlias(EventDispatcherInterface::class, \OC\EventDispatcher\SymfonyAdapter::class); |
|
1164
|
1164
|
|
|
1165
|
|
- $this->registerService('CryptoWrapper', function (Server $c) { |
|
|
1165
|
+ $this->registerService('CryptoWrapper', function(Server $c) { |
|
1166
|
1166
|
// FIXME: Instantiiated here due to cyclic dependency |
|
1167
|
1167
|
$request = new Request( |
|
1168
|
1168
|
[ |
|
@@ -1187,7 +1187,7 @@ discard block |
|
|
block discarded – undo |
|
1187
|
1187
|
$request |
|
1188
|
1188
|
); |
|
1189
|
1189
|
}); |
|
1190
|
|
- $this->registerService(CsrfTokenManager::class, function (Server $c) { |
|
|
1190
|
+ $this->registerService(CsrfTokenManager::class, function(Server $c) { |
|
1191
|
1191
|
$tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom()); |
|
1192
|
1192
|
|
|
1193
|
1193
|
return new CsrfTokenManager( |
|
@@ -1196,20 +1196,20 @@ discard block |
|
|
block discarded – undo |
|
1196
|
1196
|
); |
|
1197
|
1197
|
}); |
|
1198
|
1198
|
$this->registerDeprecatedAlias('CsrfTokenManager', CsrfTokenManager::class); |
|
1199
|
|
- $this->registerService(SessionStorage::class, function (Server $c) { |
|
|
1199
|
+ $this->registerService(SessionStorage::class, function(Server $c) { |
|
1200
|
1200
|
return new SessionStorage($c->getSession()); |
|
1201
|
1201
|
}); |
|
1202
|
1202
|
$this->registerAlias(\OCP\Security\IContentSecurityPolicyManager::class, ContentSecurityPolicyManager::class); |
|
1203
|
1203
|
$this->registerDeprecatedAlias('ContentSecurityPolicyManager', ContentSecurityPolicyManager::class); |
|
1204
|
1204
|
|
|
1205
|
|
- $this->registerService('ContentSecurityPolicyNonceManager', function (Server $c) { |
|
|
1205
|
+ $this->registerService('ContentSecurityPolicyNonceManager', function(Server $c) { |
|
1206
|
1206
|
return new ContentSecurityPolicyNonceManager( |
|
1207
|
1207
|
$c->getCsrfTokenManager(), |
|
1208
|
1208
|
$c->getRequest() |
|
1209
|
1209
|
); |
|
1210
|
1210
|
}); |
|
1211
|
1211
|
|
|
1212
|
|
- $this->registerService(\OCP\Share\IManager::class, function (Server $c) { |
|
|
1212
|
+ $this->registerService(\OCP\Share\IManager::class, function(Server $c) { |
|
1213
|
1213
|
$config = $c->getConfig(); |
|
1214
|
1214
|
$factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class); |
|
1215
|
1215
|
/** @var \OCP\Share\IProviderFactory $factory */ |
|
@@ -1238,7 +1238,7 @@ discard block |
|
|
block discarded – undo |
|
1238
|
1238
|
}); |
|
1239
|
1239
|
$this->registerDeprecatedAlias('ShareManager', \OCP\Share\IManager::class); |
|
1240
|
1240
|
|
|
1241
|
|
- $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function (Server $c) { |
|
|
1241
|
+ $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function(Server $c) { |
|
1242
|
1242
|
$instance = new Collaboration\Collaborators\Search($c); |
|
1243
|
1243
|
|
|
1244
|
1244
|
// register default plugins |
|
@@ -1258,7 +1258,7 @@ discard block |
|
|
block discarded – undo |
|
1258
|
1258
|
$this->registerAlias(\OCP\Collaboration\Resources\IProviderManager::class, \OC\Collaboration\Resources\ProviderManager::class); |
|
1259
|
1259
|
$this->registerAlias(\OCP\Collaboration\Resources\IManager::class, \OC\Collaboration\Resources\Manager::class); |
|
1260
|
1260
|
|
|
1261
|
|
- $this->registerService('SettingsManager', function (Server $c) { |
|
|
1261
|
+ $this->registerService('SettingsManager', function(Server $c) { |
|
1262
|
1262
|
$manager = new \OC\Settings\Manager( |
|
1263
|
1263
|
$c->getLogger(), |
|
1264
|
1264
|
$c->getL10NFactory(), |
|
@@ -1267,34 +1267,34 @@ discard block |
|
|
block discarded – undo |
|
1267
|
1267
|
); |
|
1268
|
1268
|
return $manager; |
|
1269
|
1269
|
}); |
|
1270
|
|
- $this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) { |
|
|
1270
|
+ $this->registerService(\OC\Files\AppData\Factory::class, function(Server $c) { |
|
1271
|
1271
|
return new \OC\Files\AppData\Factory( |
|
1272
|
1272
|
$c->getRootFolder(), |
|
1273
|
1273
|
$c->getSystemConfig() |
|
1274
|
1274
|
); |
|
1275
|
1275
|
}); |
|
1276
|
1276
|
|
|
1277
|
|
- $this->registerService('LockdownManager', function (Server $c) { |
|
1278
|
|
- return new LockdownManager(function () use ($c) { |
|
|
1277
|
+ $this->registerService('LockdownManager', function(Server $c) { |
|
|
1278
|
+ return new LockdownManager(function() use ($c) { |
|
1279
|
1279
|
return $c->getSession(); |
|
1280
|
1280
|
}); |
|
1281
|
1281
|
}); |
|
1282
|
1282
|
|
|
1283
|
|
- $this->registerService(\OCP\OCS\IDiscoveryService::class, function (Server $c) { |
|
|
1283
|
+ $this->registerService(\OCP\OCS\IDiscoveryService::class, function(Server $c) { |
|
1284
|
1284
|
return new DiscoveryService($c->getMemCacheFactory(), $c->getHTTPClientService()); |
|
1285
|
1285
|
}); |
|
1286
|
1286
|
|
|
1287
|
|
- $this->registerService(ICloudIdManager::class, function (Server $c) { |
|
|
1287
|
+ $this->registerService(ICloudIdManager::class, function(Server $c) { |
|
1288
|
1288
|
return new CloudIdManager(); |
|
1289
|
1289
|
}); |
|
1290
|
1290
|
|
|
1291
|
1291
|
$this->registerAlias(\OCP\GlobalScale\IConfig::class, \OC\GlobalScale\Config::class); |
|
1292
|
1292
|
|
|
1293
|
|
- $this->registerService(ICloudFederationProviderManager::class, function (Server $c) { |
|
|
1293
|
+ $this->registerService(ICloudFederationProviderManager::class, function(Server $c) { |
|
1294
|
1294
|
return new CloudFederationProviderManager($c->getAppManager(), $c->getHTTPClientService(), $c->getCloudIdManager(), $c->getLogger()); |
|
1295
|
1295
|
}); |
|
1296
|
1296
|
|
|
1297
|
|
- $this->registerService(ICloudFederationFactory::class, function (Server $c) { |
|
|
1297
|
+ $this->registerService(ICloudFederationFactory::class, function(Server $c) { |
|
1298
|
1298
|
return new CloudFederationFactory(); |
|
1299
|
1299
|
}); |
|
1300
|
1300
|
|
|
@@ -1304,24 +1304,24 @@ discard block |
|
|
block discarded – undo |
|
1304
|
1304
|
$this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class); |
|
1305
|
1305
|
$this->registerDeprecatedAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class); |
|
1306
|
1306
|
|
|
1307
|
|
- $this->registerService(Defaults::class, function (Server $c) { |
|
|
1307
|
+ $this->registerService(Defaults::class, function(Server $c) { |
|
1308
|
1308
|
return new Defaults( |
|
1309
|
1309
|
$c->getThemingDefaults() |
|
1310
|
1310
|
); |
|
1311
|
1311
|
}); |
|
1312
|
1312
|
$this->registerDeprecatedAlias('Defaults', \OCP\Defaults::class); |
|
1313
|
1313
|
|
|
1314
|
|
- $this->registerService(\OCP\ISession::class, function (SimpleContainer $c) { |
|
|
1314
|
+ $this->registerService(\OCP\ISession::class, function(SimpleContainer $c) { |
|
1315
|
1315
|
return $c->query(\OCP\IUserSession::class)->getSession(); |
|
1316
|
1316
|
}); |
|
1317
|
1317
|
|
|
1318
|
|
- $this->registerService(IShareHelper::class, function (Server $c) { |
|
|
1318
|
+ $this->registerService(IShareHelper::class, function(Server $c) { |
|
1319
|
1319
|
return new ShareHelper( |
|
1320
|
1320
|
$c->query(\OCP\Share\IManager::class) |
|
1321
|
1321
|
); |
|
1322
|
1322
|
}); |
|
1323
|
1323
|
|
|
1324
|
|
- $this->registerService(Installer::class, function (Server $c) { |
|
|
1324
|
+ $this->registerService(Installer::class, function(Server $c) { |
|
1325
|
1325
|
return new Installer( |
|
1326
|
1326
|
$c->getAppFetcher(), |
|
1327
|
1327
|
$c->getHTTPClientService(), |
|
@@ -1332,16 +1332,16 @@ discard block |
|
|
block discarded – undo |
|
1332
|
1332
|
); |
|
1333
|
1333
|
}); |
|
1334
|
1334
|
|
|
1335
|
|
- $this->registerService(IApiFactory::class, function (Server $c) { |
|
|
1335
|
+ $this->registerService(IApiFactory::class, function(Server $c) { |
|
1336
|
1336
|
return new ApiFactory($c->getHTTPClientService()); |
|
1337
|
1337
|
}); |
|
1338
|
1338
|
|
|
1339
|
|
- $this->registerService(IInstanceFactory::class, function (Server $c) { |
|
|
1339
|
+ $this->registerService(IInstanceFactory::class, function(Server $c) { |
|
1340
|
1340
|
$memcacheFactory = $c->getMemCacheFactory(); |
|
1341
|
1341
|
return new InstanceFactory($memcacheFactory->createLocal('remoteinstance.'), $c->getHTTPClientService()); |
|
1342
|
1342
|
}); |
|
1343
|
1343
|
|
|
1344
|
|
- $this->registerService(IContactsStore::class, function (Server $c) { |
|
|
1344
|
+ $this->registerService(IContactsStore::class, function(Server $c) { |
|
1345
|
1345
|
return new ContactsStore( |
|
1346
|
1346
|
$c->getContactsManager(), |
|
1347
|
1347
|
$c->getConfig(), |
|
@@ -1352,7 +1352,7 @@ discard block |
|
|
block discarded – undo |
|
1352
|
1352
|
$this->registerAlias(IContactsStore::class, ContactsStore::class); |
|
1353
|
1353
|
$this->registerAlias(IAccountManager::class, AccountManager::class); |
|
1354
|
1354
|
|
|
1355
|
|
- $this->registerService(IStorageFactory::class, function () { |
|
|
1355
|
+ $this->registerService(IStorageFactory::class, function() { |
|
1356
|
1356
|
return new StorageFactory(); |
|
1357
|
1357
|
}); |
|
1358
|
1358
|
|
|
@@ -1397,7 +1397,7 @@ discard block |
|
|
block discarded – undo |
|
1397
|
1397
|
$dispatcher = $this->getEventDispatcher(); |
|
1398
|
1398
|
|
|
1399
|
1399
|
// Delete avatar on user deletion |
|
1400
|
|
- $dispatcher->addListener('OCP\IUser::preDelete', function (GenericEvent $e) { |
|
|
1400
|
+ $dispatcher->addListener('OCP\IUser::preDelete', function(GenericEvent $e) { |
|
1401
|
1401
|
$logger = $this->getLogger(); |
|
1402
|
1402
|
$manager = $this->getAvatarManager(); |
|
1403
|
1403
|
/** @var IUser $user */ |
|
@@ -1410,11 +1410,11 @@ discard block |
|
|
block discarded – undo |
|
1410
|
1410
|
// no avatar to remove |
|
1411
|
1411
|
} catch (\Exception $e) { |
|
1412
|
1412
|
// Ignore exceptions |
|
1413
|
|
- $logger->info('Could not cleanup avatar of ' . $user->getUID()); |
|
|
1413
|
+ $logger->info('Could not cleanup avatar of '.$user->getUID()); |
|
1414
|
1414
|
} |
|
1415
|
1415
|
}); |
|
1416
|
1416
|
|
|
1417
|
|
- $dispatcher->addListener('OCP\IUser::changeUser', function (GenericEvent $e) { |
|
|
1417
|
+ $dispatcher->addListener('OCP\IUser::changeUser', function(GenericEvent $e) { |
|
1418
|
1418
|
$manager = $this->getAvatarManager(); |
|
1419
|
1419
|
/** @var IUser $user */ |
|
1420
|
1420
|
$user = $e->getSubject(); |
|
@@ -2231,11 +2231,11 @@ discard block |
|
|
block discarded – undo |
|
2231
|
2231
|
} |
|
2232
|
2232
|
|
|
2233
|
2233
|
private function registerDeprecatedAlias(string $alias, string $target) { |
|
2234
|
|
- $this->registerService($alias, function (IContainer $container) use ($target, $alias) { |
|
|
2234
|
+ $this->registerService($alias, function(IContainer $container) use ($target, $alias) { |
|
2235
|
2235
|
try { |
|
2236
|
2236
|
/** @var ILogger $logger */ |
|
2237
|
2237
|
$logger = $container->query(ILogger::class); |
|
2238
|
|
- $logger->debug('The requested alias "' . $alias . '" is depreacted. Please request "' . $target . '" directly. This alias will be removed in a future Nextcloud version.', ['app' => 'serverDI']); |
|
|
2238
|
+ $logger->debug('The requested alias "'.$alias.'" is depreacted. Please request "'.$target.'" directly. This alias will be removed in a future Nextcloud version.', ['app' => 'serverDI']); |
|
2239
|
2239
|
} catch (QueryException $e) { |
|
2240
|
2240
|
// Could not get logger. Continue |
|
2241
|
2241
|
} |