@@ -28,13 +28,13 @@ |
||
28 | 28 | |
29 | 29 | class Application extends App { |
30 | 30 | |
31 | - public function __construct (array $urlParams = array()) { |
|
32 | - parent::__construct('comments', $urlParams); |
|
33 | - $container = $this->getContainer(); |
|
31 | + public function __construct (array $urlParams = array()) { |
|
32 | + parent::__construct('comments', $urlParams); |
|
33 | + $container = $this->getContainer(); |
|
34 | 34 | |
35 | - $container->registerAlias('NotificationsController', Notifications::class); |
|
35 | + $container->registerAlias('NotificationsController', Notifications::class); |
|
36 | 36 | |
37 | - $jsSettingsHelper = new JSSettingsHelper($container->getServer()); |
|
38 | - Util::connectHook('\OCP\Config', 'js', $jsSettingsHelper, 'extend'); |
|
39 | - } |
|
37 | + $jsSettingsHelper = new JSSettingsHelper($container->getServer()); |
|
38 | + Util::connectHook('\OCP\Config', 'js', $jsSettingsHelper, 'extend'); |
|
39 | + } |
|
40 | 40 | } |
@@ -27,19 +27,19 @@ |
||
27 | 27 | use OCP\IServerContainer; |
28 | 28 | |
29 | 29 | class JSSettingsHelper { |
30 | - /** @var IServerContainer */ |
|
31 | - private $c; |
|
30 | + /** @var IServerContainer */ |
|
31 | + private $c; |
|
32 | 32 | |
33 | - public function __construct(IServerContainer $c) { |
|
34 | - $this->c = $c; |
|
35 | - } |
|
33 | + public function __construct(IServerContainer $c) { |
|
34 | + $this->c = $c; |
|
35 | + } |
|
36 | 36 | |
37 | - public function extend(array $settings) { |
|
38 | - $appConfig = json_decode($settings['array']['oc_appconfig'], true); |
|
37 | + public function extend(array $settings) { |
|
38 | + $appConfig = json_decode($settings['array']['oc_appconfig'], true); |
|
39 | 39 | |
40 | - $value = (int)$this->c->getConfig()->getAppValue('comments', 'maxAutoCompleteResults', 10); |
|
41 | - $appConfig['comments']['maxAutoCompleteResults'] = $value; |
|
40 | + $value = (int)$this->c->getConfig()->getAppValue('comments', 'maxAutoCompleteResults', 10); |
|
41 | + $appConfig['comments']['maxAutoCompleteResults'] = $value; |
|
42 | 42 | |
43 | - $settings['array']['oc_appconfig'] = json_encode($appConfig); |
|
44 | - } |
|
43 | + $settings['array']['oc_appconfig'] = json_encode($appConfig); |
|
44 | + } |
|
45 | 45 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | public function extend(array $settings) { |
38 | 38 | $appConfig = json_decode($settings['array']['oc_appconfig'], true); |
39 | 39 | |
40 | - $value = (int)$this->c->getConfig()->getAppValue('comments', 'maxAutoCompleteResults', 10); |
|
40 | + $value = (int) $this->c->getConfig()->getAppValue('comments', 'maxAutoCompleteResults', 10); |
|
41 | 41 | $appConfig['comments']['maxAutoCompleteResults'] = $value; |
42 | 42 | |
43 | 43 | $settings['array']['oc_appconfig'] = json_encode($appConfig); |
@@ -33,78 +33,78 @@ |
||
33 | 33 | |
34 | 34 | class ShareRecipientSorter implements ISorter { |
35 | 35 | |
36 | - /** @var IManager */ |
|
37 | - private $shareManager; |
|
38 | - /** @var Folder */ |
|
39 | - private $rootFolder; |
|
40 | - /** @var IUserSession */ |
|
41 | - private $userSession; |
|
36 | + /** @var IManager */ |
|
37 | + private $shareManager; |
|
38 | + /** @var Folder */ |
|
39 | + private $rootFolder; |
|
40 | + /** @var IUserSession */ |
|
41 | + private $userSession; |
|
42 | 42 | |
43 | - public function __construct(IManager $shareManager, IRootFolder $rootFolder, IUserSession $userSession) { |
|
44 | - $this->shareManager = $shareManager; |
|
45 | - $this->rootFolder = $rootFolder; |
|
46 | - $this->userSession = $userSession; |
|
47 | - } |
|
43 | + public function __construct(IManager $shareManager, IRootFolder $rootFolder, IUserSession $userSession) { |
|
44 | + $this->shareManager = $shareManager; |
|
45 | + $this->rootFolder = $rootFolder; |
|
46 | + $this->userSession = $userSession; |
|
47 | + } |
|
48 | 48 | |
49 | - public function getId() { |
|
50 | - return 'share-recipients'; |
|
51 | - } |
|
49 | + public function getId() { |
|
50 | + return 'share-recipients'; |
|
51 | + } |
|
52 | 52 | |
53 | - public function sort(array &$sortArray, array $context) { |
|
54 | - // let's be tolerant. Comments uses "files" by default, other usages are often singular |
|
55 | - if($context['itemType'] !== 'files' && $context['itemType'] !== 'file') { |
|
56 | - return; |
|
57 | - } |
|
58 | - $user = $this->userSession->getUser(); |
|
59 | - if($user === null) { |
|
60 | - return; |
|
61 | - } |
|
62 | - $userFolder = $this->rootFolder->getUserFolder($user->getUID()); |
|
63 | - /** @var Node[] $nodes */ |
|
64 | - $nodes = $userFolder->getById((int)$context['itemId']); |
|
65 | - if(count($nodes) === 0) { |
|
66 | - return; |
|
67 | - } |
|
68 | - $al = $this->shareManager->getAccessList($nodes[0]); |
|
53 | + public function sort(array &$sortArray, array $context) { |
|
54 | + // let's be tolerant. Comments uses "files" by default, other usages are often singular |
|
55 | + if($context['itemType'] !== 'files' && $context['itemType'] !== 'file') { |
|
56 | + return; |
|
57 | + } |
|
58 | + $user = $this->userSession->getUser(); |
|
59 | + if($user === null) { |
|
60 | + return; |
|
61 | + } |
|
62 | + $userFolder = $this->rootFolder->getUserFolder($user->getUID()); |
|
63 | + /** @var Node[] $nodes */ |
|
64 | + $nodes = $userFolder->getById((int)$context['itemId']); |
|
65 | + if(count($nodes) === 0) { |
|
66 | + return; |
|
67 | + } |
|
68 | + $al = $this->shareManager->getAccessList($nodes[0]); |
|
69 | 69 | |
70 | - foreach ($sortArray as $type => &$byType) { |
|
71 | - if(!isset($al[$type]) || !is_array($al[$type])) { |
|
72 | - continue; |
|
73 | - } |
|
70 | + foreach ($sortArray as $type => &$byType) { |
|
71 | + if(!isset($al[$type]) || !is_array($al[$type])) { |
|
72 | + continue; |
|
73 | + } |
|
74 | 74 | |
75 | - // at least on PHP 5.6 usort turned out to be not stable. So we add |
|
76 | - // the current index to the value and compare it on a draw |
|
77 | - $i = 0; |
|
78 | - $workArray = array_map(function($element) use (&$i) { |
|
79 | - return [$i++, $element]; |
|
80 | - }, $byType); |
|
75 | + // at least on PHP 5.6 usort turned out to be not stable. So we add |
|
76 | + // the current index to the value and compare it on a draw |
|
77 | + $i = 0; |
|
78 | + $workArray = array_map(function($element) use (&$i) { |
|
79 | + return [$i++, $element]; |
|
80 | + }, $byType); |
|
81 | 81 | |
82 | - usort($workArray, function ($a, $b) use ($al, $type) { |
|
83 | - $result = $this->compare($a[1], $b[1], $al[$type]); |
|
84 | - if($result === 0) { |
|
85 | - $result = $a[0] - $b[0]; |
|
86 | - } |
|
87 | - return $result; |
|
88 | - }); |
|
82 | + usort($workArray, function ($a, $b) use ($al, $type) { |
|
83 | + $result = $this->compare($a[1], $b[1], $al[$type]); |
|
84 | + if($result === 0) { |
|
85 | + $result = $a[0] - $b[0]; |
|
86 | + } |
|
87 | + return $result; |
|
88 | + }); |
|
89 | 89 | |
90 | - // and remove the index values again |
|
91 | - $byType = array_column($workArray, 1); |
|
92 | - } |
|
93 | - } |
|
90 | + // and remove the index values again |
|
91 | + $byType = array_column($workArray, 1); |
|
92 | + } |
|
93 | + } |
|
94 | 94 | |
95 | - /** |
|
96 | - * @param array $a |
|
97 | - * @param array $b |
|
98 | - * @param array $al |
|
99 | - * @return int |
|
100 | - */ |
|
101 | - protected function compare(array $a, array $b, array $al) { |
|
102 | - $a = $a['value']['shareWith']; |
|
103 | - $b = $b['value']['shareWith']; |
|
95 | + /** |
|
96 | + * @param array $a |
|
97 | + * @param array $b |
|
98 | + * @param array $al |
|
99 | + * @return int |
|
100 | + */ |
|
101 | + protected function compare(array $a, array $b, array $al) { |
|
102 | + $a = $a['value']['shareWith']; |
|
103 | + $b = $b['value']['shareWith']; |
|
104 | 104 | |
105 | - $valueA = (int)in_array($a, $al, true); |
|
106 | - $valueB = (int)in_array($b, $al, true); |
|
105 | + $valueA = (int)in_array($a, $al, true); |
|
106 | + $valueB = (int)in_array($b, $al, true); |
|
107 | 107 | |
108 | - return $valueB - $valueA; |
|
109 | - } |
|
108 | + return $valueB - $valueA; |
|
109 | + } |
|
110 | 110 | } |
@@ -52,23 +52,23 @@ discard block |
||
52 | 52 | |
53 | 53 | public function sort(array &$sortArray, array $context) { |
54 | 54 | // let's be tolerant. Comments uses "files" by default, other usages are often singular |
55 | - if($context['itemType'] !== 'files' && $context['itemType'] !== 'file') { |
|
55 | + if ($context['itemType'] !== 'files' && $context['itemType'] !== 'file') { |
|
56 | 56 | return; |
57 | 57 | } |
58 | 58 | $user = $this->userSession->getUser(); |
59 | - if($user === null) { |
|
59 | + if ($user === null) { |
|
60 | 60 | return; |
61 | 61 | } |
62 | 62 | $userFolder = $this->rootFolder->getUserFolder($user->getUID()); |
63 | 63 | /** @var Node[] $nodes */ |
64 | - $nodes = $userFolder->getById((int)$context['itemId']); |
|
65 | - if(count($nodes) === 0) { |
|
64 | + $nodes = $userFolder->getById((int) $context['itemId']); |
|
65 | + if (count($nodes) === 0) { |
|
66 | 66 | return; |
67 | 67 | } |
68 | 68 | $al = $this->shareManager->getAccessList($nodes[0]); |
69 | 69 | |
70 | 70 | foreach ($sortArray as $type => &$byType) { |
71 | - if(!isset($al[$type]) || !is_array($al[$type])) { |
|
71 | + if (!isset($al[$type]) || !is_array($al[$type])) { |
|
72 | 72 | continue; |
73 | 73 | } |
74 | 74 | |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | return [$i++, $element]; |
80 | 80 | }, $byType); |
81 | 81 | |
82 | - usort($workArray, function ($a, $b) use ($al, $type) { |
|
82 | + usort($workArray, function($a, $b) use ($al, $type) { |
|
83 | 83 | $result = $this->compare($a[1], $b[1], $al[$type]); |
84 | - if($result === 0) { |
|
84 | + if ($result === 0) { |
|
85 | 85 | $result = $a[0] - $b[0]; |
86 | 86 | } |
87 | 87 | return $result; |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | $a = $a['value']['shareWith']; |
103 | 103 | $b = $b['value']['shareWith']; |
104 | 104 | |
105 | - $valueA = (int)in_array($a, $al, true); |
|
106 | - $valueB = (int)in_array($b, $al, true); |
|
105 | + $valueA = (int) in_array($a, $al, true); |
|
106 | + $valueB = (int) in_array($b, $al, true); |
|
107 | 107 | |
108 | 108 | return $valueB - $valueA; |
109 | 109 | } |
@@ -29,87 +29,87 @@ |
||
29 | 29 | |
30 | 30 | class CommentersSorter implements ISorter { |
31 | 31 | |
32 | - /** @var ICommentsManager */ |
|
33 | - private $commentsManager; |
|
34 | - |
|
35 | - public function __construct(ICommentsManager $commentsManager) { |
|
36 | - $this->commentsManager = $commentsManager; |
|
37 | - } |
|
38 | - |
|
39 | - public function getId() { |
|
40 | - return 'commenters'; |
|
41 | - } |
|
42 | - |
|
43 | - /** |
|
44 | - * Sorts people who commented on the given item atop (descelating) of the |
|
45 | - * others |
|
46 | - * |
|
47 | - * @param array $sortArray |
|
48 | - * @param array $context |
|
49 | - */ |
|
50 | - public function sort(array &$sortArray, array $context) { |
|
51 | - $commenters = $this->retrieveCommentsInformation($context['itemType'], $context['itemId']); |
|
52 | - if(count($commenters) === 0) { |
|
53 | - return; |
|
54 | - } |
|
55 | - |
|
56 | - foreach ($sortArray as $type => &$byType) { |
|
57 | - if(!isset($commenters[$type])) { |
|
58 | - continue; |
|
59 | - } |
|
60 | - |
|
61 | - // at least on PHP 5.6 usort turned out to be not stable. So we add |
|
62 | - // the current index to the value and compare it on a draw |
|
63 | - $i = 0; |
|
64 | - $workArray = array_map(function($element) use (&$i) { |
|
65 | - return [$i++, $element]; |
|
66 | - }, $byType); |
|
67 | - |
|
68 | - usort($workArray, function ($a, $b) use ($commenters, $type) { |
|
69 | - $r = $this->compare($a[1], $b[1], $commenters[$type]); |
|
70 | - if($r === 0) { |
|
71 | - $r = $a[0] - $b[0]; |
|
72 | - } |
|
73 | - return $r; |
|
74 | - }); |
|
75 | - |
|
76 | - // and remove the index values again |
|
77 | - $byType = array_column($workArray, 1); |
|
78 | - } |
|
79 | - } |
|
80 | - |
|
81 | - /** |
|
82 | - * @param $type |
|
83 | - * @param $id |
|
84 | - * @return array |
|
85 | - */ |
|
86 | - protected function retrieveCommentsInformation($type, $id) { |
|
87 | - $comments = $this->commentsManager->getForObject($type, $id); |
|
88 | - if(count($comments) === 0) { |
|
89 | - return []; |
|
90 | - } |
|
91 | - |
|
92 | - $actors = []; |
|
93 | - foreach ($comments as $comment) { |
|
94 | - if(!isset($actors[$comment->getActorType()])) { |
|
95 | - $actors[$comment->getActorType()] = []; |
|
96 | - } |
|
97 | - if(!isset($actors[$comment->getActorType()][$comment->getActorId()])) { |
|
98 | - $actors[$comment->getActorType()][$comment->getActorId()] = 1; |
|
99 | - } else { |
|
100 | - $actors[$comment->getActorType()][$comment->getActorId()]++; |
|
101 | - } |
|
102 | - } |
|
103 | - return $actors; |
|
104 | - } |
|
105 | - |
|
106 | - protected function compare(array $a, array $b, array $commenters) { |
|
107 | - $a = $a['value']['shareWith']; |
|
108 | - $b = $b['value']['shareWith']; |
|
109 | - |
|
110 | - $valueA = isset($commenters[$a]) ? $commenters[$a] : 0; |
|
111 | - $valueB = isset($commenters[$b]) ? $commenters[$b] : 0; |
|
112 | - |
|
113 | - return $valueB - $valueA; |
|
114 | - } |
|
32 | + /** @var ICommentsManager */ |
|
33 | + private $commentsManager; |
|
34 | + |
|
35 | + public function __construct(ICommentsManager $commentsManager) { |
|
36 | + $this->commentsManager = $commentsManager; |
|
37 | + } |
|
38 | + |
|
39 | + public function getId() { |
|
40 | + return 'commenters'; |
|
41 | + } |
|
42 | + |
|
43 | + /** |
|
44 | + * Sorts people who commented on the given item atop (descelating) of the |
|
45 | + * others |
|
46 | + * |
|
47 | + * @param array $sortArray |
|
48 | + * @param array $context |
|
49 | + */ |
|
50 | + public function sort(array &$sortArray, array $context) { |
|
51 | + $commenters = $this->retrieveCommentsInformation($context['itemType'], $context['itemId']); |
|
52 | + if(count($commenters) === 0) { |
|
53 | + return; |
|
54 | + } |
|
55 | + |
|
56 | + foreach ($sortArray as $type => &$byType) { |
|
57 | + if(!isset($commenters[$type])) { |
|
58 | + continue; |
|
59 | + } |
|
60 | + |
|
61 | + // at least on PHP 5.6 usort turned out to be not stable. So we add |
|
62 | + // the current index to the value and compare it on a draw |
|
63 | + $i = 0; |
|
64 | + $workArray = array_map(function($element) use (&$i) { |
|
65 | + return [$i++, $element]; |
|
66 | + }, $byType); |
|
67 | + |
|
68 | + usort($workArray, function ($a, $b) use ($commenters, $type) { |
|
69 | + $r = $this->compare($a[1], $b[1], $commenters[$type]); |
|
70 | + if($r === 0) { |
|
71 | + $r = $a[0] - $b[0]; |
|
72 | + } |
|
73 | + return $r; |
|
74 | + }); |
|
75 | + |
|
76 | + // and remove the index values again |
|
77 | + $byType = array_column($workArray, 1); |
|
78 | + } |
|
79 | + } |
|
80 | + |
|
81 | + /** |
|
82 | + * @param $type |
|
83 | + * @param $id |
|
84 | + * @return array |
|
85 | + */ |
|
86 | + protected function retrieveCommentsInformation($type, $id) { |
|
87 | + $comments = $this->commentsManager->getForObject($type, $id); |
|
88 | + if(count($comments) === 0) { |
|
89 | + return []; |
|
90 | + } |
|
91 | + |
|
92 | + $actors = []; |
|
93 | + foreach ($comments as $comment) { |
|
94 | + if(!isset($actors[$comment->getActorType()])) { |
|
95 | + $actors[$comment->getActorType()] = []; |
|
96 | + } |
|
97 | + if(!isset($actors[$comment->getActorType()][$comment->getActorId()])) { |
|
98 | + $actors[$comment->getActorType()][$comment->getActorId()] = 1; |
|
99 | + } else { |
|
100 | + $actors[$comment->getActorType()][$comment->getActorId()]++; |
|
101 | + } |
|
102 | + } |
|
103 | + return $actors; |
|
104 | + } |
|
105 | + |
|
106 | + protected function compare(array $a, array $b, array $commenters) { |
|
107 | + $a = $a['value']['shareWith']; |
|
108 | + $b = $b['value']['shareWith']; |
|
109 | + |
|
110 | + $valueA = isset($commenters[$a]) ? $commenters[$a] : 0; |
|
111 | + $valueB = isset($commenters[$b]) ? $commenters[$b] : 0; |
|
112 | + |
|
113 | + return $valueB - $valueA; |
|
114 | + } |
|
115 | 115 | } |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function sort(array &$sortArray, array $context) { |
51 | 51 | $commenters = $this->retrieveCommentsInformation($context['itemType'], $context['itemId']); |
52 | - if(count($commenters) === 0) { |
|
52 | + if (count($commenters) === 0) { |
|
53 | 53 | return; |
54 | 54 | } |
55 | 55 | |
56 | 56 | foreach ($sortArray as $type => &$byType) { |
57 | - if(!isset($commenters[$type])) { |
|
57 | + if (!isset($commenters[$type])) { |
|
58 | 58 | continue; |
59 | 59 | } |
60 | 60 | |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | return [$i++, $element]; |
66 | 66 | }, $byType); |
67 | 67 | |
68 | - usort($workArray, function ($a, $b) use ($commenters, $type) { |
|
68 | + usort($workArray, function($a, $b) use ($commenters, $type) { |
|
69 | 69 | $r = $this->compare($a[1], $b[1], $commenters[$type]); |
70 | - if($r === 0) { |
|
70 | + if ($r === 0) { |
|
71 | 71 | $r = $a[0] - $b[0]; |
72 | 72 | } |
73 | 73 | return $r; |
@@ -85,16 +85,16 @@ discard block |
||
85 | 85 | */ |
86 | 86 | protected function retrieveCommentsInformation($type, $id) { |
87 | 87 | $comments = $this->commentsManager->getForObject($type, $id); |
88 | - if(count($comments) === 0) { |
|
88 | + if (count($comments) === 0) { |
|
89 | 89 | return []; |
90 | 90 | } |
91 | 91 | |
92 | 92 | $actors = []; |
93 | 93 | foreach ($comments as $comment) { |
94 | - if(!isset($actors[$comment->getActorType()])) { |
|
94 | + if (!isset($actors[$comment->getActorType()])) { |
|
95 | 95 | $actors[$comment->getActorType()] = []; |
96 | 96 | } |
97 | - if(!isset($actors[$comment->getActorType()][$comment->getActorId()])) { |
|
97 | + if (!isset($actors[$comment->getActorType()][$comment->getActorId()])) { |
|
98 | 98 | $actors[$comment->getActorType()][$comment->getActorId()] = 1; |
99 | 99 | } else { |
100 | 100 | $actors[$comment->getActorType()][$comment->getActorId()]++; |
@@ -103,7 +103,6 @@ |
||
103 | 103 | use OC\Tagging\TagMapper; |
104 | 104 | use OC\Template\SCSSCacher; |
105 | 105 | use OCA\Theming\ThemingDefaults; |
106 | - |
|
107 | 106 | use OCP\App\IAppManager; |
108 | 107 | use OCP\AppFramework\Utility\ITimeFactory; |
109 | 108 | use OCP\Collaboration\AutoComplete\IManager; |
@@ -133,1720 +133,1720 @@ |
||
133 | 133 | * TODO: hookup all manager classes |
134 | 134 | */ |
135 | 135 | class Server extends ServerContainer implements IServerContainer { |
136 | - /** @var string */ |
|
137 | - private $webRoot; |
|
138 | - |
|
139 | - /** |
|
140 | - * @param string $webRoot |
|
141 | - * @param \OC\Config $config |
|
142 | - */ |
|
143 | - public function __construct($webRoot, \OC\Config $config) { |
|
144 | - parent::__construct(); |
|
145 | - $this->webRoot = $webRoot; |
|
146 | - |
|
147 | - $this->registerService(\OCP\IServerContainer::class, function (IServerContainer $c) { |
|
148 | - return $c; |
|
149 | - }); |
|
150 | - |
|
151 | - $this->registerAlias(\OCP\Contacts\IManager::class, \OC\ContactsManager::class); |
|
152 | - $this->registerAlias('ContactsManager', \OCP\Contacts\IManager::class); |
|
153 | - |
|
154 | - $this->registerAlias(IActionFactory::class, ActionFactory::class); |
|
155 | - |
|
156 | - |
|
157 | - $this->registerService(\OCP\IPreview::class, function (Server $c) { |
|
158 | - return new PreviewManager( |
|
159 | - $c->getConfig(), |
|
160 | - $c->getRootFolder(), |
|
161 | - $c->getAppDataDir('preview'), |
|
162 | - $c->getEventDispatcher(), |
|
163 | - $c->getSession()->get('user_id') |
|
164 | - ); |
|
165 | - }); |
|
166 | - $this->registerAlias('PreviewManager', \OCP\IPreview::class); |
|
167 | - |
|
168 | - $this->registerService(\OC\Preview\Watcher::class, function (Server $c) { |
|
169 | - return new \OC\Preview\Watcher( |
|
170 | - $c->getAppDataDir('preview') |
|
171 | - ); |
|
172 | - }); |
|
173 | - |
|
174 | - $this->registerService('EncryptionManager', function (Server $c) { |
|
175 | - $view = new View(); |
|
176 | - $util = new Encryption\Util( |
|
177 | - $view, |
|
178 | - $c->getUserManager(), |
|
179 | - $c->getGroupManager(), |
|
180 | - $c->getConfig() |
|
181 | - ); |
|
182 | - return new Encryption\Manager( |
|
183 | - $c->getConfig(), |
|
184 | - $c->getLogger(), |
|
185 | - $c->getL10N('core'), |
|
186 | - new View(), |
|
187 | - $util, |
|
188 | - new ArrayCache() |
|
189 | - ); |
|
190 | - }); |
|
191 | - |
|
192 | - $this->registerService('EncryptionFileHelper', function (Server $c) { |
|
193 | - $util = new Encryption\Util( |
|
194 | - new View(), |
|
195 | - $c->getUserManager(), |
|
196 | - $c->getGroupManager(), |
|
197 | - $c->getConfig() |
|
198 | - ); |
|
199 | - return new Encryption\File( |
|
200 | - $util, |
|
201 | - $c->getRootFolder(), |
|
202 | - $c->getShareManager() |
|
203 | - ); |
|
204 | - }); |
|
205 | - |
|
206 | - $this->registerService('EncryptionKeyStorage', function (Server $c) { |
|
207 | - $view = new View(); |
|
208 | - $util = new Encryption\Util( |
|
209 | - $view, |
|
210 | - $c->getUserManager(), |
|
211 | - $c->getGroupManager(), |
|
212 | - $c->getConfig() |
|
213 | - ); |
|
214 | - |
|
215 | - return new Encryption\Keys\Storage($view, $util); |
|
216 | - }); |
|
217 | - $this->registerService('TagMapper', function (Server $c) { |
|
218 | - return new TagMapper($c->getDatabaseConnection()); |
|
219 | - }); |
|
220 | - |
|
221 | - $this->registerService(\OCP\ITagManager::class, function (Server $c) { |
|
222 | - $tagMapper = $c->query('TagMapper'); |
|
223 | - return new TagManager($tagMapper, $c->getUserSession()); |
|
224 | - }); |
|
225 | - $this->registerAlias('TagManager', \OCP\ITagManager::class); |
|
226 | - |
|
227 | - $this->registerService('SystemTagManagerFactory', function (Server $c) { |
|
228 | - $config = $c->getConfig(); |
|
229 | - $factoryClass = $config->getSystemValue('systemtags.managerFactory', '\OC\SystemTag\ManagerFactory'); |
|
230 | - /** @var \OC\SystemTag\ManagerFactory $factory */ |
|
231 | - $factory = new $factoryClass($this); |
|
232 | - return $factory; |
|
233 | - }); |
|
234 | - $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) { |
|
235 | - return $c->query('SystemTagManagerFactory')->getManager(); |
|
236 | - }); |
|
237 | - $this->registerAlias('SystemTagManager', \OCP\SystemTag\ISystemTagManager::class); |
|
238 | - |
|
239 | - $this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function (Server $c) { |
|
240 | - return $c->query('SystemTagManagerFactory')->getObjectMapper(); |
|
241 | - }); |
|
242 | - $this->registerService('RootFolder', function (Server $c) { |
|
243 | - $manager = \OC\Files\Filesystem::getMountManager(null); |
|
244 | - $view = new View(); |
|
245 | - $root = new Root( |
|
246 | - $manager, |
|
247 | - $view, |
|
248 | - null, |
|
249 | - $c->getUserMountCache(), |
|
250 | - $this->getLogger(), |
|
251 | - $this->getUserManager() |
|
252 | - ); |
|
253 | - $connector = new HookConnector($root, $view); |
|
254 | - $connector->viewToNode(); |
|
255 | - |
|
256 | - $previewConnector = new \OC\Preview\WatcherConnector($root, $c->getSystemConfig()); |
|
257 | - $previewConnector->connectWatcher(); |
|
258 | - |
|
259 | - return $root; |
|
260 | - }); |
|
261 | - $this->registerAlias('SystemTagObjectMapper', \OCP\SystemTag\ISystemTagObjectMapper::class); |
|
262 | - |
|
263 | - $this->registerService(\OCP\Files\IRootFolder::class, function (Server $c) { |
|
264 | - return new LazyRoot(function () use ($c) { |
|
265 | - return $c->query('RootFolder'); |
|
266 | - }); |
|
267 | - }); |
|
268 | - $this->registerAlias('LazyRootFolder', \OCP\Files\IRootFolder::class); |
|
269 | - |
|
270 | - $this->registerService(\OCP\IUserManager::class, function (Server $c) { |
|
271 | - $config = $c->getConfig(); |
|
272 | - return new \OC\User\Manager($config); |
|
273 | - }); |
|
274 | - $this->registerAlias('UserManager', \OCP\IUserManager::class); |
|
275 | - |
|
276 | - $this->registerService(\OCP\IGroupManager::class, function (Server $c) { |
|
277 | - $groupManager = new \OC\Group\Manager($this->getUserManager(), $this->getLogger()); |
|
278 | - $groupManager->listen('\OC\Group', 'preCreate', function ($gid) { |
|
279 | - \OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid)); |
|
280 | - }); |
|
281 | - $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) { |
|
282 | - \OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID())); |
|
283 | - }); |
|
284 | - $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) { |
|
285 | - \OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID())); |
|
286 | - }); |
|
287 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) { |
|
288 | - \OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID())); |
|
289 | - }); |
|
290 | - $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
291 | - \OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID())); |
|
292 | - }); |
|
293 | - $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
294 | - \OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
|
295 | - //Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks |
|
296 | - \OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
|
297 | - }); |
|
298 | - return $groupManager; |
|
299 | - }); |
|
300 | - $this->registerAlias('GroupManager', \OCP\IGroupManager::class); |
|
301 | - |
|
302 | - $this->registerService(Store::class, function (Server $c) { |
|
303 | - $session = $c->getSession(); |
|
304 | - if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
305 | - $tokenProvider = $c->query('OC\Authentication\Token\IProvider'); |
|
306 | - } else { |
|
307 | - $tokenProvider = null; |
|
308 | - } |
|
309 | - $logger = $c->getLogger(); |
|
310 | - return new Store($session, $logger, $tokenProvider); |
|
311 | - }); |
|
312 | - $this->registerAlias(IStore::class, Store::class); |
|
313 | - $this->registerService('OC\Authentication\Token\DefaultTokenMapper', function (Server $c) { |
|
314 | - $dbConnection = $c->getDatabaseConnection(); |
|
315 | - return new Authentication\Token\DefaultTokenMapper($dbConnection); |
|
316 | - }); |
|
317 | - $this->registerService('OC\Authentication\Token\DefaultTokenProvider', function (Server $c) { |
|
318 | - $mapper = $c->query('OC\Authentication\Token\DefaultTokenMapper'); |
|
319 | - $crypto = $c->getCrypto(); |
|
320 | - $config = $c->getConfig(); |
|
321 | - $logger = $c->getLogger(); |
|
322 | - $timeFactory = new TimeFactory(); |
|
323 | - return new \OC\Authentication\Token\DefaultTokenProvider($mapper, $crypto, $config, $logger, $timeFactory); |
|
324 | - }); |
|
325 | - $this->registerAlias('OC\Authentication\Token\IProvider', 'OC\Authentication\Token\DefaultTokenProvider'); |
|
326 | - |
|
327 | - $this->registerService(\OCP\IUserSession::class, function (Server $c) { |
|
328 | - $manager = $c->getUserManager(); |
|
329 | - $session = new \OC\Session\Memory(''); |
|
330 | - $timeFactory = new TimeFactory(); |
|
331 | - // Token providers might require a working database. This code |
|
332 | - // might however be called when ownCloud is not yet setup. |
|
333 | - if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
334 | - $defaultTokenProvider = $c->query('OC\Authentication\Token\IProvider'); |
|
335 | - } else { |
|
336 | - $defaultTokenProvider = null; |
|
337 | - } |
|
338 | - |
|
339 | - $userSession = new \OC\User\Session($manager, $session, $timeFactory, $defaultTokenProvider, $c->getConfig(), $c->getSecureRandom(), $c->getLockdownManager()); |
|
340 | - $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { |
|
341 | - \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password)); |
|
342 | - }); |
|
343 | - $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) { |
|
344 | - /** @var $user \OC\User\User */ |
|
345 | - \OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password)); |
|
346 | - }); |
|
347 | - $userSession->listen('\OC\User', 'preDelete', function ($user) { |
|
348 | - /** @var $user \OC\User\User */ |
|
349 | - \OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID())); |
|
350 | - }); |
|
351 | - $userSession->listen('\OC\User', 'postDelete', function ($user) { |
|
352 | - /** @var $user \OC\User\User */ |
|
353 | - \OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID())); |
|
354 | - }); |
|
355 | - $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) { |
|
356 | - /** @var $user \OC\User\User */ |
|
357 | - \OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
|
358 | - }); |
|
359 | - $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) { |
|
360 | - /** @var $user \OC\User\User */ |
|
361 | - \OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
|
362 | - }); |
|
363 | - $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) { |
|
364 | - \OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password)); |
|
365 | - }); |
|
366 | - $userSession->listen('\OC\User', 'postLogin', function ($user, $password) { |
|
367 | - /** @var $user \OC\User\User */ |
|
368 | - \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password)); |
|
369 | - }); |
|
370 | - $userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) { |
|
371 | - /** @var $user \OC\User\User */ |
|
372 | - \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password)); |
|
373 | - }); |
|
374 | - $userSession->listen('\OC\User', 'logout', function () { |
|
375 | - \OC_Hook::emit('OC_User', 'logout', array()); |
|
376 | - }); |
|
377 | - $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) { |
|
378 | - /** @var $user \OC\User\User */ |
|
379 | - \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue)); |
|
380 | - }); |
|
381 | - return $userSession; |
|
382 | - }); |
|
383 | - $this->registerAlias('UserSession', \OCP\IUserSession::class); |
|
384 | - |
|
385 | - $this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function (Server $c) { |
|
386 | - return new \OC\Authentication\TwoFactorAuth\Manager( |
|
387 | - $c->getAppManager(), |
|
388 | - $c->getSession(), |
|
389 | - $c->getConfig(), |
|
390 | - $c->getActivityManager(), |
|
391 | - $c->getLogger(), |
|
392 | - $c->query(\OC\Authentication\Token\IProvider::class), |
|
393 | - $c->query(ITimeFactory::class) |
|
394 | - ); |
|
395 | - }); |
|
396 | - |
|
397 | - $this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class); |
|
398 | - $this->registerAlias('NavigationManager', \OCP\INavigationManager::class); |
|
399 | - |
|
400 | - $this->registerService(\OC\AllConfig::class, function (Server $c) { |
|
401 | - return new \OC\AllConfig( |
|
402 | - $c->getSystemConfig() |
|
403 | - ); |
|
404 | - }); |
|
405 | - $this->registerAlias('AllConfig', \OC\AllConfig::class); |
|
406 | - $this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class); |
|
407 | - |
|
408 | - $this->registerService('SystemConfig', function ($c) use ($config) { |
|
409 | - return new \OC\SystemConfig($config); |
|
410 | - }); |
|
411 | - |
|
412 | - $this->registerService(\OC\AppConfig::class, function (Server $c) { |
|
413 | - return new \OC\AppConfig($c->getDatabaseConnection()); |
|
414 | - }); |
|
415 | - $this->registerAlias('AppConfig', \OC\AppConfig::class); |
|
416 | - $this->registerAlias(\OCP\IAppConfig::class, \OC\AppConfig::class); |
|
417 | - |
|
418 | - $this->registerService(\OCP\L10N\IFactory::class, function (Server $c) { |
|
419 | - return new \OC\L10N\Factory( |
|
420 | - $c->getConfig(), |
|
421 | - $c->getRequest(), |
|
422 | - $c->getUserSession(), |
|
423 | - \OC::$SERVERROOT |
|
424 | - ); |
|
425 | - }); |
|
426 | - $this->registerAlias('L10NFactory', \OCP\L10N\IFactory::class); |
|
427 | - |
|
428 | - $this->registerService(\OCP\IURLGenerator::class, function (Server $c) { |
|
429 | - $config = $c->getConfig(); |
|
430 | - $cacheFactory = $c->getMemCacheFactory(); |
|
431 | - $request = $c->getRequest(); |
|
432 | - return new \OC\URLGenerator( |
|
433 | - $config, |
|
434 | - $cacheFactory, |
|
435 | - $request |
|
436 | - ); |
|
437 | - }); |
|
438 | - $this->registerAlias('URLGenerator', \OCP\IURLGenerator::class); |
|
439 | - |
|
440 | - $this->registerService('AppHelper', function ($c) { |
|
441 | - return new \OC\AppHelper(); |
|
442 | - }); |
|
443 | - $this->registerAlias('AppFetcher', AppFetcher::class); |
|
444 | - $this->registerAlias('CategoryFetcher', CategoryFetcher::class); |
|
445 | - |
|
446 | - $this->registerService(\OCP\ICache::class, function ($c) { |
|
447 | - return new Cache\File(); |
|
448 | - }); |
|
449 | - $this->registerAlias('UserCache', \OCP\ICache::class); |
|
450 | - |
|
451 | - $this->registerService(Factory::class, function (Server $c) { |
|
452 | - |
|
453 | - $arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(), |
|
454 | - '\\OC\\Memcache\\ArrayCache', |
|
455 | - '\\OC\\Memcache\\ArrayCache', |
|
456 | - '\\OC\\Memcache\\ArrayCache' |
|
457 | - ); |
|
458 | - $config = $c->getConfig(); |
|
459 | - $request = $c->getRequest(); |
|
460 | - $urlGenerator = new URLGenerator($config, $arrayCacheFactory, $request); |
|
461 | - |
|
462 | - if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) { |
|
463 | - $v = \OC_App::getAppVersions(); |
|
464 | - $v['core'] = implode(',', \OC_Util::getVersion()); |
|
465 | - $version = implode(',', $v); |
|
466 | - $instanceId = \OC_Util::getInstanceId(); |
|
467 | - $path = \OC::$SERVERROOT; |
|
468 | - $prefix = md5($instanceId . '-' . $version . '-' . $path . '-' . $urlGenerator->getBaseUrl()); |
|
469 | - return new \OC\Memcache\Factory($prefix, $c->getLogger(), |
|
470 | - $config->getSystemValue('memcache.local', null), |
|
471 | - $config->getSystemValue('memcache.distributed', null), |
|
472 | - $config->getSystemValue('memcache.locking', null) |
|
473 | - ); |
|
474 | - } |
|
475 | - return $arrayCacheFactory; |
|
476 | - |
|
477 | - }); |
|
478 | - $this->registerAlias('MemCacheFactory', Factory::class); |
|
479 | - $this->registerAlias(ICacheFactory::class, Factory::class); |
|
480 | - |
|
481 | - $this->registerService('RedisFactory', function (Server $c) { |
|
482 | - $systemConfig = $c->getSystemConfig(); |
|
483 | - return new RedisFactory($systemConfig); |
|
484 | - }); |
|
485 | - |
|
486 | - $this->registerService(\OCP\Activity\IManager::class, function (Server $c) { |
|
487 | - return new \OC\Activity\Manager( |
|
488 | - $c->getRequest(), |
|
489 | - $c->getUserSession(), |
|
490 | - $c->getConfig(), |
|
491 | - $c->query(IValidator::class) |
|
492 | - ); |
|
493 | - }); |
|
494 | - $this->registerAlias('ActivityManager', \OCP\Activity\IManager::class); |
|
495 | - |
|
496 | - $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) { |
|
497 | - return new \OC\Activity\EventMerger( |
|
498 | - $c->getL10N('lib') |
|
499 | - ); |
|
500 | - }); |
|
501 | - $this->registerAlias(IValidator::class, Validator::class); |
|
502 | - |
|
503 | - $this->registerService(\OCP\IAvatarManager::class, function (Server $c) { |
|
504 | - return new AvatarManager( |
|
505 | - $c->getUserManager(), |
|
506 | - $c->getAppDataDir('avatar'), |
|
507 | - $c->getL10N('lib'), |
|
508 | - $c->getLogger(), |
|
509 | - $c->getConfig() |
|
510 | - ); |
|
511 | - }); |
|
512 | - $this->registerAlias('AvatarManager', \OCP\IAvatarManager::class); |
|
513 | - |
|
514 | - $this->registerService(\OCP\ILogger::class, function (Server $c) { |
|
515 | - $logType = $c->query('AllConfig')->getSystemValue('log_type', 'file'); |
|
516 | - $logger = Log::getLogClass($logType); |
|
517 | - call_user_func(array($logger, 'init')); |
|
518 | - |
|
519 | - return new Log($logger); |
|
520 | - }); |
|
521 | - $this->registerAlias('Logger', \OCP\ILogger::class); |
|
522 | - |
|
523 | - $this->registerService(\OCP\BackgroundJob\IJobList::class, function (Server $c) { |
|
524 | - $config = $c->getConfig(); |
|
525 | - return new \OC\BackgroundJob\JobList( |
|
526 | - $c->getDatabaseConnection(), |
|
527 | - $config, |
|
528 | - new TimeFactory() |
|
529 | - ); |
|
530 | - }); |
|
531 | - $this->registerAlias('JobList', \OCP\BackgroundJob\IJobList::class); |
|
532 | - |
|
533 | - $this->registerService(\OCP\Route\IRouter::class, function (Server $c) { |
|
534 | - $cacheFactory = $c->getMemCacheFactory(); |
|
535 | - $logger = $c->getLogger(); |
|
536 | - if ($cacheFactory->isAvailableLowLatency()) { |
|
537 | - $router = new \OC\Route\CachingRouter($cacheFactory->createLocal('route'), $logger); |
|
538 | - } else { |
|
539 | - $router = new \OC\Route\Router($logger); |
|
540 | - } |
|
541 | - return $router; |
|
542 | - }); |
|
543 | - $this->registerAlias('Router', \OCP\Route\IRouter::class); |
|
544 | - |
|
545 | - $this->registerService(\OCP\ISearch::class, function ($c) { |
|
546 | - return new Search(); |
|
547 | - }); |
|
548 | - $this->registerAlias('Search', \OCP\ISearch::class); |
|
549 | - |
|
550 | - $this->registerService(\OC\Security\RateLimiting\Limiter::class, function ($c) { |
|
551 | - return new \OC\Security\RateLimiting\Limiter( |
|
552 | - $this->getUserSession(), |
|
553 | - $this->getRequest(), |
|
554 | - new \OC\AppFramework\Utility\TimeFactory(), |
|
555 | - $c->query(\OC\Security\RateLimiting\Backend\IBackend::class) |
|
556 | - ); |
|
557 | - }); |
|
558 | - $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) { |
|
559 | - return new \OC\Security\RateLimiting\Backend\MemoryCache( |
|
560 | - $this->getMemCacheFactory(), |
|
561 | - new \OC\AppFramework\Utility\TimeFactory() |
|
562 | - ); |
|
563 | - }); |
|
564 | - |
|
565 | - $this->registerService(\OCP\Security\ISecureRandom::class, function ($c) { |
|
566 | - return new SecureRandom(); |
|
567 | - }); |
|
568 | - $this->registerAlias('SecureRandom', \OCP\Security\ISecureRandom::class); |
|
569 | - |
|
570 | - $this->registerService(\OCP\Security\ICrypto::class, function (Server $c) { |
|
571 | - return new Crypto($c->getConfig(), $c->getSecureRandom()); |
|
572 | - }); |
|
573 | - $this->registerAlias('Crypto', \OCP\Security\ICrypto::class); |
|
574 | - |
|
575 | - $this->registerService(\OCP\Security\IHasher::class, function (Server $c) { |
|
576 | - return new Hasher($c->getConfig()); |
|
577 | - }); |
|
578 | - $this->registerAlias('Hasher', \OCP\Security\IHasher::class); |
|
579 | - |
|
580 | - $this->registerService(\OCP\Security\ICredentialsManager::class, function (Server $c) { |
|
581 | - return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection()); |
|
582 | - }); |
|
583 | - $this->registerAlias('CredentialsManager', \OCP\Security\ICredentialsManager::class); |
|
584 | - |
|
585 | - $this->registerService(IDBConnection::class, function (Server $c) { |
|
586 | - $systemConfig = $c->getSystemConfig(); |
|
587 | - $factory = new \OC\DB\ConnectionFactory($systemConfig); |
|
588 | - $type = $systemConfig->getValue('dbtype', 'sqlite'); |
|
589 | - if (!$factory->isValidType($type)) { |
|
590 | - throw new \OC\DatabaseException('Invalid database type'); |
|
591 | - } |
|
592 | - $connectionParams = $factory->createConnectionParams(); |
|
593 | - $connection = $factory->getConnection($type, $connectionParams); |
|
594 | - $connection->getConfiguration()->setSQLLogger($c->getQueryLogger()); |
|
595 | - return $connection; |
|
596 | - }); |
|
597 | - $this->registerAlias('DatabaseConnection', IDBConnection::class); |
|
598 | - |
|
599 | - $this->registerService('HTTPHelper', function (Server $c) { |
|
600 | - $config = $c->getConfig(); |
|
601 | - return new HTTPHelper( |
|
602 | - $config, |
|
603 | - $c->getHTTPClientService() |
|
604 | - ); |
|
605 | - }); |
|
606 | - |
|
607 | - $this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) { |
|
608 | - $user = \OC_User::getUser(); |
|
609 | - $uid = $user ? $user : null; |
|
610 | - return new ClientService( |
|
611 | - $c->getConfig(), |
|
612 | - new \OC\Security\CertificateManager( |
|
613 | - $uid, |
|
614 | - new View(), |
|
615 | - $c->getConfig(), |
|
616 | - $c->getLogger(), |
|
617 | - $c->getSecureRandom() |
|
618 | - ) |
|
619 | - ); |
|
620 | - }); |
|
621 | - $this->registerAlias('HttpClientService', \OCP\Http\Client\IClientService::class); |
|
622 | - $this->registerService(\OCP\Diagnostics\IEventLogger::class, function (Server $c) { |
|
623 | - $eventLogger = new EventLogger(); |
|
624 | - if ($c->getSystemConfig()->getValue('debug', false)) { |
|
625 | - // In debug mode, module is being activated by default |
|
626 | - $eventLogger->activate(); |
|
627 | - } |
|
628 | - return $eventLogger; |
|
629 | - }); |
|
630 | - $this->registerAlias('EventLogger', \OCP\Diagnostics\IEventLogger::class); |
|
631 | - |
|
632 | - $this->registerService(\OCP\Diagnostics\IQueryLogger::class, function (Server $c) { |
|
633 | - $queryLogger = new QueryLogger(); |
|
634 | - if ($c->getSystemConfig()->getValue('debug', false)) { |
|
635 | - // In debug mode, module is being activated by default |
|
636 | - $queryLogger->activate(); |
|
637 | - } |
|
638 | - return $queryLogger; |
|
639 | - }); |
|
640 | - $this->registerAlias('QueryLogger', \OCP\Diagnostics\IQueryLogger::class); |
|
641 | - |
|
642 | - $this->registerService(TempManager::class, function (Server $c) { |
|
643 | - return new TempManager( |
|
644 | - $c->getLogger(), |
|
645 | - $c->getConfig() |
|
646 | - ); |
|
647 | - }); |
|
648 | - $this->registerAlias('TempManager', TempManager::class); |
|
649 | - $this->registerAlias(ITempManager::class, TempManager::class); |
|
650 | - |
|
651 | - $this->registerService(AppManager::class, function (Server $c) { |
|
652 | - return new \OC\App\AppManager( |
|
653 | - $c->getUserSession(), |
|
654 | - $c->getAppConfig(), |
|
655 | - $c->getGroupManager(), |
|
656 | - $c->getMemCacheFactory(), |
|
657 | - $c->getEventDispatcher() |
|
658 | - ); |
|
659 | - }); |
|
660 | - $this->registerAlias('AppManager', AppManager::class); |
|
661 | - $this->registerAlias(IAppManager::class, AppManager::class); |
|
662 | - |
|
663 | - $this->registerService(\OCP\IDateTimeZone::class, function (Server $c) { |
|
664 | - return new DateTimeZone( |
|
665 | - $c->getConfig(), |
|
666 | - $c->getSession() |
|
667 | - ); |
|
668 | - }); |
|
669 | - $this->registerAlias('DateTimeZone', \OCP\IDateTimeZone::class); |
|
670 | - |
|
671 | - $this->registerService(\OCP\IDateTimeFormatter::class, function (Server $c) { |
|
672 | - $language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null); |
|
673 | - |
|
674 | - return new DateTimeFormatter( |
|
675 | - $c->getDateTimeZone()->getTimeZone(), |
|
676 | - $c->getL10N('lib', $language) |
|
677 | - ); |
|
678 | - }); |
|
679 | - $this->registerAlias('DateTimeFormatter', \OCP\IDateTimeFormatter::class); |
|
680 | - |
|
681 | - $this->registerService(\OCP\Files\Config\IUserMountCache::class, function (Server $c) { |
|
682 | - $mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger()); |
|
683 | - $listener = new UserMountCacheListener($mountCache); |
|
684 | - $listener->listen($c->getUserManager()); |
|
685 | - return $mountCache; |
|
686 | - }); |
|
687 | - $this->registerAlias('UserMountCache', \OCP\Files\Config\IUserMountCache::class); |
|
688 | - |
|
689 | - $this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function (Server $c) { |
|
690 | - $loader = \OC\Files\Filesystem::getLoader(); |
|
691 | - $mountCache = $c->query('UserMountCache'); |
|
692 | - $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); |
|
693 | - |
|
694 | - // builtin providers |
|
695 | - |
|
696 | - $config = $c->getConfig(); |
|
697 | - $manager->registerProvider(new CacheMountProvider($config)); |
|
698 | - $manager->registerHomeProvider(new LocalHomeMountProvider()); |
|
699 | - $manager->registerHomeProvider(new ObjectHomeMountProvider($config)); |
|
700 | - |
|
701 | - return $manager; |
|
702 | - }); |
|
703 | - $this->registerAlias('MountConfigManager', \OCP\Files\Config\IMountProviderCollection::class); |
|
704 | - |
|
705 | - $this->registerService('IniWrapper', function ($c) { |
|
706 | - return new IniGetWrapper(); |
|
707 | - }); |
|
708 | - $this->registerService('AsyncCommandBus', function (Server $c) { |
|
709 | - $busClass = $c->getConfig()->getSystemValue('commandbus'); |
|
710 | - if ($busClass) { |
|
711 | - list($app, $class) = explode('::', $busClass, 2); |
|
712 | - if ($c->getAppManager()->isInstalled($app)) { |
|
713 | - \OC_App::loadApp($app); |
|
714 | - return $c->query($class); |
|
715 | - } else { |
|
716 | - throw new ServiceUnavailableException("The app providing the command bus ($app) is not enabled"); |
|
717 | - } |
|
718 | - } else { |
|
719 | - $jobList = $c->getJobList(); |
|
720 | - return new CronBus($jobList); |
|
721 | - } |
|
722 | - }); |
|
723 | - $this->registerService('TrustedDomainHelper', function ($c) { |
|
724 | - return new TrustedDomainHelper($this->getConfig()); |
|
725 | - }); |
|
726 | - $this->registerService('Throttler', function (Server $c) { |
|
727 | - return new Throttler( |
|
728 | - $c->getDatabaseConnection(), |
|
729 | - new TimeFactory(), |
|
730 | - $c->getLogger(), |
|
731 | - $c->getConfig() |
|
732 | - ); |
|
733 | - }); |
|
734 | - $this->registerService('IntegrityCodeChecker', function (Server $c) { |
|
735 | - // IConfig and IAppManager requires a working database. This code |
|
736 | - // might however be called when ownCloud is not yet setup. |
|
737 | - if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
738 | - $config = $c->getConfig(); |
|
739 | - $appManager = $c->getAppManager(); |
|
740 | - } else { |
|
741 | - $config = null; |
|
742 | - $appManager = null; |
|
743 | - } |
|
744 | - |
|
745 | - return new Checker( |
|
746 | - new EnvironmentHelper(), |
|
747 | - new FileAccessHelper(), |
|
748 | - new AppLocator(), |
|
749 | - $config, |
|
750 | - $c->getMemCacheFactory(), |
|
751 | - $appManager, |
|
752 | - $c->getTempManager() |
|
753 | - ); |
|
754 | - }); |
|
755 | - $this->registerService(\OCP\IRequest::class, function ($c) { |
|
756 | - if (isset($this['urlParams'])) { |
|
757 | - $urlParams = $this['urlParams']; |
|
758 | - } else { |
|
759 | - $urlParams = []; |
|
760 | - } |
|
761 | - |
|
762 | - if (defined('PHPUNIT_RUN') && PHPUNIT_RUN |
|
763 | - && in_array('fakeinput', stream_get_wrappers()) |
|
764 | - ) { |
|
765 | - $stream = 'fakeinput://data'; |
|
766 | - } else { |
|
767 | - $stream = 'php://input'; |
|
768 | - } |
|
769 | - |
|
770 | - return new Request( |
|
771 | - [ |
|
772 | - 'get' => $_GET, |
|
773 | - 'post' => $_POST, |
|
774 | - 'files' => $_FILES, |
|
775 | - 'server' => $_SERVER, |
|
776 | - 'env' => $_ENV, |
|
777 | - 'cookies' => $_COOKIE, |
|
778 | - 'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD'])) |
|
779 | - ? $_SERVER['REQUEST_METHOD'] |
|
780 | - : null, |
|
781 | - 'urlParams' => $urlParams, |
|
782 | - ], |
|
783 | - $this->getSecureRandom(), |
|
784 | - $this->getConfig(), |
|
785 | - $this->getCsrfTokenManager(), |
|
786 | - $stream |
|
787 | - ); |
|
788 | - }); |
|
789 | - $this->registerAlias('Request', \OCP\IRequest::class); |
|
790 | - |
|
791 | - $this->registerService(\OCP\Mail\IMailer::class, function (Server $c) { |
|
792 | - return new Mailer( |
|
793 | - $c->getConfig(), |
|
794 | - $c->getLogger(), |
|
795 | - $c->query(Defaults::class), |
|
796 | - $c->getURLGenerator(), |
|
797 | - $c->getL10N('lib') |
|
798 | - ); |
|
799 | - }); |
|
800 | - $this->registerAlias('Mailer', \OCP\Mail\IMailer::class); |
|
801 | - |
|
802 | - $this->registerService('LDAPProvider', function (Server $c) { |
|
803 | - $config = $c->getConfig(); |
|
804 | - $factoryClass = $config->getSystemValue('ldapProviderFactory', null); |
|
805 | - if (is_null($factoryClass)) { |
|
806 | - throw new \Exception('ldapProviderFactory not set'); |
|
807 | - } |
|
808 | - /** @var \OCP\LDAP\ILDAPProviderFactory $factory */ |
|
809 | - $factory = new $factoryClass($this); |
|
810 | - return $factory->getLDAPProvider(); |
|
811 | - }); |
|
812 | - $this->registerService(ILockingProvider::class, function (Server $c) { |
|
813 | - $ini = $c->getIniWrapper(); |
|
814 | - $config = $c->getConfig(); |
|
815 | - $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); |
|
816 | - if ($config->getSystemValue('filelocking.enabled', true) or (defined('PHPUNIT_RUN') && PHPUNIT_RUN)) { |
|
817 | - /** @var \OC\Memcache\Factory $memcacheFactory */ |
|
818 | - $memcacheFactory = $c->getMemCacheFactory(); |
|
819 | - $memcache = $memcacheFactory->createLocking('lock'); |
|
820 | - if (!($memcache instanceof \OC\Memcache\NullCache)) { |
|
821 | - return new MemcacheLockingProvider($memcache, $ttl); |
|
822 | - } |
|
823 | - return new DBLockingProvider($c->getDatabaseConnection(), $c->getLogger(), new TimeFactory(), $ttl); |
|
824 | - } |
|
825 | - return new NoopLockingProvider(); |
|
826 | - }); |
|
827 | - $this->registerAlias('LockingProvider', ILockingProvider::class); |
|
828 | - |
|
829 | - $this->registerService(\OCP\Files\Mount\IMountManager::class, function () { |
|
830 | - return new \OC\Files\Mount\Manager(); |
|
831 | - }); |
|
832 | - $this->registerAlias('MountManager', \OCP\Files\Mount\IMountManager::class); |
|
833 | - |
|
834 | - $this->registerService(\OCP\Files\IMimeTypeDetector::class, function (Server $c) { |
|
835 | - return new \OC\Files\Type\Detection( |
|
836 | - $c->getURLGenerator(), |
|
837 | - \OC::$configDir, |
|
838 | - \OC::$SERVERROOT . '/resources/config/' |
|
839 | - ); |
|
840 | - }); |
|
841 | - $this->registerAlias('MimeTypeDetector', \OCP\Files\IMimeTypeDetector::class); |
|
842 | - |
|
843 | - $this->registerService(\OCP\Files\IMimeTypeLoader::class, function (Server $c) { |
|
844 | - return new \OC\Files\Type\Loader( |
|
845 | - $c->getDatabaseConnection() |
|
846 | - ); |
|
847 | - }); |
|
848 | - $this->registerAlias('MimeTypeLoader', \OCP\Files\IMimeTypeLoader::class); |
|
849 | - $this->registerService(BundleFetcher::class, function () { |
|
850 | - return new BundleFetcher($this->getL10N('lib')); |
|
851 | - }); |
|
852 | - $this->registerService(\OCP\Notification\IManager::class, function (Server $c) { |
|
853 | - return new Manager( |
|
854 | - $c->query(IValidator::class) |
|
855 | - ); |
|
856 | - }); |
|
857 | - $this->registerAlias('NotificationManager', \OCP\Notification\IManager::class); |
|
858 | - |
|
859 | - $this->registerService(\OC\CapabilitiesManager::class, function (Server $c) { |
|
860 | - $manager = new \OC\CapabilitiesManager($c->getLogger()); |
|
861 | - $manager->registerCapability(function () use ($c) { |
|
862 | - return new \OC\OCS\CoreCapabilities($c->getConfig()); |
|
863 | - }); |
|
864 | - $manager->registerCapability(function () use ($c) { |
|
865 | - return $c->query(\OC\Security\Bruteforce\Capabilities::class); |
|
866 | - }); |
|
867 | - return $manager; |
|
868 | - }); |
|
869 | - $this->registerAlias('CapabilitiesManager', \OC\CapabilitiesManager::class); |
|
870 | - |
|
871 | - $this->registerService(\OCP\Comments\ICommentsManager::class, function (Server $c) { |
|
872 | - $config = $c->getConfig(); |
|
873 | - $factoryClass = $config->getSystemValue('comments.managerFactory', '\OC\Comments\ManagerFactory'); |
|
874 | - /** @var \OCP\Comments\ICommentsManagerFactory $factory */ |
|
875 | - $factory = new $factoryClass($this); |
|
876 | - return $factory->getManager(); |
|
877 | - }); |
|
878 | - $this->registerAlias('CommentsManager', \OCP\Comments\ICommentsManager::class); |
|
879 | - |
|
880 | - $this->registerService('ThemingDefaults', function (Server $c) { |
|
881 | - /* |
|
136 | + /** @var string */ |
|
137 | + private $webRoot; |
|
138 | + |
|
139 | + /** |
|
140 | + * @param string $webRoot |
|
141 | + * @param \OC\Config $config |
|
142 | + */ |
|
143 | + public function __construct($webRoot, \OC\Config $config) { |
|
144 | + parent::__construct(); |
|
145 | + $this->webRoot = $webRoot; |
|
146 | + |
|
147 | + $this->registerService(\OCP\IServerContainer::class, function (IServerContainer $c) { |
|
148 | + return $c; |
|
149 | + }); |
|
150 | + |
|
151 | + $this->registerAlias(\OCP\Contacts\IManager::class, \OC\ContactsManager::class); |
|
152 | + $this->registerAlias('ContactsManager', \OCP\Contacts\IManager::class); |
|
153 | + |
|
154 | + $this->registerAlias(IActionFactory::class, ActionFactory::class); |
|
155 | + |
|
156 | + |
|
157 | + $this->registerService(\OCP\IPreview::class, function (Server $c) { |
|
158 | + return new PreviewManager( |
|
159 | + $c->getConfig(), |
|
160 | + $c->getRootFolder(), |
|
161 | + $c->getAppDataDir('preview'), |
|
162 | + $c->getEventDispatcher(), |
|
163 | + $c->getSession()->get('user_id') |
|
164 | + ); |
|
165 | + }); |
|
166 | + $this->registerAlias('PreviewManager', \OCP\IPreview::class); |
|
167 | + |
|
168 | + $this->registerService(\OC\Preview\Watcher::class, function (Server $c) { |
|
169 | + return new \OC\Preview\Watcher( |
|
170 | + $c->getAppDataDir('preview') |
|
171 | + ); |
|
172 | + }); |
|
173 | + |
|
174 | + $this->registerService('EncryptionManager', function (Server $c) { |
|
175 | + $view = new View(); |
|
176 | + $util = new Encryption\Util( |
|
177 | + $view, |
|
178 | + $c->getUserManager(), |
|
179 | + $c->getGroupManager(), |
|
180 | + $c->getConfig() |
|
181 | + ); |
|
182 | + return new Encryption\Manager( |
|
183 | + $c->getConfig(), |
|
184 | + $c->getLogger(), |
|
185 | + $c->getL10N('core'), |
|
186 | + new View(), |
|
187 | + $util, |
|
188 | + new ArrayCache() |
|
189 | + ); |
|
190 | + }); |
|
191 | + |
|
192 | + $this->registerService('EncryptionFileHelper', function (Server $c) { |
|
193 | + $util = new Encryption\Util( |
|
194 | + new View(), |
|
195 | + $c->getUserManager(), |
|
196 | + $c->getGroupManager(), |
|
197 | + $c->getConfig() |
|
198 | + ); |
|
199 | + return new Encryption\File( |
|
200 | + $util, |
|
201 | + $c->getRootFolder(), |
|
202 | + $c->getShareManager() |
|
203 | + ); |
|
204 | + }); |
|
205 | + |
|
206 | + $this->registerService('EncryptionKeyStorage', function (Server $c) { |
|
207 | + $view = new View(); |
|
208 | + $util = new Encryption\Util( |
|
209 | + $view, |
|
210 | + $c->getUserManager(), |
|
211 | + $c->getGroupManager(), |
|
212 | + $c->getConfig() |
|
213 | + ); |
|
214 | + |
|
215 | + return new Encryption\Keys\Storage($view, $util); |
|
216 | + }); |
|
217 | + $this->registerService('TagMapper', function (Server $c) { |
|
218 | + return new TagMapper($c->getDatabaseConnection()); |
|
219 | + }); |
|
220 | + |
|
221 | + $this->registerService(\OCP\ITagManager::class, function (Server $c) { |
|
222 | + $tagMapper = $c->query('TagMapper'); |
|
223 | + return new TagManager($tagMapper, $c->getUserSession()); |
|
224 | + }); |
|
225 | + $this->registerAlias('TagManager', \OCP\ITagManager::class); |
|
226 | + |
|
227 | + $this->registerService('SystemTagManagerFactory', function (Server $c) { |
|
228 | + $config = $c->getConfig(); |
|
229 | + $factoryClass = $config->getSystemValue('systemtags.managerFactory', '\OC\SystemTag\ManagerFactory'); |
|
230 | + /** @var \OC\SystemTag\ManagerFactory $factory */ |
|
231 | + $factory = new $factoryClass($this); |
|
232 | + return $factory; |
|
233 | + }); |
|
234 | + $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) { |
|
235 | + return $c->query('SystemTagManagerFactory')->getManager(); |
|
236 | + }); |
|
237 | + $this->registerAlias('SystemTagManager', \OCP\SystemTag\ISystemTagManager::class); |
|
238 | + |
|
239 | + $this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function (Server $c) { |
|
240 | + return $c->query('SystemTagManagerFactory')->getObjectMapper(); |
|
241 | + }); |
|
242 | + $this->registerService('RootFolder', function (Server $c) { |
|
243 | + $manager = \OC\Files\Filesystem::getMountManager(null); |
|
244 | + $view = new View(); |
|
245 | + $root = new Root( |
|
246 | + $manager, |
|
247 | + $view, |
|
248 | + null, |
|
249 | + $c->getUserMountCache(), |
|
250 | + $this->getLogger(), |
|
251 | + $this->getUserManager() |
|
252 | + ); |
|
253 | + $connector = new HookConnector($root, $view); |
|
254 | + $connector->viewToNode(); |
|
255 | + |
|
256 | + $previewConnector = new \OC\Preview\WatcherConnector($root, $c->getSystemConfig()); |
|
257 | + $previewConnector->connectWatcher(); |
|
258 | + |
|
259 | + return $root; |
|
260 | + }); |
|
261 | + $this->registerAlias('SystemTagObjectMapper', \OCP\SystemTag\ISystemTagObjectMapper::class); |
|
262 | + |
|
263 | + $this->registerService(\OCP\Files\IRootFolder::class, function (Server $c) { |
|
264 | + return new LazyRoot(function () use ($c) { |
|
265 | + return $c->query('RootFolder'); |
|
266 | + }); |
|
267 | + }); |
|
268 | + $this->registerAlias('LazyRootFolder', \OCP\Files\IRootFolder::class); |
|
269 | + |
|
270 | + $this->registerService(\OCP\IUserManager::class, function (Server $c) { |
|
271 | + $config = $c->getConfig(); |
|
272 | + return new \OC\User\Manager($config); |
|
273 | + }); |
|
274 | + $this->registerAlias('UserManager', \OCP\IUserManager::class); |
|
275 | + |
|
276 | + $this->registerService(\OCP\IGroupManager::class, function (Server $c) { |
|
277 | + $groupManager = new \OC\Group\Manager($this->getUserManager(), $this->getLogger()); |
|
278 | + $groupManager->listen('\OC\Group', 'preCreate', function ($gid) { |
|
279 | + \OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid)); |
|
280 | + }); |
|
281 | + $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) { |
|
282 | + \OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID())); |
|
283 | + }); |
|
284 | + $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) { |
|
285 | + \OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID())); |
|
286 | + }); |
|
287 | + $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) { |
|
288 | + \OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID())); |
|
289 | + }); |
|
290 | + $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
291 | + \OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID())); |
|
292 | + }); |
|
293 | + $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
294 | + \OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
|
295 | + //Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks |
|
296 | + \OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
|
297 | + }); |
|
298 | + return $groupManager; |
|
299 | + }); |
|
300 | + $this->registerAlias('GroupManager', \OCP\IGroupManager::class); |
|
301 | + |
|
302 | + $this->registerService(Store::class, function (Server $c) { |
|
303 | + $session = $c->getSession(); |
|
304 | + if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
305 | + $tokenProvider = $c->query('OC\Authentication\Token\IProvider'); |
|
306 | + } else { |
|
307 | + $tokenProvider = null; |
|
308 | + } |
|
309 | + $logger = $c->getLogger(); |
|
310 | + return new Store($session, $logger, $tokenProvider); |
|
311 | + }); |
|
312 | + $this->registerAlias(IStore::class, Store::class); |
|
313 | + $this->registerService('OC\Authentication\Token\DefaultTokenMapper', function (Server $c) { |
|
314 | + $dbConnection = $c->getDatabaseConnection(); |
|
315 | + return new Authentication\Token\DefaultTokenMapper($dbConnection); |
|
316 | + }); |
|
317 | + $this->registerService('OC\Authentication\Token\DefaultTokenProvider', function (Server $c) { |
|
318 | + $mapper = $c->query('OC\Authentication\Token\DefaultTokenMapper'); |
|
319 | + $crypto = $c->getCrypto(); |
|
320 | + $config = $c->getConfig(); |
|
321 | + $logger = $c->getLogger(); |
|
322 | + $timeFactory = new TimeFactory(); |
|
323 | + return new \OC\Authentication\Token\DefaultTokenProvider($mapper, $crypto, $config, $logger, $timeFactory); |
|
324 | + }); |
|
325 | + $this->registerAlias('OC\Authentication\Token\IProvider', 'OC\Authentication\Token\DefaultTokenProvider'); |
|
326 | + |
|
327 | + $this->registerService(\OCP\IUserSession::class, function (Server $c) { |
|
328 | + $manager = $c->getUserManager(); |
|
329 | + $session = new \OC\Session\Memory(''); |
|
330 | + $timeFactory = new TimeFactory(); |
|
331 | + // Token providers might require a working database. This code |
|
332 | + // might however be called when ownCloud is not yet setup. |
|
333 | + if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
334 | + $defaultTokenProvider = $c->query('OC\Authentication\Token\IProvider'); |
|
335 | + } else { |
|
336 | + $defaultTokenProvider = null; |
|
337 | + } |
|
338 | + |
|
339 | + $userSession = new \OC\User\Session($manager, $session, $timeFactory, $defaultTokenProvider, $c->getConfig(), $c->getSecureRandom(), $c->getLockdownManager()); |
|
340 | + $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { |
|
341 | + \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password)); |
|
342 | + }); |
|
343 | + $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) { |
|
344 | + /** @var $user \OC\User\User */ |
|
345 | + \OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password)); |
|
346 | + }); |
|
347 | + $userSession->listen('\OC\User', 'preDelete', function ($user) { |
|
348 | + /** @var $user \OC\User\User */ |
|
349 | + \OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID())); |
|
350 | + }); |
|
351 | + $userSession->listen('\OC\User', 'postDelete', function ($user) { |
|
352 | + /** @var $user \OC\User\User */ |
|
353 | + \OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID())); |
|
354 | + }); |
|
355 | + $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) { |
|
356 | + /** @var $user \OC\User\User */ |
|
357 | + \OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
|
358 | + }); |
|
359 | + $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) { |
|
360 | + /** @var $user \OC\User\User */ |
|
361 | + \OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
|
362 | + }); |
|
363 | + $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) { |
|
364 | + \OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password)); |
|
365 | + }); |
|
366 | + $userSession->listen('\OC\User', 'postLogin', function ($user, $password) { |
|
367 | + /** @var $user \OC\User\User */ |
|
368 | + \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password)); |
|
369 | + }); |
|
370 | + $userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) { |
|
371 | + /** @var $user \OC\User\User */ |
|
372 | + \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password)); |
|
373 | + }); |
|
374 | + $userSession->listen('\OC\User', 'logout', function () { |
|
375 | + \OC_Hook::emit('OC_User', 'logout', array()); |
|
376 | + }); |
|
377 | + $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) { |
|
378 | + /** @var $user \OC\User\User */ |
|
379 | + \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue)); |
|
380 | + }); |
|
381 | + return $userSession; |
|
382 | + }); |
|
383 | + $this->registerAlias('UserSession', \OCP\IUserSession::class); |
|
384 | + |
|
385 | + $this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function (Server $c) { |
|
386 | + return new \OC\Authentication\TwoFactorAuth\Manager( |
|
387 | + $c->getAppManager(), |
|
388 | + $c->getSession(), |
|
389 | + $c->getConfig(), |
|
390 | + $c->getActivityManager(), |
|
391 | + $c->getLogger(), |
|
392 | + $c->query(\OC\Authentication\Token\IProvider::class), |
|
393 | + $c->query(ITimeFactory::class) |
|
394 | + ); |
|
395 | + }); |
|
396 | + |
|
397 | + $this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class); |
|
398 | + $this->registerAlias('NavigationManager', \OCP\INavigationManager::class); |
|
399 | + |
|
400 | + $this->registerService(\OC\AllConfig::class, function (Server $c) { |
|
401 | + return new \OC\AllConfig( |
|
402 | + $c->getSystemConfig() |
|
403 | + ); |
|
404 | + }); |
|
405 | + $this->registerAlias('AllConfig', \OC\AllConfig::class); |
|
406 | + $this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class); |
|
407 | + |
|
408 | + $this->registerService('SystemConfig', function ($c) use ($config) { |
|
409 | + return new \OC\SystemConfig($config); |
|
410 | + }); |
|
411 | + |
|
412 | + $this->registerService(\OC\AppConfig::class, function (Server $c) { |
|
413 | + return new \OC\AppConfig($c->getDatabaseConnection()); |
|
414 | + }); |
|
415 | + $this->registerAlias('AppConfig', \OC\AppConfig::class); |
|
416 | + $this->registerAlias(\OCP\IAppConfig::class, \OC\AppConfig::class); |
|
417 | + |
|
418 | + $this->registerService(\OCP\L10N\IFactory::class, function (Server $c) { |
|
419 | + return new \OC\L10N\Factory( |
|
420 | + $c->getConfig(), |
|
421 | + $c->getRequest(), |
|
422 | + $c->getUserSession(), |
|
423 | + \OC::$SERVERROOT |
|
424 | + ); |
|
425 | + }); |
|
426 | + $this->registerAlias('L10NFactory', \OCP\L10N\IFactory::class); |
|
427 | + |
|
428 | + $this->registerService(\OCP\IURLGenerator::class, function (Server $c) { |
|
429 | + $config = $c->getConfig(); |
|
430 | + $cacheFactory = $c->getMemCacheFactory(); |
|
431 | + $request = $c->getRequest(); |
|
432 | + return new \OC\URLGenerator( |
|
433 | + $config, |
|
434 | + $cacheFactory, |
|
435 | + $request |
|
436 | + ); |
|
437 | + }); |
|
438 | + $this->registerAlias('URLGenerator', \OCP\IURLGenerator::class); |
|
439 | + |
|
440 | + $this->registerService('AppHelper', function ($c) { |
|
441 | + return new \OC\AppHelper(); |
|
442 | + }); |
|
443 | + $this->registerAlias('AppFetcher', AppFetcher::class); |
|
444 | + $this->registerAlias('CategoryFetcher', CategoryFetcher::class); |
|
445 | + |
|
446 | + $this->registerService(\OCP\ICache::class, function ($c) { |
|
447 | + return new Cache\File(); |
|
448 | + }); |
|
449 | + $this->registerAlias('UserCache', \OCP\ICache::class); |
|
450 | + |
|
451 | + $this->registerService(Factory::class, function (Server $c) { |
|
452 | + |
|
453 | + $arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(), |
|
454 | + '\\OC\\Memcache\\ArrayCache', |
|
455 | + '\\OC\\Memcache\\ArrayCache', |
|
456 | + '\\OC\\Memcache\\ArrayCache' |
|
457 | + ); |
|
458 | + $config = $c->getConfig(); |
|
459 | + $request = $c->getRequest(); |
|
460 | + $urlGenerator = new URLGenerator($config, $arrayCacheFactory, $request); |
|
461 | + |
|
462 | + if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) { |
|
463 | + $v = \OC_App::getAppVersions(); |
|
464 | + $v['core'] = implode(',', \OC_Util::getVersion()); |
|
465 | + $version = implode(',', $v); |
|
466 | + $instanceId = \OC_Util::getInstanceId(); |
|
467 | + $path = \OC::$SERVERROOT; |
|
468 | + $prefix = md5($instanceId . '-' . $version . '-' . $path . '-' . $urlGenerator->getBaseUrl()); |
|
469 | + return new \OC\Memcache\Factory($prefix, $c->getLogger(), |
|
470 | + $config->getSystemValue('memcache.local', null), |
|
471 | + $config->getSystemValue('memcache.distributed', null), |
|
472 | + $config->getSystemValue('memcache.locking', null) |
|
473 | + ); |
|
474 | + } |
|
475 | + return $arrayCacheFactory; |
|
476 | + |
|
477 | + }); |
|
478 | + $this->registerAlias('MemCacheFactory', Factory::class); |
|
479 | + $this->registerAlias(ICacheFactory::class, Factory::class); |
|
480 | + |
|
481 | + $this->registerService('RedisFactory', function (Server $c) { |
|
482 | + $systemConfig = $c->getSystemConfig(); |
|
483 | + return new RedisFactory($systemConfig); |
|
484 | + }); |
|
485 | + |
|
486 | + $this->registerService(\OCP\Activity\IManager::class, function (Server $c) { |
|
487 | + return new \OC\Activity\Manager( |
|
488 | + $c->getRequest(), |
|
489 | + $c->getUserSession(), |
|
490 | + $c->getConfig(), |
|
491 | + $c->query(IValidator::class) |
|
492 | + ); |
|
493 | + }); |
|
494 | + $this->registerAlias('ActivityManager', \OCP\Activity\IManager::class); |
|
495 | + |
|
496 | + $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) { |
|
497 | + return new \OC\Activity\EventMerger( |
|
498 | + $c->getL10N('lib') |
|
499 | + ); |
|
500 | + }); |
|
501 | + $this->registerAlias(IValidator::class, Validator::class); |
|
502 | + |
|
503 | + $this->registerService(\OCP\IAvatarManager::class, function (Server $c) { |
|
504 | + return new AvatarManager( |
|
505 | + $c->getUserManager(), |
|
506 | + $c->getAppDataDir('avatar'), |
|
507 | + $c->getL10N('lib'), |
|
508 | + $c->getLogger(), |
|
509 | + $c->getConfig() |
|
510 | + ); |
|
511 | + }); |
|
512 | + $this->registerAlias('AvatarManager', \OCP\IAvatarManager::class); |
|
513 | + |
|
514 | + $this->registerService(\OCP\ILogger::class, function (Server $c) { |
|
515 | + $logType = $c->query('AllConfig')->getSystemValue('log_type', 'file'); |
|
516 | + $logger = Log::getLogClass($logType); |
|
517 | + call_user_func(array($logger, 'init')); |
|
518 | + |
|
519 | + return new Log($logger); |
|
520 | + }); |
|
521 | + $this->registerAlias('Logger', \OCP\ILogger::class); |
|
522 | + |
|
523 | + $this->registerService(\OCP\BackgroundJob\IJobList::class, function (Server $c) { |
|
524 | + $config = $c->getConfig(); |
|
525 | + return new \OC\BackgroundJob\JobList( |
|
526 | + $c->getDatabaseConnection(), |
|
527 | + $config, |
|
528 | + new TimeFactory() |
|
529 | + ); |
|
530 | + }); |
|
531 | + $this->registerAlias('JobList', \OCP\BackgroundJob\IJobList::class); |
|
532 | + |
|
533 | + $this->registerService(\OCP\Route\IRouter::class, function (Server $c) { |
|
534 | + $cacheFactory = $c->getMemCacheFactory(); |
|
535 | + $logger = $c->getLogger(); |
|
536 | + if ($cacheFactory->isAvailableLowLatency()) { |
|
537 | + $router = new \OC\Route\CachingRouter($cacheFactory->createLocal('route'), $logger); |
|
538 | + } else { |
|
539 | + $router = new \OC\Route\Router($logger); |
|
540 | + } |
|
541 | + return $router; |
|
542 | + }); |
|
543 | + $this->registerAlias('Router', \OCP\Route\IRouter::class); |
|
544 | + |
|
545 | + $this->registerService(\OCP\ISearch::class, function ($c) { |
|
546 | + return new Search(); |
|
547 | + }); |
|
548 | + $this->registerAlias('Search', \OCP\ISearch::class); |
|
549 | + |
|
550 | + $this->registerService(\OC\Security\RateLimiting\Limiter::class, function ($c) { |
|
551 | + return new \OC\Security\RateLimiting\Limiter( |
|
552 | + $this->getUserSession(), |
|
553 | + $this->getRequest(), |
|
554 | + new \OC\AppFramework\Utility\TimeFactory(), |
|
555 | + $c->query(\OC\Security\RateLimiting\Backend\IBackend::class) |
|
556 | + ); |
|
557 | + }); |
|
558 | + $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) { |
|
559 | + return new \OC\Security\RateLimiting\Backend\MemoryCache( |
|
560 | + $this->getMemCacheFactory(), |
|
561 | + new \OC\AppFramework\Utility\TimeFactory() |
|
562 | + ); |
|
563 | + }); |
|
564 | + |
|
565 | + $this->registerService(\OCP\Security\ISecureRandom::class, function ($c) { |
|
566 | + return new SecureRandom(); |
|
567 | + }); |
|
568 | + $this->registerAlias('SecureRandom', \OCP\Security\ISecureRandom::class); |
|
569 | + |
|
570 | + $this->registerService(\OCP\Security\ICrypto::class, function (Server $c) { |
|
571 | + return new Crypto($c->getConfig(), $c->getSecureRandom()); |
|
572 | + }); |
|
573 | + $this->registerAlias('Crypto', \OCP\Security\ICrypto::class); |
|
574 | + |
|
575 | + $this->registerService(\OCP\Security\IHasher::class, function (Server $c) { |
|
576 | + return new Hasher($c->getConfig()); |
|
577 | + }); |
|
578 | + $this->registerAlias('Hasher', \OCP\Security\IHasher::class); |
|
579 | + |
|
580 | + $this->registerService(\OCP\Security\ICredentialsManager::class, function (Server $c) { |
|
581 | + return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection()); |
|
582 | + }); |
|
583 | + $this->registerAlias('CredentialsManager', \OCP\Security\ICredentialsManager::class); |
|
584 | + |
|
585 | + $this->registerService(IDBConnection::class, function (Server $c) { |
|
586 | + $systemConfig = $c->getSystemConfig(); |
|
587 | + $factory = new \OC\DB\ConnectionFactory($systemConfig); |
|
588 | + $type = $systemConfig->getValue('dbtype', 'sqlite'); |
|
589 | + if (!$factory->isValidType($type)) { |
|
590 | + throw new \OC\DatabaseException('Invalid database type'); |
|
591 | + } |
|
592 | + $connectionParams = $factory->createConnectionParams(); |
|
593 | + $connection = $factory->getConnection($type, $connectionParams); |
|
594 | + $connection->getConfiguration()->setSQLLogger($c->getQueryLogger()); |
|
595 | + return $connection; |
|
596 | + }); |
|
597 | + $this->registerAlias('DatabaseConnection', IDBConnection::class); |
|
598 | + |
|
599 | + $this->registerService('HTTPHelper', function (Server $c) { |
|
600 | + $config = $c->getConfig(); |
|
601 | + return new HTTPHelper( |
|
602 | + $config, |
|
603 | + $c->getHTTPClientService() |
|
604 | + ); |
|
605 | + }); |
|
606 | + |
|
607 | + $this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) { |
|
608 | + $user = \OC_User::getUser(); |
|
609 | + $uid = $user ? $user : null; |
|
610 | + return new ClientService( |
|
611 | + $c->getConfig(), |
|
612 | + new \OC\Security\CertificateManager( |
|
613 | + $uid, |
|
614 | + new View(), |
|
615 | + $c->getConfig(), |
|
616 | + $c->getLogger(), |
|
617 | + $c->getSecureRandom() |
|
618 | + ) |
|
619 | + ); |
|
620 | + }); |
|
621 | + $this->registerAlias('HttpClientService', \OCP\Http\Client\IClientService::class); |
|
622 | + $this->registerService(\OCP\Diagnostics\IEventLogger::class, function (Server $c) { |
|
623 | + $eventLogger = new EventLogger(); |
|
624 | + if ($c->getSystemConfig()->getValue('debug', false)) { |
|
625 | + // In debug mode, module is being activated by default |
|
626 | + $eventLogger->activate(); |
|
627 | + } |
|
628 | + return $eventLogger; |
|
629 | + }); |
|
630 | + $this->registerAlias('EventLogger', \OCP\Diagnostics\IEventLogger::class); |
|
631 | + |
|
632 | + $this->registerService(\OCP\Diagnostics\IQueryLogger::class, function (Server $c) { |
|
633 | + $queryLogger = new QueryLogger(); |
|
634 | + if ($c->getSystemConfig()->getValue('debug', false)) { |
|
635 | + // In debug mode, module is being activated by default |
|
636 | + $queryLogger->activate(); |
|
637 | + } |
|
638 | + return $queryLogger; |
|
639 | + }); |
|
640 | + $this->registerAlias('QueryLogger', \OCP\Diagnostics\IQueryLogger::class); |
|
641 | + |
|
642 | + $this->registerService(TempManager::class, function (Server $c) { |
|
643 | + return new TempManager( |
|
644 | + $c->getLogger(), |
|
645 | + $c->getConfig() |
|
646 | + ); |
|
647 | + }); |
|
648 | + $this->registerAlias('TempManager', TempManager::class); |
|
649 | + $this->registerAlias(ITempManager::class, TempManager::class); |
|
650 | + |
|
651 | + $this->registerService(AppManager::class, function (Server $c) { |
|
652 | + return new \OC\App\AppManager( |
|
653 | + $c->getUserSession(), |
|
654 | + $c->getAppConfig(), |
|
655 | + $c->getGroupManager(), |
|
656 | + $c->getMemCacheFactory(), |
|
657 | + $c->getEventDispatcher() |
|
658 | + ); |
|
659 | + }); |
|
660 | + $this->registerAlias('AppManager', AppManager::class); |
|
661 | + $this->registerAlias(IAppManager::class, AppManager::class); |
|
662 | + |
|
663 | + $this->registerService(\OCP\IDateTimeZone::class, function (Server $c) { |
|
664 | + return new DateTimeZone( |
|
665 | + $c->getConfig(), |
|
666 | + $c->getSession() |
|
667 | + ); |
|
668 | + }); |
|
669 | + $this->registerAlias('DateTimeZone', \OCP\IDateTimeZone::class); |
|
670 | + |
|
671 | + $this->registerService(\OCP\IDateTimeFormatter::class, function (Server $c) { |
|
672 | + $language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null); |
|
673 | + |
|
674 | + return new DateTimeFormatter( |
|
675 | + $c->getDateTimeZone()->getTimeZone(), |
|
676 | + $c->getL10N('lib', $language) |
|
677 | + ); |
|
678 | + }); |
|
679 | + $this->registerAlias('DateTimeFormatter', \OCP\IDateTimeFormatter::class); |
|
680 | + |
|
681 | + $this->registerService(\OCP\Files\Config\IUserMountCache::class, function (Server $c) { |
|
682 | + $mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger()); |
|
683 | + $listener = new UserMountCacheListener($mountCache); |
|
684 | + $listener->listen($c->getUserManager()); |
|
685 | + return $mountCache; |
|
686 | + }); |
|
687 | + $this->registerAlias('UserMountCache', \OCP\Files\Config\IUserMountCache::class); |
|
688 | + |
|
689 | + $this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function (Server $c) { |
|
690 | + $loader = \OC\Files\Filesystem::getLoader(); |
|
691 | + $mountCache = $c->query('UserMountCache'); |
|
692 | + $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); |
|
693 | + |
|
694 | + // builtin providers |
|
695 | + |
|
696 | + $config = $c->getConfig(); |
|
697 | + $manager->registerProvider(new CacheMountProvider($config)); |
|
698 | + $manager->registerHomeProvider(new LocalHomeMountProvider()); |
|
699 | + $manager->registerHomeProvider(new ObjectHomeMountProvider($config)); |
|
700 | + |
|
701 | + return $manager; |
|
702 | + }); |
|
703 | + $this->registerAlias('MountConfigManager', \OCP\Files\Config\IMountProviderCollection::class); |
|
704 | + |
|
705 | + $this->registerService('IniWrapper', function ($c) { |
|
706 | + return new IniGetWrapper(); |
|
707 | + }); |
|
708 | + $this->registerService('AsyncCommandBus', function (Server $c) { |
|
709 | + $busClass = $c->getConfig()->getSystemValue('commandbus'); |
|
710 | + if ($busClass) { |
|
711 | + list($app, $class) = explode('::', $busClass, 2); |
|
712 | + if ($c->getAppManager()->isInstalled($app)) { |
|
713 | + \OC_App::loadApp($app); |
|
714 | + return $c->query($class); |
|
715 | + } else { |
|
716 | + throw new ServiceUnavailableException("The app providing the command bus ($app) is not enabled"); |
|
717 | + } |
|
718 | + } else { |
|
719 | + $jobList = $c->getJobList(); |
|
720 | + return new CronBus($jobList); |
|
721 | + } |
|
722 | + }); |
|
723 | + $this->registerService('TrustedDomainHelper', function ($c) { |
|
724 | + return new TrustedDomainHelper($this->getConfig()); |
|
725 | + }); |
|
726 | + $this->registerService('Throttler', function (Server $c) { |
|
727 | + return new Throttler( |
|
728 | + $c->getDatabaseConnection(), |
|
729 | + new TimeFactory(), |
|
730 | + $c->getLogger(), |
|
731 | + $c->getConfig() |
|
732 | + ); |
|
733 | + }); |
|
734 | + $this->registerService('IntegrityCodeChecker', function (Server $c) { |
|
735 | + // IConfig and IAppManager requires a working database. This code |
|
736 | + // might however be called when ownCloud is not yet setup. |
|
737 | + if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
738 | + $config = $c->getConfig(); |
|
739 | + $appManager = $c->getAppManager(); |
|
740 | + } else { |
|
741 | + $config = null; |
|
742 | + $appManager = null; |
|
743 | + } |
|
744 | + |
|
745 | + return new Checker( |
|
746 | + new EnvironmentHelper(), |
|
747 | + new FileAccessHelper(), |
|
748 | + new AppLocator(), |
|
749 | + $config, |
|
750 | + $c->getMemCacheFactory(), |
|
751 | + $appManager, |
|
752 | + $c->getTempManager() |
|
753 | + ); |
|
754 | + }); |
|
755 | + $this->registerService(\OCP\IRequest::class, function ($c) { |
|
756 | + if (isset($this['urlParams'])) { |
|
757 | + $urlParams = $this['urlParams']; |
|
758 | + } else { |
|
759 | + $urlParams = []; |
|
760 | + } |
|
761 | + |
|
762 | + if (defined('PHPUNIT_RUN') && PHPUNIT_RUN |
|
763 | + && in_array('fakeinput', stream_get_wrappers()) |
|
764 | + ) { |
|
765 | + $stream = 'fakeinput://data'; |
|
766 | + } else { |
|
767 | + $stream = 'php://input'; |
|
768 | + } |
|
769 | + |
|
770 | + return new Request( |
|
771 | + [ |
|
772 | + 'get' => $_GET, |
|
773 | + 'post' => $_POST, |
|
774 | + 'files' => $_FILES, |
|
775 | + 'server' => $_SERVER, |
|
776 | + 'env' => $_ENV, |
|
777 | + 'cookies' => $_COOKIE, |
|
778 | + 'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD'])) |
|
779 | + ? $_SERVER['REQUEST_METHOD'] |
|
780 | + : null, |
|
781 | + 'urlParams' => $urlParams, |
|
782 | + ], |
|
783 | + $this->getSecureRandom(), |
|
784 | + $this->getConfig(), |
|
785 | + $this->getCsrfTokenManager(), |
|
786 | + $stream |
|
787 | + ); |
|
788 | + }); |
|
789 | + $this->registerAlias('Request', \OCP\IRequest::class); |
|
790 | + |
|
791 | + $this->registerService(\OCP\Mail\IMailer::class, function (Server $c) { |
|
792 | + return new Mailer( |
|
793 | + $c->getConfig(), |
|
794 | + $c->getLogger(), |
|
795 | + $c->query(Defaults::class), |
|
796 | + $c->getURLGenerator(), |
|
797 | + $c->getL10N('lib') |
|
798 | + ); |
|
799 | + }); |
|
800 | + $this->registerAlias('Mailer', \OCP\Mail\IMailer::class); |
|
801 | + |
|
802 | + $this->registerService('LDAPProvider', function (Server $c) { |
|
803 | + $config = $c->getConfig(); |
|
804 | + $factoryClass = $config->getSystemValue('ldapProviderFactory', null); |
|
805 | + if (is_null($factoryClass)) { |
|
806 | + throw new \Exception('ldapProviderFactory not set'); |
|
807 | + } |
|
808 | + /** @var \OCP\LDAP\ILDAPProviderFactory $factory */ |
|
809 | + $factory = new $factoryClass($this); |
|
810 | + return $factory->getLDAPProvider(); |
|
811 | + }); |
|
812 | + $this->registerService(ILockingProvider::class, function (Server $c) { |
|
813 | + $ini = $c->getIniWrapper(); |
|
814 | + $config = $c->getConfig(); |
|
815 | + $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); |
|
816 | + if ($config->getSystemValue('filelocking.enabled', true) or (defined('PHPUNIT_RUN') && PHPUNIT_RUN)) { |
|
817 | + /** @var \OC\Memcache\Factory $memcacheFactory */ |
|
818 | + $memcacheFactory = $c->getMemCacheFactory(); |
|
819 | + $memcache = $memcacheFactory->createLocking('lock'); |
|
820 | + if (!($memcache instanceof \OC\Memcache\NullCache)) { |
|
821 | + return new MemcacheLockingProvider($memcache, $ttl); |
|
822 | + } |
|
823 | + return new DBLockingProvider($c->getDatabaseConnection(), $c->getLogger(), new TimeFactory(), $ttl); |
|
824 | + } |
|
825 | + return new NoopLockingProvider(); |
|
826 | + }); |
|
827 | + $this->registerAlias('LockingProvider', ILockingProvider::class); |
|
828 | + |
|
829 | + $this->registerService(\OCP\Files\Mount\IMountManager::class, function () { |
|
830 | + return new \OC\Files\Mount\Manager(); |
|
831 | + }); |
|
832 | + $this->registerAlias('MountManager', \OCP\Files\Mount\IMountManager::class); |
|
833 | + |
|
834 | + $this->registerService(\OCP\Files\IMimeTypeDetector::class, function (Server $c) { |
|
835 | + return new \OC\Files\Type\Detection( |
|
836 | + $c->getURLGenerator(), |
|
837 | + \OC::$configDir, |
|
838 | + \OC::$SERVERROOT . '/resources/config/' |
|
839 | + ); |
|
840 | + }); |
|
841 | + $this->registerAlias('MimeTypeDetector', \OCP\Files\IMimeTypeDetector::class); |
|
842 | + |
|
843 | + $this->registerService(\OCP\Files\IMimeTypeLoader::class, function (Server $c) { |
|
844 | + return new \OC\Files\Type\Loader( |
|
845 | + $c->getDatabaseConnection() |
|
846 | + ); |
|
847 | + }); |
|
848 | + $this->registerAlias('MimeTypeLoader', \OCP\Files\IMimeTypeLoader::class); |
|
849 | + $this->registerService(BundleFetcher::class, function () { |
|
850 | + return new BundleFetcher($this->getL10N('lib')); |
|
851 | + }); |
|
852 | + $this->registerService(\OCP\Notification\IManager::class, function (Server $c) { |
|
853 | + return new Manager( |
|
854 | + $c->query(IValidator::class) |
|
855 | + ); |
|
856 | + }); |
|
857 | + $this->registerAlias('NotificationManager', \OCP\Notification\IManager::class); |
|
858 | + |
|
859 | + $this->registerService(\OC\CapabilitiesManager::class, function (Server $c) { |
|
860 | + $manager = new \OC\CapabilitiesManager($c->getLogger()); |
|
861 | + $manager->registerCapability(function () use ($c) { |
|
862 | + return new \OC\OCS\CoreCapabilities($c->getConfig()); |
|
863 | + }); |
|
864 | + $manager->registerCapability(function () use ($c) { |
|
865 | + return $c->query(\OC\Security\Bruteforce\Capabilities::class); |
|
866 | + }); |
|
867 | + return $manager; |
|
868 | + }); |
|
869 | + $this->registerAlias('CapabilitiesManager', \OC\CapabilitiesManager::class); |
|
870 | + |
|
871 | + $this->registerService(\OCP\Comments\ICommentsManager::class, function (Server $c) { |
|
872 | + $config = $c->getConfig(); |
|
873 | + $factoryClass = $config->getSystemValue('comments.managerFactory', '\OC\Comments\ManagerFactory'); |
|
874 | + /** @var \OCP\Comments\ICommentsManagerFactory $factory */ |
|
875 | + $factory = new $factoryClass($this); |
|
876 | + return $factory->getManager(); |
|
877 | + }); |
|
878 | + $this->registerAlias('CommentsManager', \OCP\Comments\ICommentsManager::class); |
|
879 | + |
|
880 | + $this->registerService('ThemingDefaults', function (Server $c) { |
|
881 | + /* |
|
882 | 882 | * Dark magic for autoloader. |
883 | 883 | * If we do a class_exists it will try to load the class which will |
884 | 884 | * make composer cache the result. Resulting in errors when enabling |
885 | 885 | * the theming app. |
886 | 886 | */ |
887 | - $prefixes = \OC::$composerAutoloader->getPrefixesPsr4(); |
|
888 | - if (isset($prefixes['OCA\\Theming\\'])) { |
|
889 | - $classExists = true; |
|
890 | - } else { |
|
891 | - $classExists = false; |
|
892 | - } |
|
893 | - |
|
894 | - if ($classExists && $c->getConfig()->getSystemValue('installed', false) && $c->getAppManager()->isInstalled('theming') && $c->getTrustedDomainHelper()->isTrustedDomain($c->getRequest()->getInsecureServerHost())) { |
|
895 | - return new ThemingDefaults( |
|
896 | - $c->getConfig(), |
|
897 | - $c->getL10N('theming'), |
|
898 | - $c->getURLGenerator(), |
|
899 | - $c->getAppDataDir('theming'), |
|
900 | - $c->getMemCacheFactory(), |
|
901 | - new Util($c->getConfig(), $this->getAppManager(), $this->getAppDataDir('theming')), |
|
902 | - $this->getAppManager() |
|
903 | - ); |
|
904 | - } |
|
905 | - return new \OC_Defaults(); |
|
906 | - }); |
|
907 | - $this->registerService(SCSSCacher::class, function (Server $c) { |
|
908 | - /** @var Factory $cacheFactory */ |
|
909 | - $cacheFactory = $c->query(Factory::class); |
|
910 | - return new SCSSCacher( |
|
911 | - $c->getLogger(), |
|
912 | - $c->query(\OC\Files\AppData\Factory::class), |
|
913 | - $c->getURLGenerator(), |
|
914 | - $c->getConfig(), |
|
915 | - $c->getThemingDefaults(), |
|
916 | - \OC::$SERVERROOT, |
|
917 | - $cacheFactory->create('SCSS') |
|
918 | - ); |
|
919 | - }); |
|
920 | - $this->registerService(EventDispatcher::class, function () { |
|
921 | - return new EventDispatcher(); |
|
922 | - }); |
|
923 | - $this->registerAlias('EventDispatcher', EventDispatcher::class); |
|
924 | - $this->registerAlias(EventDispatcherInterface::class, EventDispatcher::class); |
|
925 | - |
|
926 | - $this->registerService('CryptoWrapper', function (Server $c) { |
|
927 | - // FIXME: Instantiiated here due to cyclic dependency |
|
928 | - $request = new Request( |
|
929 | - [ |
|
930 | - 'get' => $_GET, |
|
931 | - 'post' => $_POST, |
|
932 | - 'files' => $_FILES, |
|
933 | - 'server' => $_SERVER, |
|
934 | - 'env' => $_ENV, |
|
935 | - 'cookies' => $_COOKIE, |
|
936 | - 'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD'])) |
|
937 | - ? $_SERVER['REQUEST_METHOD'] |
|
938 | - : null, |
|
939 | - ], |
|
940 | - $c->getSecureRandom(), |
|
941 | - $c->getConfig() |
|
942 | - ); |
|
943 | - |
|
944 | - return new CryptoWrapper( |
|
945 | - $c->getConfig(), |
|
946 | - $c->getCrypto(), |
|
947 | - $c->getSecureRandom(), |
|
948 | - $request |
|
949 | - ); |
|
950 | - }); |
|
951 | - $this->registerService('CsrfTokenManager', function (Server $c) { |
|
952 | - $tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom()); |
|
953 | - |
|
954 | - return new CsrfTokenManager( |
|
955 | - $tokenGenerator, |
|
956 | - $c->query(SessionStorage::class) |
|
957 | - ); |
|
958 | - }); |
|
959 | - $this->registerService(SessionStorage::class, function (Server $c) { |
|
960 | - return new SessionStorage($c->getSession()); |
|
961 | - }); |
|
962 | - $this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function (Server $c) { |
|
963 | - return new ContentSecurityPolicyManager(); |
|
964 | - }); |
|
965 | - $this->registerAlias('ContentSecurityPolicyManager', \OCP\Security\IContentSecurityPolicyManager::class); |
|
966 | - |
|
967 | - $this->registerService('ContentSecurityPolicyNonceManager', function (Server $c) { |
|
968 | - return new ContentSecurityPolicyNonceManager( |
|
969 | - $c->getCsrfTokenManager(), |
|
970 | - $c->getRequest() |
|
971 | - ); |
|
972 | - }); |
|
973 | - |
|
974 | - $this->registerService(\OCP\Share\IManager::class, function (Server $c) { |
|
975 | - $config = $c->getConfig(); |
|
976 | - $factoryClass = $config->getSystemValue('sharing.managerFactory', '\OC\Share20\ProviderFactory'); |
|
977 | - /** @var \OCP\Share\IProviderFactory $factory */ |
|
978 | - $factory = new $factoryClass($this); |
|
979 | - |
|
980 | - $manager = new \OC\Share20\Manager( |
|
981 | - $c->getLogger(), |
|
982 | - $c->getConfig(), |
|
983 | - $c->getSecureRandom(), |
|
984 | - $c->getHasher(), |
|
985 | - $c->getMountManager(), |
|
986 | - $c->getGroupManager(), |
|
987 | - $c->getL10N('lib'), |
|
988 | - $c->getL10NFactory(), |
|
989 | - $factory, |
|
990 | - $c->getUserManager(), |
|
991 | - $c->getLazyRootFolder(), |
|
992 | - $c->getEventDispatcher(), |
|
993 | - $c->getMailer(), |
|
994 | - $c->getURLGenerator(), |
|
995 | - $c->getThemingDefaults() |
|
996 | - ); |
|
997 | - |
|
998 | - return $manager; |
|
999 | - }); |
|
1000 | - $this->registerAlias('ShareManager', \OCP\Share\IManager::class); |
|
1001 | - |
|
1002 | - $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function(Server $c) { |
|
1003 | - $instance = new Collaboration\Collaborators\Search($c); |
|
1004 | - |
|
1005 | - // register default plugins |
|
1006 | - $instance->registerPlugin(['shareType' => 'SHARE_TYPE_USER', 'class' => UserPlugin::class]); |
|
1007 | - $instance->registerPlugin(['shareType' => 'SHARE_TYPE_GROUP', 'class' => GroupPlugin::class]); |
|
1008 | - $instance->registerPlugin(['shareType' => 'SHARE_TYPE_EMAIL', 'class' => MailPlugin::class]); |
|
1009 | - $instance->registerPlugin(['shareType' => 'SHARE_TYPE_REMOTE', 'class' => RemotePlugin::class]); |
|
1010 | - |
|
1011 | - return $instance; |
|
1012 | - }); |
|
1013 | - $this->registerAlias('CollaboratorSearch', \OCP\Collaboration\Collaborators\ISearch::class); |
|
1014 | - |
|
1015 | - $this->registerAlias(\OCP\Collaboration\AutoComplete\IManager::class, \OC\Collaboration\AutoComplete\Manager::class); |
|
1016 | - |
|
1017 | - $this->registerService('SettingsManager', function (Server $c) { |
|
1018 | - $manager = new \OC\Settings\Manager( |
|
1019 | - $c->getLogger(), |
|
1020 | - $c->getDatabaseConnection(), |
|
1021 | - $c->getL10N('lib'), |
|
1022 | - $c->getConfig(), |
|
1023 | - $c->getEncryptionManager(), |
|
1024 | - $c->getUserManager(), |
|
1025 | - $c->getLockingProvider(), |
|
1026 | - $c->getRequest(), |
|
1027 | - new \OC\Settings\Mapper($c->getDatabaseConnection()), |
|
1028 | - $c->getURLGenerator(), |
|
1029 | - $c->query(AccountManager::class), |
|
1030 | - $c->getGroupManager(), |
|
1031 | - $c->getL10NFactory(), |
|
1032 | - $c->getThemingDefaults(), |
|
1033 | - $c->getAppManager() |
|
1034 | - ); |
|
1035 | - return $manager; |
|
1036 | - }); |
|
1037 | - $this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) { |
|
1038 | - return new \OC\Files\AppData\Factory( |
|
1039 | - $c->getRootFolder(), |
|
1040 | - $c->getSystemConfig() |
|
1041 | - ); |
|
1042 | - }); |
|
1043 | - |
|
1044 | - $this->registerService('LockdownManager', function (Server $c) { |
|
1045 | - return new LockdownManager(function () use ($c) { |
|
1046 | - return $c->getSession(); |
|
1047 | - }); |
|
1048 | - }); |
|
1049 | - |
|
1050 | - $this->registerService(\OCP\OCS\IDiscoveryService::class, function (Server $c) { |
|
1051 | - return new DiscoveryService($c->getMemCacheFactory(), $c->getHTTPClientService()); |
|
1052 | - }); |
|
1053 | - |
|
1054 | - $this->registerService(ICloudIdManager::class, function (Server $c) { |
|
1055 | - return new CloudIdManager(); |
|
1056 | - }); |
|
1057 | - |
|
1058 | - /* To trick DI since we don't extend the DIContainer here */ |
|
1059 | - $this->registerService(CleanPreviewsBackgroundJob::class, function (Server $c) { |
|
1060 | - return new CleanPreviewsBackgroundJob( |
|
1061 | - $c->getRootFolder(), |
|
1062 | - $c->getLogger(), |
|
1063 | - $c->getJobList(), |
|
1064 | - new TimeFactory() |
|
1065 | - ); |
|
1066 | - }); |
|
1067 | - |
|
1068 | - $this->registerAlias(\OCP\AppFramework\Utility\IControllerMethodReflector::class, \OC\AppFramework\Utility\ControllerMethodReflector::class); |
|
1069 | - $this->registerAlias('ControllerMethodReflector', \OCP\AppFramework\Utility\IControllerMethodReflector::class); |
|
1070 | - |
|
1071 | - $this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class); |
|
1072 | - $this->registerAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class); |
|
1073 | - |
|
1074 | - $this->registerService(Defaults::class, function (Server $c) { |
|
1075 | - return new Defaults( |
|
1076 | - $c->getThemingDefaults() |
|
1077 | - ); |
|
1078 | - }); |
|
1079 | - $this->registerAlias('Defaults', \OCP\Defaults::class); |
|
1080 | - |
|
1081 | - $this->registerService(\OCP\ISession::class, function (SimpleContainer $c) { |
|
1082 | - return $c->query(\OCP\IUserSession::class)->getSession(); |
|
1083 | - }); |
|
1084 | - |
|
1085 | - $this->registerService(IShareHelper::class, function (Server $c) { |
|
1086 | - return new ShareHelper( |
|
1087 | - $c->query(\OCP\Share\IManager::class) |
|
1088 | - ); |
|
1089 | - }); |
|
1090 | - } |
|
1091 | - |
|
1092 | - /** |
|
1093 | - * @return \OCP\Contacts\IManager |
|
1094 | - */ |
|
1095 | - public function getContactsManager() { |
|
1096 | - return $this->query('ContactsManager'); |
|
1097 | - } |
|
1098 | - |
|
1099 | - /** |
|
1100 | - * @return \OC\Encryption\Manager |
|
1101 | - */ |
|
1102 | - public function getEncryptionManager() { |
|
1103 | - return $this->query('EncryptionManager'); |
|
1104 | - } |
|
1105 | - |
|
1106 | - /** |
|
1107 | - * @return \OC\Encryption\File |
|
1108 | - */ |
|
1109 | - public function getEncryptionFilesHelper() { |
|
1110 | - return $this->query('EncryptionFileHelper'); |
|
1111 | - } |
|
1112 | - |
|
1113 | - /** |
|
1114 | - * @return \OCP\Encryption\Keys\IStorage |
|
1115 | - */ |
|
1116 | - public function getEncryptionKeyStorage() { |
|
1117 | - return $this->query('EncryptionKeyStorage'); |
|
1118 | - } |
|
1119 | - |
|
1120 | - /** |
|
1121 | - * The current request object holding all information about the request |
|
1122 | - * currently being processed is returned from this method. |
|
1123 | - * In case the current execution was not initiated by a web request null is returned |
|
1124 | - * |
|
1125 | - * @return \OCP\IRequest |
|
1126 | - */ |
|
1127 | - public function getRequest() { |
|
1128 | - return $this->query('Request'); |
|
1129 | - } |
|
1130 | - |
|
1131 | - /** |
|
1132 | - * Returns the preview manager which can create preview images for a given file |
|
1133 | - * |
|
1134 | - * @return \OCP\IPreview |
|
1135 | - */ |
|
1136 | - public function getPreviewManager() { |
|
1137 | - return $this->query('PreviewManager'); |
|
1138 | - } |
|
1139 | - |
|
1140 | - /** |
|
1141 | - * Returns the tag manager which can get and set tags for different object types |
|
1142 | - * |
|
1143 | - * @see \OCP\ITagManager::load() |
|
1144 | - * @return \OCP\ITagManager |
|
1145 | - */ |
|
1146 | - public function getTagManager() { |
|
1147 | - return $this->query('TagManager'); |
|
1148 | - } |
|
1149 | - |
|
1150 | - /** |
|
1151 | - * Returns the system-tag manager |
|
1152 | - * |
|
1153 | - * @return \OCP\SystemTag\ISystemTagManager |
|
1154 | - * |
|
1155 | - * @since 9.0.0 |
|
1156 | - */ |
|
1157 | - public function getSystemTagManager() { |
|
1158 | - return $this->query('SystemTagManager'); |
|
1159 | - } |
|
1160 | - |
|
1161 | - /** |
|
1162 | - * Returns the system-tag object mapper |
|
1163 | - * |
|
1164 | - * @return \OCP\SystemTag\ISystemTagObjectMapper |
|
1165 | - * |
|
1166 | - * @since 9.0.0 |
|
1167 | - */ |
|
1168 | - public function getSystemTagObjectMapper() { |
|
1169 | - return $this->query('SystemTagObjectMapper'); |
|
1170 | - } |
|
1171 | - |
|
1172 | - /** |
|
1173 | - * Returns the avatar manager, used for avatar functionality |
|
1174 | - * |
|
1175 | - * @return \OCP\IAvatarManager |
|
1176 | - */ |
|
1177 | - public function getAvatarManager() { |
|
1178 | - return $this->query('AvatarManager'); |
|
1179 | - } |
|
1180 | - |
|
1181 | - /** |
|
1182 | - * Returns the root folder of ownCloud's data directory |
|
1183 | - * |
|
1184 | - * @return \OCP\Files\IRootFolder |
|
1185 | - */ |
|
1186 | - public function getRootFolder() { |
|
1187 | - return $this->query('LazyRootFolder'); |
|
1188 | - } |
|
1189 | - |
|
1190 | - /** |
|
1191 | - * Returns the root folder of ownCloud's data directory |
|
1192 | - * This is the lazy variant so this gets only initialized once it |
|
1193 | - * is actually used. |
|
1194 | - * |
|
1195 | - * @return \OCP\Files\IRootFolder |
|
1196 | - */ |
|
1197 | - public function getLazyRootFolder() { |
|
1198 | - return $this->query('LazyRootFolder'); |
|
1199 | - } |
|
1200 | - |
|
1201 | - /** |
|
1202 | - * Returns a view to ownCloud's files folder |
|
1203 | - * |
|
1204 | - * @param string $userId user ID |
|
1205 | - * @return \OCP\Files\Folder|null |
|
1206 | - */ |
|
1207 | - public function getUserFolder($userId = null) { |
|
1208 | - if ($userId === null) { |
|
1209 | - $user = $this->getUserSession()->getUser(); |
|
1210 | - if (!$user) { |
|
1211 | - return null; |
|
1212 | - } |
|
1213 | - $userId = $user->getUID(); |
|
1214 | - } |
|
1215 | - $root = $this->getRootFolder(); |
|
1216 | - return $root->getUserFolder($userId); |
|
1217 | - } |
|
1218 | - |
|
1219 | - /** |
|
1220 | - * Returns an app-specific view in ownClouds data directory |
|
1221 | - * |
|
1222 | - * @return \OCP\Files\Folder |
|
1223 | - * @deprecated since 9.2.0 use IAppData |
|
1224 | - */ |
|
1225 | - public function getAppFolder() { |
|
1226 | - $dir = '/' . \OC_App::getCurrentApp(); |
|
1227 | - $root = $this->getRootFolder(); |
|
1228 | - if (!$root->nodeExists($dir)) { |
|
1229 | - $folder = $root->newFolder($dir); |
|
1230 | - } else { |
|
1231 | - $folder = $root->get($dir); |
|
1232 | - } |
|
1233 | - return $folder; |
|
1234 | - } |
|
1235 | - |
|
1236 | - /** |
|
1237 | - * @return \OC\User\Manager |
|
1238 | - */ |
|
1239 | - public function getUserManager() { |
|
1240 | - return $this->query('UserManager'); |
|
1241 | - } |
|
1242 | - |
|
1243 | - /** |
|
1244 | - * @return \OC\Group\Manager |
|
1245 | - */ |
|
1246 | - public function getGroupManager() { |
|
1247 | - return $this->query('GroupManager'); |
|
1248 | - } |
|
1249 | - |
|
1250 | - /** |
|
1251 | - * @return \OC\User\Session |
|
1252 | - */ |
|
1253 | - public function getUserSession() { |
|
1254 | - return $this->query('UserSession'); |
|
1255 | - } |
|
1256 | - |
|
1257 | - /** |
|
1258 | - * @return \OCP\ISession |
|
1259 | - */ |
|
1260 | - public function getSession() { |
|
1261 | - return $this->query('UserSession')->getSession(); |
|
1262 | - } |
|
1263 | - |
|
1264 | - /** |
|
1265 | - * @param \OCP\ISession $session |
|
1266 | - */ |
|
1267 | - public function setSession(\OCP\ISession $session) { |
|
1268 | - $this->query(SessionStorage::class)->setSession($session); |
|
1269 | - $this->query('UserSession')->setSession($session); |
|
1270 | - $this->query(Store::class)->setSession($session); |
|
1271 | - } |
|
1272 | - |
|
1273 | - /** |
|
1274 | - * @return \OC\Authentication\TwoFactorAuth\Manager |
|
1275 | - */ |
|
1276 | - public function getTwoFactorAuthManager() { |
|
1277 | - return $this->query('\OC\Authentication\TwoFactorAuth\Manager'); |
|
1278 | - } |
|
1279 | - |
|
1280 | - /** |
|
1281 | - * @return \OC\NavigationManager |
|
1282 | - */ |
|
1283 | - public function getNavigationManager() { |
|
1284 | - return $this->query('NavigationManager'); |
|
1285 | - } |
|
1286 | - |
|
1287 | - /** |
|
1288 | - * @return \OCP\IConfig |
|
1289 | - */ |
|
1290 | - public function getConfig() { |
|
1291 | - return $this->query('AllConfig'); |
|
1292 | - } |
|
1293 | - |
|
1294 | - /** |
|
1295 | - * @return \OC\SystemConfig |
|
1296 | - */ |
|
1297 | - public function getSystemConfig() { |
|
1298 | - return $this->query('SystemConfig'); |
|
1299 | - } |
|
1300 | - |
|
1301 | - /** |
|
1302 | - * Returns the app config manager |
|
1303 | - * |
|
1304 | - * @return \OCP\IAppConfig |
|
1305 | - */ |
|
1306 | - public function getAppConfig() { |
|
1307 | - return $this->query('AppConfig'); |
|
1308 | - } |
|
1309 | - |
|
1310 | - /** |
|
1311 | - * @return \OCP\L10N\IFactory |
|
1312 | - */ |
|
1313 | - public function getL10NFactory() { |
|
1314 | - return $this->query('L10NFactory'); |
|
1315 | - } |
|
1316 | - |
|
1317 | - /** |
|
1318 | - * get an L10N instance |
|
1319 | - * |
|
1320 | - * @param string $app appid |
|
1321 | - * @param string $lang |
|
1322 | - * @return IL10N |
|
1323 | - */ |
|
1324 | - public function getL10N($app, $lang = null) { |
|
1325 | - return $this->getL10NFactory()->get($app, $lang); |
|
1326 | - } |
|
1327 | - |
|
1328 | - /** |
|
1329 | - * @return \OCP\IURLGenerator |
|
1330 | - */ |
|
1331 | - public function getURLGenerator() { |
|
1332 | - return $this->query('URLGenerator'); |
|
1333 | - } |
|
1334 | - |
|
1335 | - /** |
|
1336 | - * @return \OCP\IHelper |
|
1337 | - */ |
|
1338 | - public function getHelper() { |
|
1339 | - return $this->query('AppHelper'); |
|
1340 | - } |
|
1341 | - |
|
1342 | - /** |
|
1343 | - * @return AppFetcher |
|
1344 | - */ |
|
1345 | - public function getAppFetcher() { |
|
1346 | - return $this->query(AppFetcher::class); |
|
1347 | - } |
|
1348 | - |
|
1349 | - /** |
|
1350 | - * Returns an ICache instance. Since 8.1.0 it returns a fake cache. Use |
|
1351 | - * getMemCacheFactory() instead. |
|
1352 | - * |
|
1353 | - * @return \OCP\ICache |
|
1354 | - * @deprecated 8.1.0 use getMemCacheFactory to obtain a proper cache |
|
1355 | - */ |
|
1356 | - public function getCache() { |
|
1357 | - return $this->query('UserCache'); |
|
1358 | - } |
|
1359 | - |
|
1360 | - /** |
|
1361 | - * Returns an \OCP\CacheFactory instance |
|
1362 | - * |
|
1363 | - * @return \OCP\ICacheFactory |
|
1364 | - */ |
|
1365 | - public function getMemCacheFactory() { |
|
1366 | - return $this->query('MemCacheFactory'); |
|
1367 | - } |
|
1368 | - |
|
1369 | - /** |
|
1370 | - * Returns an \OC\RedisFactory instance |
|
1371 | - * |
|
1372 | - * @return \OC\RedisFactory |
|
1373 | - */ |
|
1374 | - public function getGetRedisFactory() { |
|
1375 | - return $this->query('RedisFactory'); |
|
1376 | - } |
|
1377 | - |
|
1378 | - |
|
1379 | - /** |
|
1380 | - * Returns the current session |
|
1381 | - * |
|
1382 | - * @return \OCP\IDBConnection |
|
1383 | - */ |
|
1384 | - public function getDatabaseConnection() { |
|
1385 | - return $this->query('DatabaseConnection'); |
|
1386 | - } |
|
1387 | - |
|
1388 | - /** |
|
1389 | - * Returns the activity manager |
|
1390 | - * |
|
1391 | - * @return \OCP\Activity\IManager |
|
1392 | - */ |
|
1393 | - public function getActivityManager() { |
|
1394 | - return $this->query('ActivityManager'); |
|
1395 | - } |
|
1396 | - |
|
1397 | - /** |
|
1398 | - * Returns an job list for controlling background jobs |
|
1399 | - * |
|
1400 | - * @return \OCP\BackgroundJob\IJobList |
|
1401 | - */ |
|
1402 | - public function getJobList() { |
|
1403 | - return $this->query('JobList'); |
|
1404 | - } |
|
1405 | - |
|
1406 | - /** |
|
1407 | - * Returns a logger instance |
|
1408 | - * |
|
1409 | - * @return \OCP\ILogger |
|
1410 | - */ |
|
1411 | - public function getLogger() { |
|
1412 | - return $this->query('Logger'); |
|
1413 | - } |
|
1414 | - |
|
1415 | - /** |
|
1416 | - * Returns a router for generating and matching urls |
|
1417 | - * |
|
1418 | - * @return \OCP\Route\IRouter |
|
1419 | - */ |
|
1420 | - public function getRouter() { |
|
1421 | - return $this->query('Router'); |
|
1422 | - } |
|
1423 | - |
|
1424 | - /** |
|
1425 | - * Returns a search instance |
|
1426 | - * |
|
1427 | - * @return \OCP\ISearch |
|
1428 | - */ |
|
1429 | - public function getSearch() { |
|
1430 | - return $this->query('Search'); |
|
1431 | - } |
|
1432 | - |
|
1433 | - /** |
|
1434 | - * Returns a SecureRandom instance |
|
1435 | - * |
|
1436 | - * @return \OCP\Security\ISecureRandom |
|
1437 | - */ |
|
1438 | - public function getSecureRandom() { |
|
1439 | - return $this->query('SecureRandom'); |
|
1440 | - } |
|
1441 | - |
|
1442 | - /** |
|
1443 | - * Returns a Crypto instance |
|
1444 | - * |
|
1445 | - * @return \OCP\Security\ICrypto |
|
1446 | - */ |
|
1447 | - public function getCrypto() { |
|
1448 | - return $this->query('Crypto'); |
|
1449 | - } |
|
1450 | - |
|
1451 | - /** |
|
1452 | - * Returns a Hasher instance |
|
1453 | - * |
|
1454 | - * @return \OCP\Security\IHasher |
|
1455 | - */ |
|
1456 | - public function getHasher() { |
|
1457 | - return $this->query('Hasher'); |
|
1458 | - } |
|
1459 | - |
|
1460 | - /** |
|
1461 | - * Returns a CredentialsManager instance |
|
1462 | - * |
|
1463 | - * @return \OCP\Security\ICredentialsManager |
|
1464 | - */ |
|
1465 | - public function getCredentialsManager() { |
|
1466 | - return $this->query('CredentialsManager'); |
|
1467 | - } |
|
1468 | - |
|
1469 | - /** |
|
1470 | - * Returns an instance of the HTTP helper class |
|
1471 | - * |
|
1472 | - * @deprecated Use getHTTPClientService() |
|
1473 | - * @return \OC\HTTPHelper |
|
1474 | - */ |
|
1475 | - public function getHTTPHelper() { |
|
1476 | - return $this->query('HTTPHelper'); |
|
1477 | - } |
|
1478 | - |
|
1479 | - /** |
|
1480 | - * Get the certificate manager for the user |
|
1481 | - * |
|
1482 | - * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager |
|
1483 | - * @return \OCP\ICertificateManager | null if $uid is null and no user is logged in |
|
1484 | - */ |
|
1485 | - public function getCertificateManager($userId = '') { |
|
1486 | - if ($userId === '') { |
|
1487 | - $userSession = $this->getUserSession(); |
|
1488 | - $user = $userSession->getUser(); |
|
1489 | - if (is_null($user)) { |
|
1490 | - return null; |
|
1491 | - } |
|
1492 | - $userId = $user->getUID(); |
|
1493 | - } |
|
1494 | - return new CertificateManager( |
|
1495 | - $userId, |
|
1496 | - new View(), |
|
1497 | - $this->getConfig(), |
|
1498 | - $this->getLogger(), |
|
1499 | - $this->getSecureRandom() |
|
1500 | - ); |
|
1501 | - } |
|
1502 | - |
|
1503 | - /** |
|
1504 | - * Returns an instance of the HTTP client service |
|
1505 | - * |
|
1506 | - * @return \OCP\Http\Client\IClientService |
|
1507 | - */ |
|
1508 | - public function getHTTPClientService() { |
|
1509 | - return $this->query('HttpClientService'); |
|
1510 | - } |
|
1511 | - |
|
1512 | - /** |
|
1513 | - * Create a new event source |
|
1514 | - * |
|
1515 | - * @return \OCP\IEventSource |
|
1516 | - */ |
|
1517 | - public function createEventSource() { |
|
1518 | - return new \OC_EventSource(); |
|
1519 | - } |
|
1520 | - |
|
1521 | - /** |
|
1522 | - * Get the active event logger |
|
1523 | - * |
|
1524 | - * The returned logger only logs data when debug mode is enabled |
|
1525 | - * |
|
1526 | - * @return \OCP\Diagnostics\IEventLogger |
|
1527 | - */ |
|
1528 | - public function getEventLogger() { |
|
1529 | - return $this->query('EventLogger'); |
|
1530 | - } |
|
1531 | - |
|
1532 | - /** |
|
1533 | - * Get the active query logger |
|
1534 | - * |
|
1535 | - * The returned logger only logs data when debug mode is enabled |
|
1536 | - * |
|
1537 | - * @return \OCP\Diagnostics\IQueryLogger |
|
1538 | - */ |
|
1539 | - public function getQueryLogger() { |
|
1540 | - return $this->query('QueryLogger'); |
|
1541 | - } |
|
1542 | - |
|
1543 | - /** |
|
1544 | - * Get the manager for temporary files and folders |
|
1545 | - * |
|
1546 | - * @return \OCP\ITempManager |
|
1547 | - */ |
|
1548 | - public function getTempManager() { |
|
1549 | - return $this->query('TempManager'); |
|
1550 | - } |
|
1551 | - |
|
1552 | - /** |
|
1553 | - * Get the app manager |
|
1554 | - * |
|
1555 | - * @return \OCP\App\IAppManager |
|
1556 | - */ |
|
1557 | - public function getAppManager() { |
|
1558 | - return $this->query('AppManager'); |
|
1559 | - } |
|
1560 | - |
|
1561 | - /** |
|
1562 | - * Creates a new mailer |
|
1563 | - * |
|
1564 | - * @return \OCP\Mail\IMailer |
|
1565 | - */ |
|
1566 | - public function getMailer() { |
|
1567 | - return $this->query('Mailer'); |
|
1568 | - } |
|
1569 | - |
|
1570 | - /** |
|
1571 | - * Get the webroot |
|
1572 | - * |
|
1573 | - * @return string |
|
1574 | - */ |
|
1575 | - public function getWebRoot() { |
|
1576 | - return $this->webRoot; |
|
1577 | - } |
|
1578 | - |
|
1579 | - /** |
|
1580 | - * @return \OC\OCSClient |
|
1581 | - */ |
|
1582 | - public function getOcsClient() { |
|
1583 | - return $this->query('OcsClient'); |
|
1584 | - } |
|
1585 | - |
|
1586 | - /** |
|
1587 | - * @return \OCP\IDateTimeZone |
|
1588 | - */ |
|
1589 | - public function getDateTimeZone() { |
|
1590 | - return $this->query('DateTimeZone'); |
|
1591 | - } |
|
1592 | - |
|
1593 | - /** |
|
1594 | - * @return \OCP\IDateTimeFormatter |
|
1595 | - */ |
|
1596 | - public function getDateTimeFormatter() { |
|
1597 | - return $this->query('DateTimeFormatter'); |
|
1598 | - } |
|
1599 | - |
|
1600 | - /** |
|
1601 | - * @return \OCP\Files\Config\IMountProviderCollection |
|
1602 | - */ |
|
1603 | - public function getMountProviderCollection() { |
|
1604 | - return $this->query('MountConfigManager'); |
|
1605 | - } |
|
1606 | - |
|
1607 | - /** |
|
1608 | - * Get the IniWrapper |
|
1609 | - * |
|
1610 | - * @return IniGetWrapper |
|
1611 | - */ |
|
1612 | - public function getIniWrapper() { |
|
1613 | - return $this->query('IniWrapper'); |
|
1614 | - } |
|
1615 | - |
|
1616 | - /** |
|
1617 | - * @return \OCP\Command\IBus |
|
1618 | - */ |
|
1619 | - public function getCommandBus() { |
|
1620 | - return $this->query('AsyncCommandBus'); |
|
1621 | - } |
|
1622 | - |
|
1623 | - /** |
|
1624 | - * Get the trusted domain helper |
|
1625 | - * |
|
1626 | - * @return TrustedDomainHelper |
|
1627 | - */ |
|
1628 | - public function getTrustedDomainHelper() { |
|
1629 | - return $this->query('TrustedDomainHelper'); |
|
1630 | - } |
|
1631 | - |
|
1632 | - /** |
|
1633 | - * Get the locking provider |
|
1634 | - * |
|
1635 | - * @return \OCP\Lock\ILockingProvider |
|
1636 | - * @since 8.1.0 |
|
1637 | - */ |
|
1638 | - public function getLockingProvider() { |
|
1639 | - return $this->query('LockingProvider'); |
|
1640 | - } |
|
1641 | - |
|
1642 | - /** |
|
1643 | - * @return \OCP\Files\Mount\IMountManager |
|
1644 | - **/ |
|
1645 | - function getMountManager() { |
|
1646 | - return $this->query('MountManager'); |
|
1647 | - } |
|
1648 | - |
|
1649 | - /** @return \OCP\Files\Config\IUserMountCache */ |
|
1650 | - function getUserMountCache() { |
|
1651 | - return $this->query('UserMountCache'); |
|
1652 | - } |
|
1653 | - |
|
1654 | - /** |
|
1655 | - * Get the MimeTypeDetector |
|
1656 | - * |
|
1657 | - * @return \OCP\Files\IMimeTypeDetector |
|
1658 | - */ |
|
1659 | - public function getMimeTypeDetector() { |
|
1660 | - return $this->query('MimeTypeDetector'); |
|
1661 | - } |
|
1662 | - |
|
1663 | - /** |
|
1664 | - * Get the MimeTypeLoader |
|
1665 | - * |
|
1666 | - * @return \OCP\Files\IMimeTypeLoader |
|
1667 | - */ |
|
1668 | - public function getMimeTypeLoader() { |
|
1669 | - return $this->query('MimeTypeLoader'); |
|
1670 | - } |
|
1671 | - |
|
1672 | - /** |
|
1673 | - * Get the manager of all the capabilities |
|
1674 | - * |
|
1675 | - * @return \OC\CapabilitiesManager |
|
1676 | - */ |
|
1677 | - public function getCapabilitiesManager() { |
|
1678 | - return $this->query('CapabilitiesManager'); |
|
1679 | - } |
|
1680 | - |
|
1681 | - /** |
|
1682 | - * Get the EventDispatcher |
|
1683 | - * |
|
1684 | - * @return EventDispatcherInterface |
|
1685 | - * @since 8.2.0 |
|
1686 | - */ |
|
1687 | - public function getEventDispatcher() { |
|
1688 | - return $this->query('EventDispatcher'); |
|
1689 | - } |
|
1690 | - |
|
1691 | - /** |
|
1692 | - * Get the Notification Manager |
|
1693 | - * |
|
1694 | - * @return \OCP\Notification\IManager |
|
1695 | - * @since 8.2.0 |
|
1696 | - */ |
|
1697 | - public function getNotificationManager() { |
|
1698 | - return $this->query('NotificationManager'); |
|
1699 | - } |
|
1700 | - |
|
1701 | - /** |
|
1702 | - * @return \OCP\Comments\ICommentsManager |
|
1703 | - */ |
|
1704 | - public function getCommentsManager() { |
|
1705 | - return $this->query('CommentsManager'); |
|
1706 | - } |
|
1707 | - |
|
1708 | - /** |
|
1709 | - * @return \OCA\Theming\ThemingDefaults |
|
1710 | - */ |
|
1711 | - public function getThemingDefaults() { |
|
1712 | - return $this->query('ThemingDefaults'); |
|
1713 | - } |
|
1714 | - |
|
1715 | - /** |
|
1716 | - * @return \OC\IntegrityCheck\Checker |
|
1717 | - */ |
|
1718 | - public function getIntegrityCodeChecker() { |
|
1719 | - return $this->query('IntegrityCodeChecker'); |
|
1720 | - } |
|
1721 | - |
|
1722 | - /** |
|
1723 | - * @return \OC\Session\CryptoWrapper |
|
1724 | - */ |
|
1725 | - public function getSessionCryptoWrapper() { |
|
1726 | - return $this->query('CryptoWrapper'); |
|
1727 | - } |
|
1728 | - |
|
1729 | - /** |
|
1730 | - * @return CsrfTokenManager |
|
1731 | - */ |
|
1732 | - public function getCsrfTokenManager() { |
|
1733 | - return $this->query('CsrfTokenManager'); |
|
1734 | - } |
|
1735 | - |
|
1736 | - /** |
|
1737 | - * @return Throttler |
|
1738 | - */ |
|
1739 | - public function getBruteForceThrottler() { |
|
1740 | - return $this->query('Throttler'); |
|
1741 | - } |
|
1742 | - |
|
1743 | - /** |
|
1744 | - * @return IContentSecurityPolicyManager |
|
1745 | - */ |
|
1746 | - public function getContentSecurityPolicyManager() { |
|
1747 | - return $this->query('ContentSecurityPolicyManager'); |
|
1748 | - } |
|
1749 | - |
|
1750 | - /** |
|
1751 | - * @return ContentSecurityPolicyNonceManager |
|
1752 | - */ |
|
1753 | - public function getContentSecurityPolicyNonceManager() { |
|
1754 | - return $this->query('ContentSecurityPolicyNonceManager'); |
|
1755 | - } |
|
1756 | - |
|
1757 | - /** |
|
1758 | - * Not a public API as of 8.2, wait for 9.0 |
|
1759 | - * |
|
1760 | - * @return \OCA\Files_External\Service\BackendService |
|
1761 | - */ |
|
1762 | - public function getStoragesBackendService() { |
|
1763 | - return $this->query('OCA\\Files_External\\Service\\BackendService'); |
|
1764 | - } |
|
1765 | - |
|
1766 | - /** |
|
1767 | - * Not a public API as of 8.2, wait for 9.0 |
|
1768 | - * |
|
1769 | - * @return \OCA\Files_External\Service\GlobalStoragesService |
|
1770 | - */ |
|
1771 | - public function getGlobalStoragesService() { |
|
1772 | - return $this->query('OCA\\Files_External\\Service\\GlobalStoragesService'); |
|
1773 | - } |
|
1774 | - |
|
1775 | - /** |
|
1776 | - * Not a public API as of 8.2, wait for 9.0 |
|
1777 | - * |
|
1778 | - * @return \OCA\Files_External\Service\UserGlobalStoragesService |
|
1779 | - */ |
|
1780 | - public function getUserGlobalStoragesService() { |
|
1781 | - return $this->query('OCA\\Files_External\\Service\\UserGlobalStoragesService'); |
|
1782 | - } |
|
1783 | - |
|
1784 | - /** |
|
1785 | - * Not a public API as of 8.2, wait for 9.0 |
|
1786 | - * |
|
1787 | - * @return \OCA\Files_External\Service\UserStoragesService |
|
1788 | - */ |
|
1789 | - public function getUserStoragesService() { |
|
1790 | - return $this->query('OCA\\Files_External\\Service\\UserStoragesService'); |
|
1791 | - } |
|
1792 | - |
|
1793 | - /** |
|
1794 | - * @return \OCP\Share\IManager |
|
1795 | - */ |
|
1796 | - public function getShareManager() { |
|
1797 | - return $this->query('ShareManager'); |
|
1798 | - } |
|
1799 | - |
|
1800 | - /** |
|
1801 | - * @return \OCP\Collaboration\Collaborators\ISearch |
|
1802 | - */ |
|
1803 | - public function getCollaboratorSearch() { |
|
1804 | - return $this->query('CollaboratorSearch'); |
|
1805 | - } |
|
1806 | - |
|
1807 | - /** |
|
1808 | - * @return \OCP\Collaboration\AutoComplete\IManager |
|
1809 | - */ |
|
1810 | - public function getAutoCompleteManager(){ |
|
1811 | - return $this->query(IManager::class); |
|
1812 | - } |
|
1813 | - |
|
1814 | - /** |
|
1815 | - * Returns the LDAP Provider |
|
1816 | - * |
|
1817 | - * @return \OCP\LDAP\ILDAPProvider |
|
1818 | - */ |
|
1819 | - public function getLDAPProvider() { |
|
1820 | - return $this->query('LDAPProvider'); |
|
1821 | - } |
|
1822 | - |
|
1823 | - /** |
|
1824 | - * @return \OCP\Settings\IManager |
|
1825 | - */ |
|
1826 | - public function getSettingsManager() { |
|
1827 | - return $this->query('SettingsManager'); |
|
1828 | - } |
|
1829 | - |
|
1830 | - /** |
|
1831 | - * @return \OCP\Files\IAppData |
|
1832 | - */ |
|
1833 | - public function getAppDataDir($app) { |
|
1834 | - /** @var \OC\Files\AppData\Factory $factory */ |
|
1835 | - $factory = $this->query(\OC\Files\AppData\Factory::class); |
|
1836 | - return $factory->get($app); |
|
1837 | - } |
|
1838 | - |
|
1839 | - /** |
|
1840 | - * @return \OCP\Lockdown\ILockdownManager |
|
1841 | - */ |
|
1842 | - public function getLockdownManager() { |
|
1843 | - return $this->query('LockdownManager'); |
|
1844 | - } |
|
1845 | - |
|
1846 | - /** |
|
1847 | - * @return \OCP\Federation\ICloudIdManager |
|
1848 | - */ |
|
1849 | - public function getCloudIdManager() { |
|
1850 | - return $this->query(ICloudIdManager::class); |
|
1851 | - } |
|
887 | + $prefixes = \OC::$composerAutoloader->getPrefixesPsr4(); |
|
888 | + if (isset($prefixes['OCA\\Theming\\'])) { |
|
889 | + $classExists = true; |
|
890 | + } else { |
|
891 | + $classExists = false; |
|
892 | + } |
|
893 | + |
|
894 | + if ($classExists && $c->getConfig()->getSystemValue('installed', false) && $c->getAppManager()->isInstalled('theming') && $c->getTrustedDomainHelper()->isTrustedDomain($c->getRequest()->getInsecureServerHost())) { |
|
895 | + return new ThemingDefaults( |
|
896 | + $c->getConfig(), |
|
897 | + $c->getL10N('theming'), |
|
898 | + $c->getURLGenerator(), |
|
899 | + $c->getAppDataDir('theming'), |
|
900 | + $c->getMemCacheFactory(), |
|
901 | + new Util($c->getConfig(), $this->getAppManager(), $this->getAppDataDir('theming')), |
|
902 | + $this->getAppManager() |
|
903 | + ); |
|
904 | + } |
|
905 | + return new \OC_Defaults(); |
|
906 | + }); |
|
907 | + $this->registerService(SCSSCacher::class, function (Server $c) { |
|
908 | + /** @var Factory $cacheFactory */ |
|
909 | + $cacheFactory = $c->query(Factory::class); |
|
910 | + return new SCSSCacher( |
|
911 | + $c->getLogger(), |
|
912 | + $c->query(\OC\Files\AppData\Factory::class), |
|
913 | + $c->getURLGenerator(), |
|
914 | + $c->getConfig(), |
|
915 | + $c->getThemingDefaults(), |
|
916 | + \OC::$SERVERROOT, |
|
917 | + $cacheFactory->create('SCSS') |
|
918 | + ); |
|
919 | + }); |
|
920 | + $this->registerService(EventDispatcher::class, function () { |
|
921 | + return new EventDispatcher(); |
|
922 | + }); |
|
923 | + $this->registerAlias('EventDispatcher', EventDispatcher::class); |
|
924 | + $this->registerAlias(EventDispatcherInterface::class, EventDispatcher::class); |
|
925 | + |
|
926 | + $this->registerService('CryptoWrapper', function (Server $c) { |
|
927 | + // FIXME: Instantiiated here due to cyclic dependency |
|
928 | + $request = new Request( |
|
929 | + [ |
|
930 | + 'get' => $_GET, |
|
931 | + 'post' => $_POST, |
|
932 | + 'files' => $_FILES, |
|
933 | + 'server' => $_SERVER, |
|
934 | + 'env' => $_ENV, |
|
935 | + 'cookies' => $_COOKIE, |
|
936 | + 'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD'])) |
|
937 | + ? $_SERVER['REQUEST_METHOD'] |
|
938 | + : null, |
|
939 | + ], |
|
940 | + $c->getSecureRandom(), |
|
941 | + $c->getConfig() |
|
942 | + ); |
|
943 | + |
|
944 | + return new CryptoWrapper( |
|
945 | + $c->getConfig(), |
|
946 | + $c->getCrypto(), |
|
947 | + $c->getSecureRandom(), |
|
948 | + $request |
|
949 | + ); |
|
950 | + }); |
|
951 | + $this->registerService('CsrfTokenManager', function (Server $c) { |
|
952 | + $tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom()); |
|
953 | + |
|
954 | + return new CsrfTokenManager( |
|
955 | + $tokenGenerator, |
|
956 | + $c->query(SessionStorage::class) |
|
957 | + ); |
|
958 | + }); |
|
959 | + $this->registerService(SessionStorage::class, function (Server $c) { |
|
960 | + return new SessionStorage($c->getSession()); |
|
961 | + }); |
|
962 | + $this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function (Server $c) { |
|
963 | + return new ContentSecurityPolicyManager(); |
|
964 | + }); |
|
965 | + $this->registerAlias('ContentSecurityPolicyManager', \OCP\Security\IContentSecurityPolicyManager::class); |
|
966 | + |
|
967 | + $this->registerService('ContentSecurityPolicyNonceManager', function (Server $c) { |
|
968 | + return new ContentSecurityPolicyNonceManager( |
|
969 | + $c->getCsrfTokenManager(), |
|
970 | + $c->getRequest() |
|
971 | + ); |
|
972 | + }); |
|
973 | + |
|
974 | + $this->registerService(\OCP\Share\IManager::class, function (Server $c) { |
|
975 | + $config = $c->getConfig(); |
|
976 | + $factoryClass = $config->getSystemValue('sharing.managerFactory', '\OC\Share20\ProviderFactory'); |
|
977 | + /** @var \OCP\Share\IProviderFactory $factory */ |
|
978 | + $factory = new $factoryClass($this); |
|
979 | + |
|
980 | + $manager = new \OC\Share20\Manager( |
|
981 | + $c->getLogger(), |
|
982 | + $c->getConfig(), |
|
983 | + $c->getSecureRandom(), |
|
984 | + $c->getHasher(), |
|
985 | + $c->getMountManager(), |
|
986 | + $c->getGroupManager(), |
|
987 | + $c->getL10N('lib'), |
|
988 | + $c->getL10NFactory(), |
|
989 | + $factory, |
|
990 | + $c->getUserManager(), |
|
991 | + $c->getLazyRootFolder(), |
|
992 | + $c->getEventDispatcher(), |
|
993 | + $c->getMailer(), |
|
994 | + $c->getURLGenerator(), |
|
995 | + $c->getThemingDefaults() |
|
996 | + ); |
|
997 | + |
|
998 | + return $manager; |
|
999 | + }); |
|
1000 | + $this->registerAlias('ShareManager', \OCP\Share\IManager::class); |
|
1001 | + |
|
1002 | + $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function(Server $c) { |
|
1003 | + $instance = new Collaboration\Collaborators\Search($c); |
|
1004 | + |
|
1005 | + // register default plugins |
|
1006 | + $instance->registerPlugin(['shareType' => 'SHARE_TYPE_USER', 'class' => UserPlugin::class]); |
|
1007 | + $instance->registerPlugin(['shareType' => 'SHARE_TYPE_GROUP', 'class' => GroupPlugin::class]); |
|
1008 | + $instance->registerPlugin(['shareType' => 'SHARE_TYPE_EMAIL', 'class' => MailPlugin::class]); |
|
1009 | + $instance->registerPlugin(['shareType' => 'SHARE_TYPE_REMOTE', 'class' => RemotePlugin::class]); |
|
1010 | + |
|
1011 | + return $instance; |
|
1012 | + }); |
|
1013 | + $this->registerAlias('CollaboratorSearch', \OCP\Collaboration\Collaborators\ISearch::class); |
|
1014 | + |
|
1015 | + $this->registerAlias(\OCP\Collaboration\AutoComplete\IManager::class, \OC\Collaboration\AutoComplete\Manager::class); |
|
1016 | + |
|
1017 | + $this->registerService('SettingsManager', function (Server $c) { |
|
1018 | + $manager = new \OC\Settings\Manager( |
|
1019 | + $c->getLogger(), |
|
1020 | + $c->getDatabaseConnection(), |
|
1021 | + $c->getL10N('lib'), |
|
1022 | + $c->getConfig(), |
|
1023 | + $c->getEncryptionManager(), |
|
1024 | + $c->getUserManager(), |
|
1025 | + $c->getLockingProvider(), |
|
1026 | + $c->getRequest(), |
|
1027 | + new \OC\Settings\Mapper($c->getDatabaseConnection()), |
|
1028 | + $c->getURLGenerator(), |
|
1029 | + $c->query(AccountManager::class), |
|
1030 | + $c->getGroupManager(), |
|
1031 | + $c->getL10NFactory(), |
|
1032 | + $c->getThemingDefaults(), |
|
1033 | + $c->getAppManager() |
|
1034 | + ); |
|
1035 | + return $manager; |
|
1036 | + }); |
|
1037 | + $this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) { |
|
1038 | + return new \OC\Files\AppData\Factory( |
|
1039 | + $c->getRootFolder(), |
|
1040 | + $c->getSystemConfig() |
|
1041 | + ); |
|
1042 | + }); |
|
1043 | + |
|
1044 | + $this->registerService('LockdownManager', function (Server $c) { |
|
1045 | + return new LockdownManager(function () use ($c) { |
|
1046 | + return $c->getSession(); |
|
1047 | + }); |
|
1048 | + }); |
|
1049 | + |
|
1050 | + $this->registerService(\OCP\OCS\IDiscoveryService::class, function (Server $c) { |
|
1051 | + return new DiscoveryService($c->getMemCacheFactory(), $c->getHTTPClientService()); |
|
1052 | + }); |
|
1053 | + |
|
1054 | + $this->registerService(ICloudIdManager::class, function (Server $c) { |
|
1055 | + return new CloudIdManager(); |
|
1056 | + }); |
|
1057 | + |
|
1058 | + /* To trick DI since we don't extend the DIContainer here */ |
|
1059 | + $this->registerService(CleanPreviewsBackgroundJob::class, function (Server $c) { |
|
1060 | + return new CleanPreviewsBackgroundJob( |
|
1061 | + $c->getRootFolder(), |
|
1062 | + $c->getLogger(), |
|
1063 | + $c->getJobList(), |
|
1064 | + new TimeFactory() |
|
1065 | + ); |
|
1066 | + }); |
|
1067 | + |
|
1068 | + $this->registerAlias(\OCP\AppFramework\Utility\IControllerMethodReflector::class, \OC\AppFramework\Utility\ControllerMethodReflector::class); |
|
1069 | + $this->registerAlias('ControllerMethodReflector', \OCP\AppFramework\Utility\IControllerMethodReflector::class); |
|
1070 | + |
|
1071 | + $this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class); |
|
1072 | + $this->registerAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class); |
|
1073 | + |
|
1074 | + $this->registerService(Defaults::class, function (Server $c) { |
|
1075 | + return new Defaults( |
|
1076 | + $c->getThemingDefaults() |
|
1077 | + ); |
|
1078 | + }); |
|
1079 | + $this->registerAlias('Defaults', \OCP\Defaults::class); |
|
1080 | + |
|
1081 | + $this->registerService(\OCP\ISession::class, function (SimpleContainer $c) { |
|
1082 | + return $c->query(\OCP\IUserSession::class)->getSession(); |
|
1083 | + }); |
|
1084 | + |
|
1085 | + $this->registerService(IShareHelper::class, function (Server $c) { |
|
1086 | + return new ShareHelper( |
|
1087 | + $c->query(\OCP\Share\IManager::class) |
|
1088 | + ); |
|
1089 | + }); |
|
1090 | + } |
|
1091 | + |
|
1092 | + /** |
|
1093 | + * @return \OCP\Contacts\IManager |
|
1094 | + */ |
|
1095 | + public function getContactsManager() { |
|
1096 | + return $this->query('ContactsManager'); |
|
1097 | + } |
|
1098 | + |
|
1099 | + /** |
|
1100 | + * @return \OC\Encryption\Manager |
|
1101 | + */ |
|
1102 | + public function getEncryptionManager() { |
|
1103 | + return $this->query('EncryptionManager'); |
|
1104 | + } |
|
1105 | + |
|
1106 | + /** |
|
1107 | + * @return \OC\Encryption\File |
|
1108 | + */ |
|
1109 | + public function getEncryptionFilesHelper() { |
|
1110 | + return $this->query('EncryptionFileHelper'); |
|
1111 | + } |
|
1112 | + |
|
1113 | + /** |
|
1114 | + * @return \OCP\Encryption\Keys\IStorage |
|
1115 | + */ |
|
1116 | + public function getEncryptionKeyStorage() { |
|
1117 | + return $this->query('EncryptionKeyStorage'); |
|
1118 | + } |
|
1119 | + |
|
1120 | + /** |
|
1121 | + * The current request object holding all information about the request |
|
1122 | + * currently being processed is returned from this method. |
|
1123 | + * In case the current execution was not initiated by a web request null is returned |
|
1124 | + * |
|
1125 | + * @return \OCP\IRequest |
|
1126 | + */ |
|
1127 | + public function getRequest() { |
|
1128 | + return $this->query('Request'); |
|
1129 | + } |
|
1130 | + |
|
1131 | + /** |
|
1132 | + * Returns the preview manager which can create preview images for a given file |
|
1133 | + * |
|
1134 | + * @return \OCP\IPreview |
|
1135 | + */ |
|
1136 | + public function getPreviewManager() { |
|
1137 | + return $this->query('PreviewManager'); |
|
1138 | + } |
|
1139 | + |
|
1140 | + /** |
|
1141 | + * Returns the tag manager which can get and set tags for different object types |
|
1142 | + * |
|
1143 | + * @see \OCP\ITagManager::load() |
|
1144 | + * @return \OCP\ITagManager |
|
1145 | + */ |
|
1146 | + public function getTagManager() { |
|
1147 | + return $this->query('TagManager'); |
|
1148 | + } |
|
1149 | + |
|
1150 | + /** |
|
1151 | + * Returns the system-tag manager |
|
1152 | + * |
|
1153 | + * @return \OCP\SystemTag\ISystemTagManager |
|
1154 | + * |
|
1155 | + * @since 9.0.0 |
|
1156 | + */ |
|
1157 | + public function getSystemTagManager() { |
|
1158 | + return $this->query('SystemTagManager'); |
|
1159 | + } |
|
1160 | + |
|
1161 | + /** |
|
1162 | + * Returns the system-tag object mapper |
|
1163 | + * |
|
1164 | + * @return \OCP\SystemTag\ISystemTagObjectMapper |
|
1165 | + * |
|
1166 | + * @since 9.0.0 |
|
1167 | + */ |
|
1168 | + public function getSystemTagObjectMapper() { |
|
1169 | + return $this->query('SystemTagObjectMapper'); |
|
1170 | + } |
|
1171 | + |
|
1172 | + /** |
|
1173 | + * Returns the avatar manager, used for avatar functionality |
|
1174 | + * |
|
1175 | + * @return \OCP\IAvatarManager |
|
1176 | + */ |
|
1177 | + public function getAvatarManager() { |
|
1178 | + return $this->query('AvatarManager'); |
|
1179 | + } |
|
1180 | + |
|
1181 | + /** |
|
1182 | + * Returns the root folder of ownCloud's data directory |
|
1183 | + * |
|
1184 | + * @return \OCP\Files\IRootFolder |
|
1185 | + */ |
|
1186 | + public function getRootFolder() { |
|
1187 | + return $this->query('LazyRootFolder'); |
|
1188 | + } |
|
1189 | + |
|
1190 | + /** |
|
1191 | + * Returns the root folder of ownCloud's data directory |
|
1192 | + * This is the lazy variant so this gets only initialized once it |
|
1193 | + * is actually used. |
|
1194 | + * |
|
1195 | + * @return \OCP\Files\IRootFolder |
|
1196 | + */ |
|
1197 | + public function getLazyRootFolder() { |
|
1198 | + return $this->query('LazyRootFolder'); |
|
1199 | + } |
|
1200 | + |
|
1201 | + /** |
|
1202 | + * Returns a view to ownCloud's files folder |
|
1203 | + * |
|
1204 | + * @param string $userId user ID |
|
1205 | + * @return \OCP\Files\Folder|null |
|
1206 | + */ |
|
1207 | + public function getUserFolder($userId = null) { |
|
1208 | + if ($userId === null) { |
|
1209 | + $user = $this->getUserSession()->getUser(); |
|
1210 | + if (!$user) { |
|
1211 | + return null; |
|
1212 | + } |
|
1213 | + $userId = $user->getUID(); |
|
1214 | + } |
|
1215 | + $root = $this->getRootFolder(); |
|
1216 | + return $root->getUserFolder($userId); |
|
1217 | + } |
|
1218 | + |
|
1219 | + /** |
|
1220 | + * Returns an app-specific view in ownClouds data directory |
|
1221 | + * |
|
1222 | + * @return \OCP\Files\Folder |
|
1223 | + * @deprecated since 9.2.0 use IAppData |
|
1224 | + */ |
|
1225 | + public function getAppFolder() { |
|
1226 | + $dir = '/' . \OC_App::getCurrentApp(); |
|
1227 | + $root = $this->getRootFolder(); |
|
1228 | + if (!$root->nodeExists($dir)) { |
|
1229 | + $folder = $root->newFolder($dir); |
|
1230 | + } else { |
|
1231 | + $folder = $root->get($dir); |
|
1232 | + } |
|
1233 | + return $folder; |
|
1234 | + } |
|
1235 | + |
|
1236 | + /** |
|
1237 | + * @return \OC\User\Manager |
|
1238 | + */ |
|
1239 | + public function getUserManager() { |
|
1240 | + return $this->query('UserManager'); |
|
1241 | + } |
|
1242 | + |
|
1243 | + /** |
|
1244 | + * @return \OC\Group\Manager |
|
1245 | + */ |
|
1246 | + public function getGroupManager() { |
|
1247 | + return $this->query('GroupManager'); |
|
1248 | + } |
|
1249 | + |
|
1250 | + /** |
|
1251 | + * @return \OC\User\Session |
|
1252 | + */ |
|
1253 | + public function getUserSession() { |
|
1254 | + return $this->query('UserSession'); |
|
1255 | + } |
|
1256 | + |
|
1257 | + /** |
|
1258 | + * @return \OCP\ISession |
|
1259 | + */ |
|
1260 | + public function getSession() { |
|
1261 | + return $this->query('UserSession')->getSession(); |
|
1262 | + } |
|
1263 | + |
|
1264 | + /** |
|
1265 | + * @param \OCP\ISession $session |
|
1266 | + */ |
|
1267 | + public function setSession(\OCP\ISession $session) { |
|
1268 | + $this->query(SessionStorage::class)->setSession($session); |
|
1269 | + $this->query('UserSession')->setSession($session); |
|
1270 | + $this->query(Store::class)->setSession($session); |
|
1271 | + } |
|
1272 | + |
|
1273 | + /** |
|
1274 | + * @return \OC\Authentication\TwoFactorAuth\Manager |
|
1275 | + */ |
|
1276 | + public function getTwoFactorAuthManager() { |
|
1277 | + return $this->query('\OC\Authentication\TwoFactorAuth\Manager'); |
|
1278 | + } |
|
1279 | + |
|
1280 | + /** |
|
1281 | + * @return \OC\NavigationManager |
|
1282 | + */ |
|
1283 | + public function getNavigationManager() { |
|
1284 | + return $this->query('NavigationManager'); |
|
1285 | + } |
|
1286 | + |
|
1287 | + /** |
|
1288 | + * @return \OCP\IConfig |
|
1289 | + */ |
|
1290 | + public function getConfig() { |
|
1291 | + return $this->query('AllConfig'); |
|
1292 | + } |
|
1293 | + |
|
1294 | + /** |
|
1295 | + * @return \OC\SystemConfig |
|
1296 | + */ |
|
1297 | + public function getSystemConfig() { |
|
1298 | + return $this->query('SystemConfig'); |
|
1299 | + } |
|
1300 | + |
|
1301 | + /** |
|
1302 | + * Returns the app config manager |
|
1303 | + * |
|
1304 | + * @return \OCP\IAppConfig |
|
1305 | + */ |
|
1306 | + public function getAppConfig() { |
|
1307 | + return $this->query('AppConfig'); |
|
1308 | + } |
|
1309 | + |
|
1310 | + /** |
|
1311 | + * @return \OCP\L10N\IFactory |
|
1312 | + */ |
|
1313 | + public function getL10NFactory() { |
|
1314 | + return $this->query('L10NFactory'); |
|
1315 | + } |
|
1316 | + |
|
1317 | + /** |
|
1318 | + * get an L10N instance |
|
1319 | + * |
|
1320 | + * @param string $app appid |
|
1321 | + * @param string $lang |
|
1322 | + * @return IL10N |
|
1323 | + */ |
|
1324 | + public function getL10N($app, $lang = null) { |
|
1325 | + return $this->getL10NFactory()->get($app, $lang); |
|
1326 | + } |
|
1327 | + |
|
1328 | + /** |
|
1329 | + * @return \OCP\IURLGenerator |
|
1330 | + */ |
|
1331 | + public function getURLGenerator() { |
|
1332 | + return $this->query('URLGenerator'); |
|
1333 | + } |
|
1334 | + |
|
1335 | + /** |
|
1336 | + * @return \OCP\IHelper |
|
1337 | + */ |
|
1338 | + public function getHelper() { |
|
1339 | + return $this->query('AppHelper'); |
|
1340 | + } |
|
1341 | + |
|
1342 | + /** |
|
1343 | + * @return AppFetcher |
|
1344 | + */ |
|
1345 | + public function getAppFetcher() { |
|
1346 | + return $this->query(AppFetcher::class); |
|
1347 | + } |
|
1348 | + |
|
1349 | + /** |
|
1350 | + * Returns an ICache instance. Since 8.1.0 it returns a fake cache. Use |
|
1351 | + * getMemCacheFactory() instead. |
|
1352 | + * |
|
1353 | + * @return \OCP\ICache |
|
1354 | + * @deprecated 8.1.0 use getMemCacheFactory to obtain a proper cache |
|
1355 | + */ |
|
1356 | + public function getCache() { |
|
1357 | + return $this->query('UserCache'); |
|
1358 | + } |
|
1359 | + |
|
1360 | + /** |
|
1361 | + * Returns an \OCP\CacheFactory instance |
|
1362 | + * |
|
1363 | + * @return \OCP\ICacheFactory |
|
1364 | + */ |
|
1365 | + public function getMemCacheFactory() { |
|
1366 | + return $this->query('MemCacheFactory'); |
|
1367 | + } |
|
1368 | + |
|
1369 | + /** |
|
1370 | + * Returns an \OC\RedisFactory instance |
|
1371 | + * |
|
1372 | + * @return \OC\RedisFactory |
|
1373 | + */ |
|
1374 | + public function getGetRedisFactory() { |
|
1375 | + return $this->query('RedisFactory'); |
|
1376 | + } |
|
1377 | + |
|
1378 | + |
|
1379 | + /** |
|
1380 | + * Returns the current session |
|
1381 | + * |
|
1382 | + * @return \OCP\IDBConnection |
|
1383 | + */ |
|
1384 | + public function getDatabaseConnection() { |
|
1385 | + return $this->query('DatabaseConnection'); |
|
1386 | + } |
|
1387 | + |
|
1388 | + /** |
|
1389 | + * Returns the activity manager |
|
1390 | + * |
|
1391 | + * @return \OCP\Activity\IManager |
|
1392 | + */ |
|
1393 | + public function getActivityManager() { |
|
1394 | + return $this->query('ActivityManager'); |
|
1395 | + } |
|
1396 | + |
|
1397 | + /** |
|
1398 | + * Returns an job list for controlling background jobs |
|
1399 | + * |
|
1400 | + * @return \OCP\BackgroundJob\IJobList |
|
1401 | + */ |
|
1402 | + public function getJobList() { |
|
1403 | + return $this->query('JobList'); |
|
1404 | + } |
|
1405 | + |
|
1406 | + /** |
|
1407 | + * Returns a logger instance |
|
1408 | + * |
|
1409 | + * @return \OCP\ILogger |
|
1410 | + */ |
|
1411 | + public function getLogger() { |
|
1412 | + return $this->query('Logger'); |
|
1413 | + } |
|
1414 | + |
|
1415 | + /** |
|
1416 | + * Returns a router for generating and matching urls |
|
1417 | + * |
|
1418 | + * @return \OCP\Route\IRouter |
|
1419 | + */ |
|
1420 | + public function getRouter() { |
|
1421 | + return $this->query('Router'); |
|
1422 | + } |
|
1423 | + |
|
1424 | + /** |
|
1425 | + * Returns a search instance |
|
1426 | + * |
|
1427 | + * @return \OCP\ISearch |
|
1428 | + */ |
|
1429 | + public function getSearch() { |
|
1430 | + return $this->query('Search'); |
|
1431 | + } |
|
1432 | + |
|
1433 | + /** |
|
1434 | + * Returns a SecureRandom instance |
|
1435 | + * |
|
1436 | + * @return \OCP\Security\ISecureRandom |
|
1437 | + */ |
|
1438 | + public function getSecureRandom() { |
|
1439 | + return $this->query('SecureRandom'); |
|
1440 | + } |
|
1441 | + |
|
1442 | + /** |
|
1443 | + * Returns a Crypto instance |
|
1444 | + * |
|
1445 | + * @return \OCP\Security\ICrypto |
|
1446 | + */ |
|
1447 | + public function getCrypto() { |
|
1448 | + return $this->query('Crypto'); |
|
1449 | + } |
|
1450 | + |
|
1451 | + /** |
|
1452 | + * Returns a Hasher instance |
|
1453 | + * |
|
1454 | + * @return \OCP\Security\IHasher |
|
1455 | + */ |
|
1456 | + public function getHasher() { |
|
1457 | + return $this->query('Hasher'); |
|
1458 | + } |
|
1459 | + |
|
1460 | + /** |
|
1461 | + * Returns a CredentialsManager instance |
|
1462 | + * |
|
1463 | + * @return \OCP\Security\ICredentialsManager |
|
1464 | + */ |
|
1465 | + public function getCredentialsManager() { |
|
1466 | + return $this->query('CredentialsManager'); |
|
1467 | + } |
|
1468 | + |
|
1469 | + /** |
|
1470 | + * Returns an instance of the HTTP helper class |
|
1471 | + * |
|
1472 | + * @deprecated Use getHTTPClientService() |
|
1473 | + * @return \OC\HTTPHelper |
|
1474 | + */ |
|
1475 | + public function getHTTPHelper() { |
|
1476 | + return $this->query('HTTPHelper'); |
|
1477 | + } |
|
1478 | + |
|
1479 | + /** |
|
1480 | + * Get the certificate manager for the user |
|
1481 | + * |
|
1482 | + * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager |
|
1483 | + * @return \OCP\ICertificateManager | null if $uid is null and no user is logged in |
|
1484 | + */ |
|
1485 | + public function getCertificateManager($userId = '') { |
|
1486 | + if ($userId === '') { |
|
1487 | + $userSession = $this->getUserSession(); |
|
1488 | + $user = $userSession->getUser(); |
|
1489 | + if (is_null($user)) { |
|
1490 | + return null; |
|
1491 | + } |
|
1492 | + $userId = $user->getUID(); |
|
1493 | + } |
|
1494 | + return new CertificateManager( |
|
1495 | + $userId, |
|
1496 | + new View(), |
|
1497 | + $this->getConfig(), |
|
1498 | + $this->getLogger(), |
|
1499 | + $this->getSecureRandom() |
|
1500 | + ); |
|
1501 | + } |
|
1502 | + |
|
1503 | + /** |
|
1504 | + * Returns an instance of the HTTP client service |
|
1505 | + * |
|
1506 | + * @return \OCP\Http\Client\IClientService |
|
1507 | + */ |
|
1508 | + public function getHTTPClientService() { |
|
1509 | + return $this->query('HttpClientService'); |
|
1510 | + } |
|
1511 | + |
|
1512 | + /** |
|
1513 | + * Create a new event source |
|
1514 | + * |
|
1515 | + * @return \OCP\IEventSource |
|
1516 | + */ |
|
1517 | + public function createEventSource() { |
|
1518 | + return new \OC_EventSource(); |
|
1519 | + } |
|
1520 | + |
|
1521 | + /** |
|
1522 | + * Get the active event logger |
|
1523 | + * |
|
1524 | + * The returned logger only logs data when debug mode is enabled |
|
1525 | + * |
|
1526 | + * @return \OCP\Diagnostics\IEventLogger |
|
1527 | + */ |
|
1528 | + public function getEventLogger() { |
|
1529 | + return $this->query('EventLogger'); |
|
1530 | + } |
|
1531 | + |
|
1532 | + /** |
|
1533 | + * Get the active query logger |
|
1534 | + * |
|
1535 | + * The returned logger only logs data when debug mode is enabled |
|
1536 | + * |
|
1537 | + * @return \OCP\Diagnostics\IQueryLogger |
|
1538 | + */ |
|
1539 | + public function getQueryLogger() { |
|
1540 | + return $this->query('QueryLogger'); |
|
1541 | + } |
|
1542 | + |
|
1543 | + /** |
|
1544 | + * Get the manager for temporary files and folders |
|
1545 | + * |
|
1546 | + * @return \OCP\ITempManager |
|
1547 | + */ |
|
1548 | + public function getTempManager() { |
|
1549 | + return $this->query('TempManager'); |
|
1550 | + } |
|
1551 | + |
|
1552 | + /** |
|
1553 | + * Get the app manager |
|
1554 | + * |
|
1555 | + * @return \OCP\App\IAppManager |
|
1556 | + */ |
|
1557 | + public function getAppManager() { |
|
1558 | + return $this->query('AppManager'); |
|
1559 | + } |
|
1560 | + |
|
1561 | + /** |
|
1562 | + * Creates a new mailer |
|
1563 | + * |
|
1564 | + * @return \OCP\Mail\IMailer |
|
1565 | + */ |
|
1566 | + public function getMailer() { |
|
1567 | + return $this->query('Mailer'); |
|
1568 | + } |
|
1569 | + |
|
1570 | + /** |
|
1571 | + * Get the webroot |
|
1572 | + * |
|
1573 | + * @return string |
|
1574 | + */ |
|
1575 | + public function getWebRoot() { |
|
1576 | + return $this->webRoot; |
|
1577 | + } |
|
1578 | + |
|
1579 | + /** |
|
1580 | + * @return \OC\OCSClient |
|
1581 | + */ |
|
1582 | + public function getOcsClient() { |
|
1583 | + return $this->query('OcsClient'); |
|
1584 | + } |
|
1585 | + |
|
1586 | + /** |
|
1587 | + * @return \OCP\IDateTimeZone |
|
1588 | + */ |
|
1589 | + public function getDateTimeZone() { |
|
1590 | + return $this->query('DateTimeZone'); |
|
1591 | + } |
|
1592 | + |
|
1593 | + /** |
|
1594 | + * @return \OCP\IDateTimeFormatter |
|
1595 | + */ |
|
1596 | + public function getDateTimeFormatter() { |
|
1597 | + return $this->query('DateTimeFormatter'); |
|
1598 | + } |
|
1599 | + |
|
1600 | + /** |
|
1601 | + * @return \OCP\Files\Config\IMountProviderCollection |
|
1602 | + */ |
|
1603 | + public function getMountProviderCollection() { |
|
1604 | + return $this->query('MountConfigManager'); |
|
1605 | + } |
|
1606 | + |
|
1607 | + /** |
|
1608 | + * Get the IniWrapper |
|
1609 | + * |
|
1610 | + * @return IniGetWrapper |
|
1611 | + */ |
|
1612 | + public function getIniWrapper() { |
|
1613 | + return $this->query('IniWrapper'); |
|
1614 | + } |
|
1615 | + |
|
1616 | + /** |
|
1617 | + * @return \OCP\Command\IBus |
|
1618 | + */ |
|
1619 | + public function getCommandBus() { |
|
1620 | + return $this->query('AsyncCommandBus'); |
|
1621 | + } |
|
1622 | + |
|
1623 | + /** |
|
1624 | + * Get the trusted domain helper |
|
1625 | + * |
|
1626 | + * @return TrustedDomainHelper |
|
1627 | + */ |
|
1628 | + public function getTrustedDomainHelper() { |
|
1629 | + return $this->query('TrustedDomainHelper'); |
|
1630 | + } |
|
1631 | + |
|
1632 | + /** |
|
1633 | + * Get the locking provider |
|
1634 | + * |
|
1635 | + * @return \OCP\Lock\ILockingProvider |
|
1636 | + * @since 8.1.0 |
|
1637 | + */ |
|
1638 | + public function getLockingProvider() { |
|
1639 | + return $this->query('LockingProvider'); |
|
1640 | + } |
|
1641 | + |
|
1642 | + /** |
|
1643 | + * @return \OCP\Files\Mount\IMountManager |
|
1644 | + **/ |
|
1645 | + function getMountManager() { |
|
1646 | + return $this->query('MountManager'); |
|
1647 | + } |
|
1648 | + |
|
1649 | + /** @return \OCP\Files\Config\IUserMountCache */ |
|
1650 | + function getUserMountCache() { |
|
1651 | + return $this->query('UserMountCache'); |
|
1652 | + } |
|
1653 | + |
|
1654 | + /** |
|
1655 | + * Get the MimeTypeDetector |
|
1656 | + * |
|
1657 | + * @return \OCP\Files\IMimeTypeDetector |
|
1658 | + */ |
|
1659 | + public function getMimeTypeDetector() { |
|
1660 | + return $this->query('MimeTypeDetector'); |
|
1661 | + } |
|
1662 | + |
|
1663 | + /** |
|
1664 | + * Get the MimeTypeLoader |
|
1665 | + * |
|
1666 | + * @return \OCP\Files\IMimeTypeLoader |
|
1667 | + */ |
|
1668 | + public function getMimeTypeLoader() { |
|
1669 | + return $this->query('MimeTypeLoader'); |
|
1670 | + } |
|
1671 | + |
|
1672 | + /** |
|
1673 | + * Get the manager of all the capabilities |
|
1674 | + * |
|
1675 | + * @return \OC\CapabilitiesManager |
|
1676 | + */ |
|
1677 | + public function getCapabilitiesManager() { |
|
1678 | + return $this->query('CapabilitiesManager'); |
|
1679 | + } |
|
1680 | + |
|
1681 | + /** |
|
1682 | + * Get the EventDispatcher |
|
1683 | + * |
|
1684 | + * @return EventDispatcherInterface |
|
1685 | + * @since 8.2.0 |
|
1686 | + */ |
|
1687 | + public function getEventDispatcher() { |
|
1688 | + return $this->query('EventDispatcher'); |
|
1689 | + } |
|
1690 | + |
|
1691 | + /** |
|
1692 | + * Get the Notification Manager |
|
1693 | + * |
|
1694 | + * @return \OCP\Notification\IManager |
|
1695 | + * @since 8.2.0 |
|
1696 | + */ |
|
1697 | + public function getNotificationManager() { |
|
1698 | + return $this->query('NotificationManager'); |
|
1699 | + } |
|
1700 | + |
|
1701 | + /** |
|
1702 | + * @return \OCP\Comments\ICommentsManager |
|
1703 | + */ |
|
1704 | + public function getCommentsManager() { |
|
1705 | + return $this->query('CommentsManager'); |
|
1706 | + } |
|
1707 | + |
|
1708 | + /** |
|
1709 | + * @return \OCA\Theming\ThemingDefaults |
|
1710 | + */ |
|
1711 | + public function getThemingDefaults() { |
|
1712 | + return $this->query('ThemingDefaults'); |
|
1713 | + } |
|
1714 | + |
|
1715 | + /** |
|
1716 | + * @return \OC\IntegrityCheck\Checker |
|
1717 | + */ |
|
1718 | + public function getIntegrityCodeChecker() { |
|
1719 | + return $this->query('IntegrityCodeChecker'); |
|
1720 | + } |
|
1721 | + |
|
1722 | + /** |
|
1723 | + * @return \OC\Session\CryptoWrapper |
|
1724 | + */ |
|
1725 | + public function getSessionCryptoWrapper() { |
|
1726 | + return $this->query('CryptoWrapper'); |
|
1727 | + } |
|
1728 | + |
|
1729 | + /** |
|
1730 | + * @return CsrfTokenManager |
|
1731 | + */ |
|
1732 | + public function getCsrfTokenManager() { |
|
1733 | + return $this->query('CsrfTokenManager'); |
|
1734 | + } |
|
1735 | + |
|
1736 | + /** |
|
1737 | + * @return Throttler |
|
1738 | + */ |
|
1739 | + public function getBruteForceThrottler() { |
|
1740 | + return $this->query('Throttler'); |
|
1741 | + } |
|
1742 | + |
|
1743 | + /** |
|
1744 | + * @return IContentSecurityPolicyManager |
|
1745 | + */ |
|
1746 | + public function getContentSecurityPolicyManager() { |
|
1747 | + return $this->query('ContentSecurityPolicyManager'); |
|
1748 | + } |
|
1749 | + |
|
1750 | + /** |
|
1751 | + * @return ContentSecurityPolicyNonceManager |
|
1752 | + */ |
|
1753 | + public function getContentSecurityPolicyNonceManager() { |
|
1754 | + return $this->query('ContentSecurityPolicyNonceManager'); |
|
1755 | + } |
|
1756 | + |
|
1757 | + /** |
|
1758 | + * Not a public API as of 8.2, wait for 9.0 |
|
1759 | + * |
|
1760 | + * @return \OCA\Files_External\Service\BackendService |
|
1761 | + */ |
|
1762 | + public function getStoragesBackendService() { |
|
1763 | + return $this->query('OCA\\Files_External\\Service\\BackendService'); |
|
1764 | + } |
|
1765 | + |
|
1766 | + /** |
|
1767 | + * Not a public API as of 8.2, wait for 9.0 |
|
1768 | + * |
|
1769 | + * @return \OCA\Files_External\Service\GlobalStoragesService |
|
1770 | + */ |
|
1771 | + public function getGlobalStoragesService() { |
|
1772 | + return $this->query('OCA\\Files_External\\Service\\GlobalStoragesService'); |
|
1773 | + } |
|
1774 | + |
|
1775 | + /** |
|
1776 | + * Not a public API as of 8.2, wait for 9.0 |
|
1777 | + * |
|
1778 | + * @return \OCA\Files_External\Service\UserGlobalStoragesService |
|
1779 | + */ |
|
1780 | + public function getUserGlobalStoragesService() { |
|
1781 | + return $this->query('OCA\\Files_External\\Service\\UserGlobalStoragesService'); |
|
1782 | + } |
|
1783 | + |
|
1784 | + /** |
|
1785 | + * Not a public API as of 8.2, wait for 9.0 |
|
1786 | + * |
|
1787 | + * @return \OCA\Files_External\Service\UserStoragesService |
|
1788 | + */ |
|
1789 | + public function getUserStoragesService() { |
|
1790 | + return $this->query('OCA\\Files_External\\Service\\UserStoragesService'); |
|
1791 | + } |
|
1792 | + |
|
1793 | + /** |
|
1794 | + * @return \OCP\Share\IManager |
|
1795 | + */ |
|
1796 | + public function getShareManager() { |
|
1797 | + return $this->query('ShareManager'); |
|
1798 | + } |
|
1799 | + |
|
1800 | + /** |
|
1801 | + * @return \OCP\Collaboration\Collaborators\ISearch |
|
1802 | + */ |
|
1803 | + public function getCollaboratorSearch() { |
|
1804 | + return $this->query('CollaboratorSearch'); |
|
1805 | + } |
|
1806 | + |
|
1807 | + /** |
|
1808 | + * @return \OCP\Collaboration\AutoComplete\IManager |
|
1809 | + */ |
|
1810 | + public function getAutoCompleteManager(){ |
|
1811 | + return $this->query(IManager::class); |
|
1812 | + } |
|
1813 | + |
|
1814 | + /** |
|
1815 | + * Returns the LDAP Provider |
|
1816 | + * |
|
1817 | + * @return \OCP\LDAP\ILDAPProvider |
|
1818 | + */ |
|
1819 | + public function getLDAPProvider() { |
|
1820 | + return $this->query('LDAPProvider'); |
|
1821 | + } |
|
1822 | + |
|
1823 | + /** |
|
1824 | + * @return \OCP\Settings\IManager |
|
1825 | + */ |
|
1826 | + public function getSettingsManager() { |
|
1827 | + return $this->query('SettingsManager'); |
|
1828 | + } |
|
1829 | + |
|
1830 | + /** |
|
1831 | + * @return \OCP\Files\IAppData |
|
1832 | + */ |
|
1833 | + public function getAppDataDir($app) { |
|
1834 | + /** @var \OC\Files\AppData\Factory $factory */ |
|
1835 | + $factory = $this->query(\OC\Files\AppData\Factory::class); |
|
1836 | + return $factory->get($app); |
|
1837 | + } |
|
1838 | + |
|
1839 | + /** |
|
1840 | + * @return \OCP\Lockdown\ILockdownManager |
|
1841 | + */ |
|
1842 | + public function getLockdownManager() { |
|
1843 | + return $this->query('LockdownManager'); |
|
1844 | + } |
|
1845 | + |
|
1846 | + /** |
|
1847 | + * @return \OCP\Federation\ICloudIdManager |
|
1848 | + */ |
|
1849 | + public function getCloudIdManager() { |
|
1850 | + return $this->query(ICloudIdManager::class); |
|
1851 | + } |
|
1852 | 1852 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | parent::__construct(); |
145 | 145 | $this->webRoot = $webRoot; |
146 | 146 | |
147 | - $this->registerService(\OCP\IServerContainer::class, function (IServerContainer $c) { |
|
147 | + $this->registerService(\OCP\IServerContainer::class, function(IServerContainer $c) { |
|
148 | 148 | return $c; |
149 | 149 | }); |
150 | 150 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $this->registerAlias(IActionFactory::class, ActionFactory::class); |
155 | 155 | |
156 | 156 | |
157 | - $this->registerService(\OCP\IPreview::class, function (Server $c) { |
|
157 | + $this->registerService(\OCP\IPreview::class, function(Server $c) { |
|
158 | 158 | return new PreviewManager( |
159 | 159 | $c->getConfig(), |
160 | 160 | $c->getRootFolder(), |
@@ -165,13 +165,13 @@ discard block |
||
165 | 165 | }); |
166 | 166 | $this->registerAlias('PreviewManager', \OCP\IPreview::class); |
167 | 167 | |
168 | - $this->registerService(\OC\Preview\Watcher::class, function (Server $c) { |
|
168 | + $this->registerService(\OC\Preview\Watcher::class, function(Server $c) { |
|
169 | 169 | return new \OC\Preview\Watcher( |
170 | 170 | $c->getAppDataDir('preview') |
171 | 171 | ); |
172 | 172 | }); |
173 | 173 | |
174 | - $this->registerService('EncryptionManager', function (Server $c) { |
|
174 | + $this->registerService('EncryptionManager', function(Server $c) { |
|
175 | 175 | $view = new View(); |
176 | 176 | $util = new Encryption\Util( |
177 | 177 | $view, |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | ); |
190 | 190 | }); |
191 | 191 | |
192 | - $this->registerService('EncryptionFileHelper', function (Server $c) { |
|
192 | + $this->registerService('EncryptionFileHelper', function(Server $c) { |
|
193 | 193 | $util = new Encryption\Util( |
194 | 194 | new View(), |
195 | 195 | $c->getUserManager(), |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | ); |
204 | 204 | }); |
205 | 205 | |
206 | - $this->registerService('EncryptionKeyStorage', function (Server $c) { |
|
206 | + $this->registerService('EncryptionKeyStorage', function(Server $c) { |
|
207 | 207 | $view = new View(); |
208 | 208 | $util = new Encryption\Util( |
209 | 209 | $view, |
@@ -214,32 +214,32 @@ discard block |
||
214 | 214 | |
215 | 215 | return new Encryption\Keys\Storage($view, $util); |
216 | 216 | }); |
217 | - $this->registerService('TagMapper', function (Server $c) { |
|
217 | + $this->registerService('TagMapper', function(Server $c) { |
|
218 | 218 | return new TagMapper($c->getDatabaseConnection()); |
219 | 219 | }); |
220 | 220 | |
221 | - $this->registerService(\OCP\ITagManager::class, function (Server $c) { |
|
221 | + $this->registerService(\OCP\ITagManager::class, function(Server $c) { |
|
222 | 222 | $tagMapper = $c->query('TagMapper'); |
223 | 223 | return new TagManager($tagMapper, $c->getUserSession()); |
224 | 224 | }); |
225 | 225 | $this->registerAlias('TagManager', \OCP\ITagManager::class); |
226 | 226 | |
227 | - $this->registerService('SystemTagManagerFactory', function (Server $c) { |
|
227 | + $this->registerService('SystemTagManagerFactory', function(Server $c) { |
|
228 | 228 | $config = $c->getConfig(); |
229 | 229 | $factoryClass = $config->getSystemValue('systemtags.managerFactory', '\OC\SystemTag\ManagerFactory'); |
230 | 230 | /** @var \OC\SystemTag\ManagerFactory $factory */ |
231 | 231 | $factory = new $factoryClass($this); |
232 | 232 | return $factory; |
233 | 233 | }); |
234 | - $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) { |
|
234 | + $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function(Server $c) { |
|
235 | 235 | return $c->query('SystemTagManagerFactory')->getManager(); |
236 | 236 | }); |
237 | 237 | $this->registerAlias('SystemTagManager', \OCP\SystemTag\ISystemTagManager::class); |
238 | 238 | |
239 | - $this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function (Server $c) { |
|
239 | + $this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function(Server $c) { |
|
240 | 240 | return $c->query('SystemTagManagerFactory')->getObjectMapper(); |
241 | 241 | }); |
242 | - $this->registerService('RootFolder', function (Server $c) { |
|
242 | + $this->registerService('RootFolder', function(Server $c) { |
|
243 | 243 | $manager = \OC\Files\Filesystem::getMountManager(null); |
244 | 244 | $view = new View(); |
245 | 245 | $root = new Root( |
@@ -260,37 +260,37 @@ discard block |
||
260 | 260 | }); |
261 | 261 | $this->registerAlias('SystemTagObjectMapper', \OCP\SystemTag\ISystemTagObjectMapper::class); |
262 | 262 | |
263 | - $this->registerService(\OCP\Files\IRootFolder::class, function (Server $c) { |
|
264 | - return new LazyRoot(function () use ($c) { |
|
263 | + $this->registerService(\OCP\Files\IRootFolder::class, function(Server $c) { |
|
264 | + return new LazyRoot(function() use ($c) { |
|
265 | 265 | return $c->query('RootFolder'); |
266 | 266 | }); |
267 | 267 | }); |
268 | 268 | $this->registerAlias('LazyRootFolder', \OCP\Files\IRootFolder::class); |
269 | 269 | |
270 | - $this->registerService(\OCP\IUserManager::class, function (Server $c) { |
|
270 | + $this->registerService(\OCP\IUserManager::class, function(Server $c) { |
|
271 | 271 | $config = $c->getConfig(); |
272 | 272 | return new \OC\User\Manager($config); |
273 | 273 | }); |
274 | 274 | $this->registerAlias('UserManager', \OCP\IUserManager::class); |
275 | 275 | |
276 | - $this->registerService(\OCP\IGroupManager::class, function (Server $c) { |
|
276 | + $this->registerService(\OCP\IGroupManager::class, function(Server $c) { |
|
277 | 277 | $groupManager = new \OC\Group\Manager($this->getUserManager(), $this->getLogger()); |
278 | - $groupManager->listen('\OC\Group', 'preCreate', function ($gid) { |
|
278 | + $groupManager->listen('\OC\Group', 'preCreate', function($gid) { |
|
279 | 279 | \OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid)); |
280 | 280 | }); |
281 | - $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) { |
|
281 | + $groupManager->listen('\OC\Group', 'postCreate', function(\OC\Group\Group $gid) { |
|
282 | 282 | \OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID())); |
283 | 283 | }); |
284 | - $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) { |
|
284 | + $groupManager->listen('\OC\Group', 'preDelete', function(\OC\Group\Group $group) { |
|
285 | 285 | \OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID())); |
286 | 286 | }); |
287 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) { |
|
287 | + $groupManager->listen('\OC\Group', 'postDelete', function(\OC\Group\Group $group) { |
|
288 | 288 | \OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID())); |
289 | 289 | }); |
290 | - $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
290 | + $groupManager->listen('\OC\Group', 'preAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
291 | 291 | \OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID())); |
292 | 292 | }); |
293 | - $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
293 | + $groupManager->listen('\OC\Group', 'postAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
294 | 294 | \OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
295 | 295 | //Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks |
296 | 296 | \OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | }); |
300 | 300 | $this->registerAlias('GroupManager', \OCP\IGroupManager::class); |
301 | 301 | |
302 | - $this->registerService(Store::class, function (Server $c) { |
|
302 | + $this->registerService(Store::class, function(Server $c) { |
|
303 | 303 | $session = $c->getSession(); |
304 | 304 | if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
305 | 305 | $tokenProvider = $c->query('OC\Authentication\Token\IProvider'); |
@@ -310,11 +310,11 @@ discard block |
||
310 | 310 | return new Store($session, $logger, $tokenProvider); |
311 | 311 | }); |
312 | 312 | $this->registerAlias(IStore::class, Store::class); |
313 | - $this->registerService('OC\Authentication\Token\DefaultTokenMapper', function (Server $c) { |
|
313 | + $this->registerService('OC\Authentication\Token\DefaultTokenMapper', function(Server $c) { |
|
314 | 314 | $dbConnection = $c->getDatabaseConnection(); |
315 | 315 | return new Authentication\Token\DefaultTokenMapper($dbConnection); |
316 | 316 | }); |
317 | - $this->registerService('OC\Authentication\Token\DefaultTokenProvider', function (Server $c) { |
|
317 | + $this->registerService('OC\Authentication\Token\DefaultTokenProvider', function(Server $c) { |
|
318 | 318 | $mapper = $c->query('OC\Authentication\Token\DefaultTokenMapper'); |
319 | 319 | $crypto = $c->getCrypto(); |
320 | 320 | $config = $c->getConfig(); |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | }); |
325 | 325 | $this->registerAlias('OC\Authentication\Token\IProvider', 'OC\Authentication\Token\DefaultTokenProvider'); |
326 | 326 | |
327 | - $this->registerService(\OCP\IUserSession::class, function (Server $c) { |
|
327 | + $this->registerService(\OCP\IUserSession::class, function(Server $c) { |
|
328 | 328 | $manager = $c->getUserManager(); |
329 | 329 | $session = new \OC\Session\Memory(''); |
330 | 330 | $timeFactory = new TimeFactory(); |
@@ -337,44 +337,44 @@ discard block |
||
337 | 337 | } |
338 | 338 | |
339 | 339 | $userSession = new \OC\User\Session($manager, $session, $timeFactory, $defaultTokenProvider, $c->getConfig(), $c->getSecureRandom(), $c->getLockdownManager()); |
340 | - $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { |
|
340 | + $userSession->listen('\OC\User', 'preCreateUser', function($uid, $password) { |
|
341 | 341 | \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password)); |
342 | 342 | }); |
343 | - $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) { |
|
343 | + $userSession->listen('\OC\User', 'postCreateUser', function($user, $password) { |
|
344 | 344 | /** @var $user \OC\User\User */ |
345 | 345 | \OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password)); |
346 | 346 | }); |
347 | - $userSession->listen('\OC\User', 'preDelete', function ($user) { |
|
347 | + $userSession->listen('\OC\User', 'preDelete', function($user) { |
|
348 | 348 | /** @var $user \OC\User\User */ |
349 | 349 | \OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID())); |
350 | 350 | }); |
351 | - $userSession->listen('\OC\User', 'postDelete', function ($user) { |
|
351 | + $userSession->listen('\OC\User', 'postDelete', function($user) { |
|
352 | 352 | /** @var $user \OC\User\User */ |
353 | 353 | \OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID())); |
354 | 354 | }); |
355 | - $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) { |
|
355 | + $userSession->listen('\OC\User', 'preSetPassword', function($user, $password, $recoveryPassword) { |
|
356 | 356 | /** @var $user \OC\User\User */ |
357 | 357 | \OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
358 | 358 | }); |
359 | - $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) { |
|
359 | + $userSession->listen('\OC\User', 'postSetPassword', function($user, $password, $recoveryPassword) { |
|
360 | 360 | /** @var $user \OC\User\User */ |
361 | 361 | \OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
362 | 362 | }); |
363 | - $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) { |
|
363 | + $userSession->listen('\OC\User', 'preLogin', function($uid, $password) { |
|
364 | 364 | \OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password)); |
365 | 365 | }); |
366 | - $userSession->listen('\OC\User', 'postLogin', function ($user, $password) { |
|
366 | + $userSession->listen('\OC\User', 'postLogin', function($user, $password) { |
|
367 | 367 | /** @var $user \OC\User\User */ |
368 | 368 | \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password)); |
369 | 369 | }); |
370 | - $userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) { |
|
370 | + $userSession->listen('\OC\User', 'postRememberedLogin', function($user, $password) { |
|
371 | 371 | /** @var $user \OC\User\User */ |
372 | 372 | \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password)); |
373 | 373 | }); |
374 | - $userSession->listen('\OC\User', 'logout', function () { |
|
374 | + $userSession->listen('\OC\User', 'logout', function() { |
|
375 | 375 | \OC_Hook::emit('OC_User', 'logout', array()); |
376 | 376 | }); |
377 | - $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) { |
|
377 | + $userSession->listen('\OC\User', 'changeUser', function($user, $feature, $value, $oldValue) { |
|
378 | 378 | /** @var $user \OC\User\User */ |
379 | 379 | \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue)); |
380 | 380 | }); |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | }); |
383 | 383 | $this->registerAlias('UserSession', \OCP\IUserSession::class); |
384 | 384 | |
385 | - $this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function (Server $c) { |
|
385 | + $this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function(Server $c) { |
|
386 | 386 | return new \OC\Authentication\TwoFactorAuth\Manager( |
387 | 387 | $c->getAppManager(), |
388 | 388 | $c->getSession(), |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | $this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class); |
398 | 398 | $this->registerAlias('NavigationManager', \OCP\INavigationManager::class); |
399 | 399 | |
400 | - $this->registerService(\OC\AllConfig::class, function (Server $c) { |
|
400 | + $this->registerService(\OC\AllConfig::class, function(Server $c) { |
|
401 | 401 | return new \OC\AllConfig( |
402 | 402 | $c->getSystemConfig() |
403 | 403 | ); |
@@ -405,17 +405,17 @@ discard block |
||
405 | 405 | $this->registerAlias('AllConfig', \OC\AllConfig::class); |
406 | 406 | $this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class); |
407 | 407 | |
408 | - $this->registerService('SystemConfig', function ($c) use ($config) { |
|
408 | + $this->registerService('SystemConfig', function($c) use ($config) { |
|
409 | 409 | return new \OC\SystemConfig($config); |
410 | 410 | }); |
411 | 411 | |
412 | - $this->registerService(\OC\AppConfig::class, function (Server $c) { |
|
412 | + $this->registerService(\OC\AppConfig::class, function(Server $c) { |
|
413 | 413 | return new \OC\AppConfig($c->getDatabaseConnection()); |
414 | 414 | }); |
415 | 415 | $this->registerAlias('AppConfig', \OC\AppConfig::class); |
416 | 416 | $this->registerAlias(\OCP\IAppConfig::class, \OC\AppConfig::class); |
417 | 417 | |
418 | - $this->registerService(\OCP\L10N\IFactory::class, function (Server $c) { |
|
418 | + $this->registerService(\OCP\L10N\IFactory::class, function(Server $c) { |
|
419 | 419 | return new \OC\L10N\Factory( |
420 | 420 | $c->getConfig(), |
421 | 421 | $c->getRequest(), |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | }); |
426 | 426 | $this->registerAlias('L10NFactory', \OCP\L10N\IFactory::class); |
427 | 427 | |
428 | - $this->registerService(\OCP\IURLGenerator::class, function (Server $c) { |
|
428 | + $this->registerService(\OCP\IURLGenerator::class, function(Server $c) { |
|
429 | 429 | $config = $c->getConfig(); |
430 | 430 | $cacheFactory = $c->getMemCacheFactory(); |
431 | 431 | $request = $c->getRequest(); |
@@ -437,18 +437,18 @@ discard block |
||
437 | 437 | }); |
438 | 438 | $this->registerAlias('URLGenerator', \OCP\IURLGenerator::class); |
439 | 439 | |
440 | - $this->registerService('AppHelper', function ($c) { |
|
440 | + $this->registerService('AppHelper', function($c) { |
|
441 | 441 | return new \OC\AppHelper(); |
442 | 442 | }); |
443 | 443 | $this->registerAlias('AppFetcher', AppFetcher::class); |
444 | 444 | $this->registerAlias('CategoryFetcher', CategoryFetcher::class); |
445 | 445 | |
446 | - $this->registerService(\OCP\ICache::class, function ($c) { |
|
446 | + $this->registerService(\OCP\ICache::class, function($c) { |
|
447 | 447 | return new Cache\File(); |
448 | 448 | }); |
449 | 449 | $this->registerAlias('UserCache', \OCP\ICache::class); |
450 | 450 | |
451 | - $this->registerService(Factory::class, function (Server $c) { |
|
451 | + $this->registerService(Factory::class, function(Server $c) { |
|
452 | 452 | |
453 | 453 | $arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(), |
454 | 454 | '\\OC\\Memcache\\ArrayCache', |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | $version = implode(',', $v); |
466 | 466 | $instanceId = \OC_Util::getInstanceId(); |
467 | 467 | $path = \OC::$SERVERROOT; |
468 | - $prefix = md5($instanceId . '-' . $version . '-' . $path . '-' . $urlGenerator->getBaseUrl()); |
|
468 | + $prefix = md5($instanceId.'-'.$version.'-'.$path.'-'.$urlGenerator->getBaseUrl()); |
|
469 | 469 | return new \OC\Memcache\Factory($prefix, $c->getLogger(), |
470 | 470 | $config->getSystemValue('memcache.local', null), |
471 | 471 | $config->getSystemValue('memcache.distributed', null), |
@@ -478,12 +478,12 @@ discard block |
||
478 | 478 | $this->registerAlias('MemCacheFactory', Factory::class); |
479 | 479 | $this->registerAlias(ICacheFactory::class, Factory::class); |
480 | 480 | |
481 | - $this->registerService('RedisFactory', function (Server $c) { |
|
481 | + $this->registerService('RedisFactory', function(Server $c) { |
|
482 | 482 | $systemConfig = $c->getSystemConfig(); |
483 | 483 | return new RedisFactory($systemConfig); |
484 | 484 | }); |
485 | 485 | |
486 | - $this->registerService(\OCP\Activity\IManager::class, function (Server $c) { |
|
486 | + $this->registerService(\OCP\Activity\IManager::class, function(Server $c) { |
|
487 | 487 | return new \OC\Activity\Manager( |
488 | 488 | $c->getRequest(), |
489 | 489 | $c->getUserSession(), |
@@ -493,14 +493,14 @@ discard block |
||
493 | 493 | }); |
494 | 494 | $this->registerAlias('ActivityManager', \OCP\Activity\IManager::class); |
495 | 495 | |
496 | - $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) { |
|
496 | + $this->registerService(\OCP\Activity\IEventMerger::class, function(Server $c) { |
|
497 | 497 | return new \OC\Activity\EventMerger( |
498 | 498 | $c->getL10N('lib') |
499 | 499 | ); |
500 | 500 | }); |
501 | 501 | $this->registerAlias(IValidator::class, Validator::class); |
502 | 502 | |
503 | - $this->registerService(\OCP\IAvatarManager::class, function (Server $c) { |
|
503 | + $this->registerService(\OCP\IAvatarManager::class, function(Server $c) { |
|
504 | 504 | return new AvatarManager( |
505 | 505 | $c->getUserManager(), |
506 | 506 | $c->getAppDataDir('avatar'), |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | }); |
512 | 512 | $this->registerAlias('AvatarManager', \OCP\IAvatarManager::class); |
513 | 513 | |
514 | - $this->registerService(\OCP\ILogger::class, function (Server $c) { |
|
514 | + $this->registerService(\OCP\ILogger::class, function(Server $c) { |
|
515 | 515 | $logType = $c->query('AllConfig')->getSystemValue('log_type', 'file'); |
516 | 516 | $logger = Log::getLogClass($logType); |
517 | 517 | call_user_func(array($logger, 'init')); |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | }); |
521 | 521 | $this->registerAlias('Logger', \OCP\ILogger::class); |
522 | 522 | |
523 | - $this->registerService(\OCP\BackgroundJob\IJobList::class, function (Server $c) { |
|
523 | + $this->registerService(\OCP\BackgroundJob\IJobList::class, function(Server $c) { |
|
524 | 524 | $config = $c->getConfig(); |
525 | 525 | return new \OC\BackgroundJob\JobList( |
526 | 526 | $c->getDatabaseConnection(), |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | }); |
531 | 531 | $this->registerAlias('JobList', \OCP\BackgroundJob\IJobList::class); |
532 | 532 | |
533 | - $this->registerService(\OCP\Route\IRouter::class, function (Server $c) { |
|
533 | + $this->registerService(\OCP\Route\IRouter::class, function(Server $c) { |
|
534 | 534 | $cacheFactory = $c->getMemCacheFactory(); |
535 | 535 | $logger = $c->getLogger(); |
536 | 536 | if ($cacheFactory->isAvailableLowLatency()) { |
@@ -542,12 +542,12 @@ discard block |
||
542 | 542 | }); |
543 | 543 | $this->registerAlias('Router', \OCP\Route\IRouter::class); |
544 | 544 | |
545 | - $this->registerService(\OCP\ISearch::class, function ($c) { |
|
545 | + $this->registerService(\OCP\ISearch::class, function($c) { |
|
546 | 546 | return new Search(); |
547 | 547 | }); |
548 | 548 | $this->registerAlias('Search', \OCP\ISearch::class); |
549 | 549 | |
550 | - $this->registerService(\OC\Security\RateLimiting\Limiter::class, function ($c) { |
|
550 | + $this->registerService(\OC\Security\RateLimiting\Limiter::class, function($c) { |
|
551 | 551 | return new \OC\Security\RateLimiting\Limiter( |
552 | 552 | $this->getUserSession(), |
553 | 553 | $this->getRequest(), |
@@ -555,34 +555,34 @@ discard block |
||
555 | 555 | $c->query(\OC\Security\RateLimiting\Backend\IBackend::class) |
556 | 556 | ); |
557 | 557 | }); |
558 | - $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) { |
|
558 | + $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function($c) { |
|
559 | 559 | return new \OC\Security\RateLimiting\Backend\MemoryCache( |
560 | 560 | $this->getMemCacheFactory(), |
561 | 561 | new \OC\AppFramework\Utility\TimeFactory() |
562 | 562 | ); |
563 | 563 | }); |
564 | 564 | |
565 | - $this->registerService(\OCP\Security\ISecureRandom::class, function ($c) { |
|
565 | + $this->registerService(\OCP\Security\ISecureRandom::class, function($c) { |
|
566 | 566 | return new SecureRandom(); |
567 | 567 | }); |
568 | 568 | $this->registerAlias('SecureRandom', \OCP\Security\ISecureRandom::class); |
569 | 569 | |
570 | - $this->registerService(\OCP\Security\ICrypto::class, function (Server $c) { |
|
570 | + $this->registerService(\OCP\Security\ICrypto::class, function(Server $c) { |
|
571 | 571 | return new Crypto($c->getConfig(), $c->getSecureRandom()); |
572 | 572 | }); |
573 | 573 | $this->registerAlias('Crypto', \OCP\Security\ICrypto::class); |
574 | 574 | |
575 | - $this->registerService(\OCP\Security\IHasher::class, function (Server $c) { |
|
575 | + $this->registerService(\OCP\Security\IHasher::class, function(Server $c) { |
|
576 | 576 | return new Hasher($c->getConfig()); |
577 | 577 | }); |
578 | 578 | $this->registerAlias('Hasher', \OCP\Security\IHasher::class); |
579 | 579 | |
580 | - $this->registerService(\OCP\Security\ICredentialsManager::class, function (Server $c) { |
|
580 | + $this->registerService(\OCP\Security\ICredentialsManager::class, function(Server $c) { |
|
581 | 581 | return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection()); |
582 | 582 | }); |
583 | 583 | $this->registerAlias('CredentialsManager', \OCP\Security\ICredentialsManager::class); |
584 | 584 | |
585 | - $this->registerService(IDBConnection::class, function (Server $c) { |
|
585 | + $this->registerService(IDBConnection::class, function(Server $c) { |
|
586 | 586 | $systemConfig = $c->getSystemConfig(); |
587 | 587 | $factory = new \OC\DB\ConnectionFactory($systemConfig); |
588 | 588 | $type = $systemConfig->getValue('dbtype', 'sqlite'); |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | }); |
597 | 597 | $this->registerAlias('DatabaseConnection', IDBConnection::class); |
598 | 598 | |
599 | - $this->registerService('HTTPHelper', function (Server $c) { |
|
599 | + $this->registerService('HTTPHelper', function(Server $c) { |
|
600 | 600 | $config = $c->getConfig(); |
601 | 601 | return new HTTPHelper( |
602 | 602 | $config, |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | ); |
605 | 605 | }); |
606 | 606 | |
607 | - $this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) { |
|
607 | + $this->registerService(\OCP\Http\Client\IClientService::class, function(Server $c) { |
|
608 | 608 | $user = \OC_User::getUser(); |
609 | 609 | $uid = $user ? $user : null; |
610 | 610 | return new ClientService( |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | ); |
620 | 620 | }); |
621 | 621 | $this->registerAlias('HttpClientService', \OCP\Http\Client\IClientService::class); |
622 | - $this->registerService(\OCP\Diagnostics\IEventLogger::class, function (Server $c) { |
|
622 | + $this->registerService(\OCP\Diagnostics\IEventLogger::class, function(Server $c) { |
|
623 | 623 | $eventLogger = new EventLogger(); |
624 | 624 | if ($c->getSystemConfig()->getValue('debug', false)) { |
625 | 625 | // In debug mode, module is being activated by default |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | }); |
630 | 630 | $this->registerAlias('EventLogger', \OCP\Diagnostics\IEventLogger::class); |
631 | 631 | |
632 | - $this->registerService(\OCP\Diagnostics\IQueryLogger::class, function (Server $c) { |
|
632 | + $this->registerService(\OCP\Diagnostics\IQueryLogger::class, function(Server $c) { |
|
633 | 633 | $queryLogger = new QueryLogger(); |
634 | 634 | if ($c->getSystemConfig()->getValue('debug', false)) { |
635 | 635 | // In debug mode, module is being activated by default |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | }); |
640 | 640 | $this->registerAlias('QueryLogger', \OCP\Diagnostics\IQueryLogger::class); |
641 | 641 | |
642 | - $this->registerService(TempManager::class, function (Server $c) { |
|
642 | + $this->registerService(TempManager::class, function(Server $c) { |
|
643 | 643 | return new TempManager( |
644 | 644 | $c->getLogger(), |
645 | 645 | $c->getConfig() |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | $this->registerAlias('TempManager', TempManager::class); |
649 | 649 | $this->registerAlias(ITempManager::class, TempManager::class); |
650 | 650 | |
651 | - $this->registerService(AppManager::class, function (Server $c) { |
|
651 | + $this->registerService(AppManager::class, function(Server $c) { |
|
652 | 652 | return new \OC\App\AppManager( |
653 | 653 | $c->getUserSession(), |
654 | 654 | $c->getAppConfig(), |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | $this->registerAlias('AppManager', AppManager::class); |
661 | 661 | $this->registerAlias(IAppManager::class, AppManager::class); |
662 | 662 | |
663 | - $this->registerService(\OCP\IDateTimeZone::class, function (Server $c) { |
|
663 | + $this->registerService(\OCP\IDateTimeZone::class, function(Server $c) { |
|
664 | 664 | return new DateTimeZone( |
665 | 665 | $c->getConfig(), |
666 | 666 | $c->getSession() |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | }); |
669 | 669 | $this->registerAlias('DateTimeZone', \OCP\IDateTimeZone::class); |
670 | 670 | |
671 | - $this->registerService(\OCP\IDateTimeFormatter::class, function (Server $c) { |
|
671 | + $this->registerService(\OCP\IDateTimeFormatter::class, function(Server $c) { |
|
672 | 672 | $language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null); |
673 | 673 | |
674 | 674 | return new DateTimeFormatter( |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | }); |
679 | 679 | $this->registerAlias('DateTimeFormatter', \OCP\IDateTimeFormatter::class); |
680 | 680 | |
681 | - $this->registerService(\OCP\Files\Config\IUserMountCache::class, function (Server $c) { |
|
681 | + $this->registerService(\OCP\Files\Config\IUserMountCache::class, function(Server $c) { |
|
682 | 682 | $mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger()); |
683 | 683 | $listener = new UserMountCacheListener($mountCache); |
684 | 684 | $listener->listen($c->getUserManager()); |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | }); |
687 | 687 | $this->registerAlias('UserMountCache', \OCP\Files\Config\IUserMountCache::class); |
688 | 688 | |
689 | - $this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function (Server $c) { |
|
689 | + $this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function(Server $c) { |
|
690 | 690 | $loader = \OC\Files\Filesystem::getLoader(); |
691 | 691 | $mountCache = $c->query('UserMountCache'); |
692 | 692 | $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); |
@@ -702,10 +702,10 @@ discard block |
||
702 | 702 | }); |
703 | 703 | $this->registerAlias('MountConfigManager', \OCP\Files\Config\IMountProviderCollection::class); |
704 | 704 | |
705 | - $this->registerService('IniWrapper', function ($c) { |
|
705 | + $this->registerService('IniWrapper', function($c) { |
|
706 | 706 | return new IniGetWrapper(); |
707 | 707 | }); |
708 | - $this->registerService('AsyncCommandBus', function (Server $c) { |
|
708 | + $this->registerService('AsyncCommandBus', function(Server $c) { |
|
709 | 709 | $busClass = $c->getConfig()->getSystemValue('commandbus'); |
710 | 710 | if ($busClass) { |
711 | 711 | list($app, $class) = explode('::', $busClass, 2); |
@@ -720,10 +720,10 @@ discard block |
||
720 | 720 | return new CronBus($jobList); |
721 | 721 | } |
722 | 722 | }); |
723 | - $this->registerService('TrustedDomainHelper', function ($c) { |
|
723 | + $this->registerService('TrustedDomainHelper', function($c) { |
|
724 | 724 | return new TrustedDomainHelper($this->getConfig()); |
725 | 725 | }); |
726 | - $this->registerService('Throttler', function (Server $c) { |
|
726 | + $this->registerService('Throttler', function(Server $c) { |
|
727 | 727 | return new Throttler( |
728 | 728 | $c->getDatabaseConnection(), |
729 | 729 | new TimeFactory(), |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | $c->getConfig() |
732 | 732 | ); |
733 | 733 | }); |
734 | - $this->registerService('IntegrityCodeChecker', function (Server $c) { |
|
734 | + $this->registerService('IntegrityCodeChecker', function(Server $c) { |
|
735 | 735 | // IConfig and IAppManager requires a working database. This code |
736 | 736 | // might however be called when ownCloud is not yet setup. |
737 | 737 | if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | $c->getTempManager() |
753 | 753 | ); |
754 | 754 | }); |
755 | - $this->registerService(\OCP\IRequest::class, function ($c) { |
|
755 | + $this->registerService(\OCP\IRequest::class, function($c) { |
|
756 | 756 | if (isset($this['urlParams'])) { |
757 | 757 | $urlParams = $this['urlParams']; |
758 | 758 | } else { |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | }); |
789 | 789 | $this->registerAlias('Request', \OCP\IRequest::class); |
790 | 790 | |
791 | - $this->registerService(\OCP\Mail\IMailer::class, function (Server $c) { |
|
791 | + $this->registerService(\OCP\Mail\IMailer::class, function(Server $c) { |
|
792 | 792 | return new Mailer( |
793 | 793 | $c->getConfig(), |
794 | 794 | $c->getLogger(), |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | }); |
800 | 800 | $this->registerAlias('Mailer', \OCP\Mail\IMailer::class); |
801 | 801 | |
802 | - $this->registerService('LDAPProvider', function (Server $c) { |
|
802 | + $this->registerService('LDAPProvider', function(Server $c) { |
|
803 | 803 | $config = $c->getConfig(); |
804 | 804 | $factoryClass = $config->getSystemValue('ldapProviderFactory', null); |
805 | 805 | if (is_null($factoryClass)) { |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | $factory = new $factoryClass($this); |
810 | 810 | return $factory->getLDAPProvider(); |
811 | 811 | }); |
812 | - $this->registerService(ILockingProvider::class, function (Server $c) { |
|
812 | + $this->registerService(ILockingProvider::class, function(Server $c) { |
|
813 | 813 | $ini = $c->getIniWrapper(); |
814 | 814 | $config = $c->getConfig(); |
815 | 815 | $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); |
@@ -826,49 +826,49 @@ discard block |
||
826 | 826 | }); |
827 | 827 | $this->registerAlias('LockingProvider', ILockingProvider::class); |
828 | 828 | |
829 | - $this->registerService(\OCP\Files\Mount\IMountManager::class, function () { |
|
829 | + $this->registerService(\OCP\Files\Mount\IMountManager::class, function() { |
|
830 | 830 | return new \OC\Files\Mount\Manager(); |
831 | 831 | }); |
832 | 832 | $this->registerAlias('MountManager', \OCP\Files\Mount\IMountManager::class); |
833 | 833 | |
834 | - $this->registerService(\OCP\Files\IMimeTypeDetector::class, function (Server $c) { |
|
834 | + $this->registerService(\OCP\Files\IMimeTypeDetector::class, function(Server $c) { |
|
835 | 835 | return new \OC\Files\Type\Detection( |
836 | 836 | $c->getURLGenerator(), |
837 | 837 | \OC::$configDir, |
838 | - \OC::$SERVERROOT . '/resources/config/' |
|
838 | + \OC::$SERVERROOT.'/resources/config/' |
|
839 | 839 | ); |
840 | 840 | }); |
841 | 841 | $this->registerAlias('MimeTypeDetector', \OCP\Files\IMimeTypeDetector::class); |
842 | 842 | |
843 | - $this->registerService(\OCP\Files\IMimeTypeLoader::class, function (Server $c) { |
|
843 | + $this->registerService(\OCP\Files\IMimeTypeLoader::class, function(Server $c) { |
|
844 | 844 | return new \OC\Files\Type\Loader( |
845 | 845 | $c->getDatabaseConnection() |
846 | 846 | ); |
847 | 847 | }); |
848 | 848 | $this->registerAlias('MimeTypeLoader', \OCP\Files\IMimeTypeLoader::class); |
849 | - $this->registerService(BundleFetcher::class, function () { |
|
849 | + $this->registerService(BundleFetcher::class, function() { |
|
850 | 850 | return new BundleFetcher($this->getL10N('lib')); |
851 | 851 | }); |
852 | - $this->registerService(\OCP\Notification\IManager::class, function (Server $c) { |
|
852 | + $this->registerService(\OCP\Notification\IManager::class, function(Server $c) { |
|
853 | 853 | return new Manager( |
854 | 854 | $c->query(IValidator::class) |
855 | 855 | ); |
856 | 856 | }); |
857 | 857 | $this->registerAlias('NotificationManager', \OCP\Notification\IManager::class); |
858 | 858 | |
859 | - $this->registerService(\OC\CapabilitiesManager::class, function (Server $c) { |
|
859 | + $this->registerService(\OC\CapabilitiesManager::class, function(Server $c) { |
|
860 | 860 | $manager = new \OC\CapabilitiesManager($c->getLogger()); |
861 | - $manager->registerCapability(function () use ($c) { |
|
861 | + $manager->registerCapability(function() use ($c) { |
|
862 | 862 | return new \OC\OCS\CoreCapabilities($c->getConfig()); |
863 | 863 | }); |
864 | - $manager->registerCapability(function () use ($c) { |
|
864 | + $manager->registerCapability(function() use ($c) { |
|
865 | 865 | return $c->query(\OC\Security\Bruteforce\Capabilities::class); |
866 | 866 | }); |
867 | 867 | return $manager; |
868 | 868 | }); |
869 | 869 | $this->registerAlias('CapabilitiesManager', \OC\CapabilitiesManager::class); |
870 | 870 | |
871 | - $this->registerService(\OCP\Comments\ICommentsManager::class, function (Server $c) { |
|
871 | + $this->registerService(\OCP\Comments\ICommentsManager::class, function(Server $c) { |
|
872 | 872 | $config = $c->getConfig(); |
873 | 873 | $factoryClass = $config->getSystemValue('comments.managerFactory', '\OC\Comments\ManagerFactory'); |
874 | 874 | /** @var \OCP\Comments\ICommentsManagerFactory $factory */ |
@@ -877,7 +877,7 @@ discard block |
||
877 | 877 | }); |
878 | 878 | $this->registerAlias('CommentsManager', \OCP\Comments\ICommentsManager::class); |
879 | 879 | |
880 | - $this->registerService('ThemingDefaults', function (Server $c) { |
|
880 | + $this->registerService('ThemingDefaults', function(Server $c) { |
|
881 | 881 | /* |
882 | 882 | * Dark magic for autoloader. |
883 | 883 | * If we do a class_exists it will try to load the class which will |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | } |
905 | 905 | return new \OC_Defaults(); |
906 | 906 | }); |
907 | - $this->registerService(SCSSCacher::class, function (Server $c) { |
|
907 | + $this->registerService(SCSSCacher::class, function(Server $c) { |
|
908 | 908 | /** @var Factory $cacheFactory */ |
909 | 909 | $cacheFactory = $c->query(Factory::class); |
910 | 910 | return new SCSSCacher( |
@@ -917,13 +917,13 @@ discard block |
||
917 | 917 | $cacheFactory->create('SCSS') |
918 | 918 | ); |
919 | 919 | }); |
920 | - $this->registerService(EventDispatcher::class, function () { |
|
920 | + $this->registerService(EventDispatcher::class, function() { |
|
921 | 921 | return new EventDispatcher(); |
922 | 922 | }); |
923 | 923 | $this->registerAlias('EventDispatcher', EventDispatcher::class); |
924 | 924 | $this->registerAlias(EventDispatcherInterface::class, EventDispatcher::class); |
925 | 925 | |
926 | - $this->registerService('CryptoWrapper', function (Server $c) { |
|
926 | + $this->registerService('CryptoWrapper', function(Server $c) { |
|
927 | 927 | // FIXME: Instantiiated here due to cyclic dependency |
928 | 928 | $request = new Request( |
929 | 929 | [ |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | $request |
949 | 949 | ); |
950 | 950 | }); |
951 | - $this->registerService('CsrfTokenManager', function (Server $c) { |
|
951 | + $this->registerService('CsrfTokenManager', function(Server $c) { |
|
952 | 952 | $tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom()); |
953 | 953 | |
954 | 954 | return new CsrfTokenManager( |
@@ -956,22 +956,22 @@ discard block |
||
956 | 956 | $c->query(SessionStorage::class) |
957 | 957 | ); |
958 | 958 | }); |
959 | - $this->registerService(SessionStorage::class, function (Server $c) { |
|
959 | + $this->registerService(SessionStorage::class, function(Server $c) { |
|
960 | 960 | return new SessionStorage($c->getSession()); |
961 | 961 | }); |
962 | - $this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function (Server $c) { |
|
962 | + $this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function(Server $c) { |
|
963 | 963 | return new ContentSecurityPolicyManager(); |
964 | 964 | }); |
965 | 965 | $this->registerAlias('ContentSecurityPolicyManager', \OCP\Security\IContentSecurityPolicyManager::class); |
966 | 966 | |
967 | - $this->registerService('ContentSecurityPolicyNonceManager', function (Server $c) { |
|
967 | + $this->registerService('ContentSecurityPolicyNonceManager', function(Server $c) { |
|
968 | 968 | return new ContentSecurityPolicyNonceManager( |
969 | 969 | $c->getCsrfTokenManager(), |
970 | 970 | $c->getRequest() |
971 | 971 | ); |
972 | 972 | }); |
973 | 973 | |
974 | - $this->registerService(\OCP\Share\IManager::class, function (Server $c) { |
|
974 | + $this->registerService(\OCP\Share\IManager::class, function(Server $c) { |
|
975 | 975 | $config = $c->getConfig(); |
976 | 976 | $factoryClass = $config->getSystemValue('sharing.managerFactory', '\OC\Share20\ProviderFactory'); |
977 | 977 | /** @var \OCP\Share\IProviderFactory $factory */ |
@@ -1014,7 +1014,7 @@ discard block |
||
1014 | 1014 | |
1015 | 1015 | $this->registerAlias(\OCP\Collaboration\AutoComplete\IManager::class, \OC\Collaboration\AutoComplete\Manager::class); |
1016 | 1016 | |
1017 | - $this->registerService('SettingsManager', function (Server $c) { |
|
1017 | + $this->registerService('SettingsManager', function(Server $c) { |
|
1018 | 1018 | $manager = new \OC\Settings\Manager( |
1019 | 1019 | $c->getLogger(), |
1020 | 1020 | $c->getDatabaseConnection(), |
@@ -1034,29 +1034,29 @@ discard block |
||
1034 | 1034 | ); |
1035 | 1035 | return $manager; |
1036 | 1036 | }); |
1037 | - $this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) { |
|
1037 | + $this->registerService(\OC\Files\AppData\Factory::class, function(Server $c) { |
|
1038 | 1038 | return new \OC\Files\AppData\Factory( |
1039 | 1039 | $c->getRootFolder(), |
1040 | 1040 | $c->getSystemConfig() |
1041 | 1041 | ); |
1042 | 1042 | }); |
1043 | 1043 | |
1044 | - $this->registerService('LockdownManager', function (Server $c) { |
|
1045 | - return new LockdownManager(function () use ($c) { |
|
1044 | + $this->registerService('LockdownManager', function(Server $c) { |
|
1045 | + return new LockdownManager(function() use ($c) { |
|
1046 | 1046 | return $c->getSession(); |
1047 | 1047 | }); |
1048 | 1048 | }); |
1049 | 1049 | |
1050 | - $this->registerService(\OCP\OCS\IDiscoveryService::class, function (Server $c) { |
|
1050 | + $this->registerService(\OCP\OCS\IDiscoveryService::class, function(Server $c) { |
|
1051 | 1051 | return new DiscoveryService($c->getMemCacheFactory(), $c->getHTTPClientService()); |
1052 | 1052 | }); |
1053 | 1053 | |
1054 | - $this->registerService(ICloudIdManager::class, function (Server $c) { |
|
1054 | + $this->registerService(ICloudIdManager::class, function(Server $c) { |
|
1055 | 1055 | return new CloudIdManager(); |
1056 | 1056 | }); |
1057 | 1057 | |
1058 | 1058 | /* To trick DI since we don't extend the DIContainer here */ |
1059 | - $this->registerService(CleanPreviewsBackgroundJob::class, function (Server $c) { |
|
1059 | + $this->registerService(CleanPreviewsBackgroundJob::class, function(Server $c) { |
|
1060 | 1060 | return new CleanPreviewsBackgroundJob( |
1061 | 1061 | $c->getRootFolder(), |
1062 | 1062 | $c->getLogger(), |
@@ -1071,18 +1071,18 @@ discard block |
||
1071 | 1071 | $this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class); |
1072 | 1072 | $this->registerAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class); |
1073 | 1073 | |
1074 | - $this->registerService(Defaults::class, function (Server $c) { |
|
1074 | + $this->registerService(Defaults::class, function(Server $c) { |
|
1075 | 1075 | return new Defaults( |
1076 | 1076 | $c->getThemingDefaults() |
1077 | 1077 | ); |
1078 | 1078 | }); |
1079 | 1079 | $this->registerAlias('Defaults', \OCP\Defaults::class); |
1080 | 1080 | |
1081 | - $this->registerService(\OCP\ISession::class, function (SimpleContainer $c) { |
|
1081 | + $this->registerService(\OCP\ISession::class, function(SimpleContainer $c) { |
|
1082 | 1082 | return $c->query(\OCP\IUserSession::class)->getSession(); |
1083 | 1083 | }); |
1084 | 1084 | |
1085 | - $this->registerService(IShareHelper::class, function (Server $c) { |
|
1085 | + $this->registerService(IShareHelper::class, function(Server $c) { |
|
1086 | 1086 | return new ShareHelper( |
1087 | 1087 | $c->query(\OCP\Share\IManager::class) |
1088 | 1088 | ); |
@@ -1223,7 +1223,7 @@ discard block |
||
1223 | 1223 | * @deprecated since 9.2.0 use IAppData |
1224 | 1224 | */ |
1225 | 1225 | public function getAppFolder() { |
1226 | - $dir = '/' . \OC_App::getCurrentApp(); |
|
1226 | + $dir = '/'.\OC_App::getCurrentApp(); |
|
1227 | 1227 | $root = $this->getRootFolder(); |
1228 | 1228 | if (!$root->nodeExists($dir)) { |
1229 | 1229 | $folder = $root->newFolder($dir); |
@@ -1807,7 +1807,7 @@ discard block |
||
1807 | 1807 | /** |
1808 | 1808 | * @return \OCP\Collaboration\AutoComplete\IManager |
1809 | 1809 | */ |
1810 | - public function getAutoCompleteManager(){ |
|
1810 | + public function getAutoCompleteManager() { |
|
1811 | 1811 | return $this->query(IManager::class); |
1812 | 1812 | } |
1813 | 1813 |
@@ -32,71 +32,71 @@ |
||
32 | 32 | use OCP\Share; |
33 | 33 | |
34 | 34 | class AutoCompleteController extends Controller { |
35 | - /** @var ISearch */ |
|
36 | - private $collaboratorSearch; |
|
37 | - /** @var IManager */ |
|
38 | - private $autoCompleteManager; |
|
39 | - /** @var IConfig */ |
|
40 | - private $config; |
|
35 | + /** @var ISearch */ |
|
36 | + private $collaboratorSearch; |
|
37 | + /** @var IManager */ |
|
38 | + private $autoCompleteManager; |
|
39 | + /** @var IConfig */ |
|
40 | + private $config; |
|
41 | 41 | |
42 | - public function __construct( |
|
43 | - $appName, |
|
44 | - IRequest $request, |
|
45 | - ISearch $collaboratorSearch, |
|
46 | - IManager $autoCompleteManager, |
|
47 | - IConfig $config |
|
48 | - ) { |
|
49 | - parent::__construct($appName, $request); |
|
42 | + public function __construct( |
|
43 | + $appName, |
|
44 | + IRequest $request, |
|
45 | + ISearch $collaboratorSearch, |
|
46 | + IManager $autoCompleteManager, |
|
47 | + IConfig $config |
|
48 | + ) { |
|
49 | + parent::__construct($appName, $request); |
|
50 | 50 | |
51 | - $this->collaboratorSearch = $collaboratorSearch; |
|
52 | - $this->autoCompleteManager = $autoCompleteManager; |
|
53 | - $this->config = $config; |
|
54 | - } |
|
51 | + $this->collaboratorSearch = $collaboratorSearch; |
|
52 | + $this->autoCompleteManager = $autoCompleteManager; |
|
53 | + $this->config = $config; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @NoAdminRequired |
|
58 | - * |
|
59 | - * @param string $search |
|
60 | - * @param string $itemType |
|
61 | - * @param string $itemId |
|
62 | - * @param string|null $sorter can be piped, top prio first, e.g.: "commenters|share-recipients" |
|
63 | - * @param array $shareTypes |
|
64 | - * @param int $limit |
|
65 | - * @return DataResponse |
|
66 | - */ |
|
67 | - public function get($search, $itemType, $itemId, $sorter = null, $shareTypes = [Share::SHARE_TYPE_USER], $limit = 10) { |
|
68 | - // if enumeration/user listings are disabled, we'll receive an empty |
|
69 | - // result from search() – thus nothing else to do here. |
|
70 | - list($results,) = $this->collaboratorSearch->search($search, $shareTypes, false, $limit, 0); |
|
56 | + /** |
|
57 | + * @NoAdminRequired |
|
58 | + * |
|
59 | + * @param string $search |
|
60 | + * @param string $itemType |
|
61 | + * @param string $itemId |
|
62 | + * @param string|null $sorter can be piped, top prio first, e.g.: "commenters|share-recipients" |
|
63 | + * @param array $shareTypes |
|
64 | + * @param int $limit |
|
65 | + * @return DataResponse |
|
66 | + */ |
|
67 | + public function get($search, $itemType, $itemId, $sorter = null, $shareTypes = [Share::SHARE_TYPE_USER], $limit = 10) { |
|
68 | + // if enumeration/user listings are disabled, we'll receive an empty |
|
69 | + // result from search() – thus nothing else to do here. |
|
70 | + list($results,) = $this->collaboratorSearch->search($search, $shareTypes, false, $limit, 0); |
|
71 | 71 | |
72 | - $exactMatches = $results['exact']; |
|
73 | - unset($results['exact']); |
|
74 | - $results = array_merge_recursive($exactMatches, $results); |
|
72 | + $exactMatches = $results['exact']; |
|
73 | + unset($results['exact']); |
|
74 | + $results = array_merge_recursive($exactMatches, $results); |
|
75 | 75 | |
76 | - $sorters = array_reverse(explode('|', $sorter)); |
|
77 | - $this->autoCompleteManager->runSorters($sorters, $results, [ |
|
78 | - 'itemType' => $itemType, |
|
79 | - 'itemId' => $itemId, |
|
80 | - ]); |
|
76 | + $sorters = array_reverse(explode('|', $sorter)); |
|
77 | + $this->autoCompleteManager->runSorters($sorters, $results, [ |
|
78 | + 'itemType' => $itemType, |
|
79 | + 'itemId' => $itemId, |
|
80 | + ]); |
|
81 | 81 | |
82 | - // transform to expected format |
|
83 | - $results = $this->prepareResultArray($results); |
|
82 | + // transform to expected format |
|
83 | + $results = $this->prepareResultArray($results); |
|
84 | 84 | |
85 | - return new DataResponse($results); |
|
86 | - } |
|
85 | + return new DataResponse($results); |
|
86 | + } |
|
87 | 87 | |
88 | 88 | |
89 | - protected function prepareResultArray(array $results) { |
|
90 | - $output = []; |
|
91 | - foreach ($results as $type => $subResult) { |
|
92 | - foreach ($subResult as $result) { |
|
93 | - $output[] = [ |
|
94 | - 'id' => $result['value']['shareWith'], |
|
95 | - 'label' => $result['label'], |
|
96 | - 'source' => $type, |
|
97 | - ]; |
|
98 | - } |
|
99 | - } |
|
100 | - return $output; |
|
101 | - } |
|
89 | + protected function prepareResultArray(array $results) { |
|
90 | + $output = []; |
|
91 | + foreach ($results as $type => $subResult) { |
|
92 | + foreach ($subResult as $result) { |
|
93 | + $output[] = [ |
|
94 | + 'id' => $result['value']['shareWith'], |
|
95 | + 'label' => $result['label'], |
|
96 | + 'source' => $type, |
|
97 | + ]; |
|
98 | + } |
|
99 | + } |
|
100 | + return $output; |
|
101 | + } |
|
102 | 102 | } |
@@ -6,74 +6,74 @@ |
||
6 | 6 | |
7 | 7 | class ComposerStaticInitFiles_Sharing |
8 | 8 | { |
9 | - public static $prefixLengthsPsr4 = array ( |
|
9 | + public static $prefixLengthsPsr4 = array( |
|
10 | 10 | 'O' => |
11 | - array ( |
|
11 | + array( |
|
12 | 12 | 'OCA\\Files_Sharing\\' => 18, |
13 | 13 | ), |
14 | 14 | ); |
15 | 15 | |
16 | - public static $prefixDirsPsr4 = array ( |
|
16 | + public static $prefixDirsPsr4 = array( |
|
17 | 17 | 'OCA\\Files_Sharing\\' => |
18 | - array ( |
|
19 | - 0 => __DIR__ . '/..' . '/../lib', |
|
18 | + array( |
|
19 | + 0 => __DIR__.'/..'.'/../lib', |
|
20 | 20 | ), |
21 | 21 | ); |
22 | 22 | |
23 | - public static $classMap = array ( |
|
24 | - 'OCA\\Files_Sharing\\Activity\\Filter' => __DIR__ . '/..' . '/../lib/Activity/Filter.php', |
|
25 | - 'OCA\\Files_Sharing\\Activity\\Providers\\Base' => __DIR__ . '/..' . '/../lib/Activity/Providers/Base.php', |
|
26 | - 'OCA\\Files_Sharing\\Activity\\Providers\\Downloads' => __DIR__ . '/..' . '/../lib/Activity/Providers/Downloads.php', |
|
27 | - 'OCA\\Files_Sharing\\Activity\\Providers\\Groups' => __DIR__ . '/..' . '/../lib/Activity/Providers/Groups.php', |
|
28 | - 'OCA\\Files_Sharing\\Activity\\Providers\\PublicLinks' => __DIR__ . '/..' . '/../lib/Activity/Providers/PublicLinks.php', |
|
29 | - 'OCA\\Files_Sharing\\Activity\\Providers\\RemoteShares' => __DIR__ . '/..' . '/../lib/Activity/Providers/RemoteShares.php', |
|
30 | - 'OCA\\Files_Sharing\\Activity\\Providers\\Users' => __DIR__ . '/..' . '/../lib/Activity/Providers/Users.php', |
|
31 | - 'OCA\\Files_Sharing\\Activity\\Settings\\PublicLinks' => __DIR__ . '/..' . '/../lib/Activity/Settings/PublicLinks.php', |
|
32 | - 'OCA\\Files_Sharing\\Activity\\Settings\\RemoteShare' => __DIR__ . '/..' . '/../lib/Activity/Settings/RemoteShare.php', |
|
33 | - 'OCA\\Files_Sharing\\Activity\\Settings\\Shared' => __DIR__ . '/..' . '/../lib/Activity/Settings/Shared.php', |
|
34 | - 'OCA\\Files_Sharing\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php', |
|
35 | - 'OCA\\Files_Sharing\\Cache' => __DIR__ . '/..' . '/../lib/Cache.php', |
|
36 | - 'OCA\\Files_Sharing\\Capabilities' => __DIR__ . '/..' . '/../lib/Capabilities.php', |
|
37 | - 'OCA\\Files_Sharing\\Collaboration\\ShareRecipientSorter' => __DIR__ . '/..' . '/../lib/Collaboration/ShareRecipientSorter.php', |
|
38 | - 'OCA\\Files_Sharing\\Command\\CleanupRemoteStorages' => __DIR__ . '/..' . '/../lib/Command/CleanupRemoteStorages.php', |
|
39 | - 'OCA\\Files_Sharing\\Controller\\ExternalSharesController' => __DIR__ . '/..' . '/../lib/Controller/ExternalSharesController.php', |
|
40 | - 'OCA\\Files_Sharing\\Controller\\PublicPreviewController' => __DIR__ . '/..' . '/../lib/Controller/PublicPreviewController.php', |
|
41 | - 'OCA\\Files_Sharing\\Controller\\RemoteController' => __DIR__ . '/..' . '/../lib/Controller/RemoteController.php', |
|
42 | - 'OCA\\Files_Sharing\\Controller\\ShareAPIController' => __DIR__ . '/..' . '/../lib/Controller/ShareAPIController.php', |
|
43 | - 'OCA\\Files_Sharing\\Controller\\ShareController' => __DIR__ . '/..' . '/../lib/Controller/ShareController.php', |
|
44 | - 'OCA\\Files_Sharing\\Controller\\ShareInfoController' => __DIR__ . '/..' . '/../lib/Controller/ShareInfoController.php', |
|
45 | - 'OCA\\Files_Sharing\\Controller\\ShareesAPIController' => __DIR__ . '/..' . '/../lib/Controller/ShareesAPIController.php', |
|
46 | - 'OCA\\Files_Sharing\\DeleteOrphanedSharesJob' => __DIR__ . '/..' . '/../lib/DeleteOrphanedSharesJob.php', |
|
47 | - 'OCA\\Files_Sharing\\Exceptions\\BrokenPath' => __DIR__ . '/..' . '/../lib/Exceptions/BrokenPath.php', |
|
48 | - 'OCA\\Files_Sharing\\Exceptions\\S2SException' => __DIR__ . '/..' . '/../lib/Exceptions/S2SException.php', |
|
49 | - 'OCA\\Files_Sharing\\ExpireSharesJob' => __DIR__ . '/..' . '/../lib/ExpireSharesJob.php', |
|
50 | - 'OCA\\Files_Sharing\\External\\Cache' => __DIR__ . '/..' . '/../lib/External/Cache.php', |
|
51 | - 'OCA\\Files_Sharing\\External\\Manager' => __DIR__ . '/..' . '/../lib/External/Manager.php', |
|
52 | - 'OCA\\Files_Sharing\\External\\Mount' => __DIR__ . '/..' . '/../lib/External/Mount.php', |
|
53 | - 'OCA\\Files_Sharing\\External\\MountProvider' => __DIR__ . '/..' . '/../lib/External/MountProvider.php', |
|
54 | - 'OCA\\Files_Sharing\\External\\Scanner' => __DIR__ . '/..' . '/../lib/External/Scanner.php', |
|
55 | - 'OCA\\Files_Sharing\\External\\Storage' => __DIR__ . '/..' . '/../lib/External/Storage.php', |
|
56 | - 'OCA\\Files_Sharing\\External\\Watcher' => __DIR__ . '/..' . '/../lib/External/Watcher.php', |
|
57 | - 'OCA\\Files_Sharing\\Helper' => __DIR__ . '/..' . '/../lib/Helper.php', |
|
58 | - 'OCA\\Files_Sharing\\Hooks' => __DIR__ . '/..' . '/../lib/Hooks.php', |
|
59 | - 'OCA\\Files_Sharing\\ISharedStorage' => __DIR__ . '/..' . '/../lib/ISharedStorage.php', |
|
60 | - 'OCA\\Files_Sharing\\Middleware\\OCSShareAPIMiddleware' => __DIR__ . '/..' . '/../lib/Middleware/OCSShareAPIMiddleware.php', |
|
61 | - 'OCA\\Files_Sharing\\Middleware\\ShareInfoMiddleware' => __DIR__ . '/..' . '/../lib/Middleware/ShareInfoMiddleware.php', |
|
62 | - 'OCA\\Files_Sharing\\Middleware\\SharingCheckMiddleware' => __DIR__ . '/..' . '/../lib/Middleware/SharingCheckMiddleware.php', |
|
63 | - 'OCA\\Files_Sharing\\Migration\\OwncloudGuestShareType' => __DIR__ . '/..' . '/../lib/Migration/OwncloudGuestShareType.php', |
|
64 | - 'OCA\\Files_Sharing\\Migration\\SetPasswordColumn' => __DIR__ . '/..' . '/../lib/Migration/SetPasswordColumn.php', |
|
65 | - 'OCA\\Files_Sharing\\MountProvider' => __DIR__ . '/..' . '/../lib/MountProvider.php', |
|
66 | - 'OCA\\Files_Sharing\\Scanner' => __DIR__ . '/..' . '/../lib/Scanner.php', |
|
67 | - 'OCA\\Files_Sharing\\ShareBackend\\File' => __DIR__ . '/..' . '/../lib/ShareBackend/File.php', |
|
68 | - 'OCA\\Files_Sharing\\ShareBackend\\Folder' => __DIR__ . '/..' . '/../lib/ShareBackend/Folder.php', |
|
69 | - 'OCA\\Files_Sharing\\SharedMount' => __DIR__ . '/..' . '/../lib/SharedMount.php', |
|
70 | - 'OCA\\Files_Sharing\\SharedStorage' => __DIR__ . '/..' . '/../lib/SharedStorage.php', |
|
71 | - 'OCA\\Files_Sharing\\Updater' => __DIR__ . '/..' . '/../lib/Updater.php', |
|
23 | + public static $classMap = array( |
|
24 | + 'OCA\\Files_Sharing\\Activity\\Filter' => __DIR__.'/..'.'/../lib/Activity/Filter.php', |
|
25 | + 'OCA\\Files_Sharing\\Activity\\Providers\\Base' => __DIR__.'/..'.'/../lib/Activity/Providers/Base.php', |
|
26 | + 'OCA\\Files_Sharing\\Activity\\Providers\\Downloads' => __DIR__.'/..'.'/../lib/Activity/Providers/Downloads.php', |
|
27 | + 'OCA\\Files_Sharing\\Activity\\Providers\\Groups' => __DIR__.'/..'.'/../lib/Activity/Providers/Groups.php', |
|
28 | + 'OCA\\Files_Sharing\\Activity\\Providers\\PublicLinks' => __DIR__.'/..'.'/../lib/Activity/Providers/PublicLinks.php', |
|
29 | + 'OCA\\Files_Sharing\\Activity\\Providers\\RemoteShares' => __DIR__.'/..'.'/../lib/Activity/Providers/RemoteShares.php', |
|
30 | + 'OCA\\Files_Sharing\\Activity\\Providers\\Users' => __DIR__.'/..'.'/../lib/Activity/Providers/Users.php', |
|
31 | + 'OCA\\Files_Sharing\\Activity\\Settings\\PublicLinks' => __DIR__.'/..'.'/../lib/Activity/Settings/PublicLinks.php', |
|
32 | + 'OCA\\Files_Sharing\\Activity\\Settings\\RemoteShare' => __DIR__.'/..'.'/../lib/Activity/Settings/RemoteShare.php', |
|
33 | + 'OCA\\Files_Sharing\\Activity\\Settings\\Shared' => __DIR__.'/..'.'/../lib/Activity/Settings/Shared.php', |
|
34 | + 'OCA\\Files_Sharing\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php', |
|
35 | + 'OCA\\Files_Sharing\\Cache' => __DIR__.'/..'.'/../lib/Cache.php', |
|
36 | + 'OCA\\Files_Sharing\\Capabilities' => __DIR__.'/..'.'/../lib/Capabilities.php', |
|
37 | + 'OCA\\Files_Sharing\\Collaboration\\ShareRecipientSorter' => __DIR__.'/..'.'/../lib/Collaboration/ShareRecipientSorter.php', |
|
38 | + 'OCA\\Files_Sharing\\Command\\CleanupRemoteStorages' => __DIR__.'/..'.'/../lib/Command/CleanupRemoteStorages.php', |
|
39 | + 'OCA\\Files_Sharing\\Controller\\ExternalSharesController' => __DIR__.'/..'.'/../lib/Controller/ExternalSharesController.php', |
|
40 | + 'OCA\\Files_Sharing\\Controller\\PublicPreviewController' => __DIR__.'/..'.'/../lib/Controller/PublicPreviewController.php', |
|
41 | + 'OCA\\Files_Sharing\\Controller\\RemoteController' => __DIR__.'/..'.'/../lib/Controller/RemoteController.php', |
|
42 | + 'OCA\\Files_Sharing\\Controller\\ShareAPIController' => __DIR__.'/..'.'/../lib/Controller/ShareAPIController.php', |
|
43 | + 'OCA\\Files_Sharing\\Controller\\ShareController' => __DIR__.'/..'.'/../lib/Controller/ShareController.php', |
|
44 | + 'OCA\\Files_Sharing\\Controller\\ShareInfoController' => __DIR__.'/..'.'/../lib/Controller/ShareInfoController.php', |
|
45 | + 'OCA\\Files_Sharing\\Controller\\ShareesAPIController' => __DIR__.'/..'.'/../lib/Controller/ShareesAPIController.php', |
|
46 | + 'OCA\\Files_Sharing\\DeleteOrphanedSharesJob' => __DIR__.'/..'.'/../lib/DeleteOrphanedSharesJob.php', |
|
47 | + 'OCA\\Files_Sharing\\Exceptions\\BrokenPath' => __DIR__.'/..'.'/../lib/Exceptions/BrokenPath.php', |
|
48 | + 'OCA\\Files_Sharing\\Exceptions\\S2SException' => __DIR__.'/..'.'/../lib/Exceptions/S2SException.php', |
|
49 | + 'OCA\\Files_Sharing\\ExpireSharesJob' => __DIR__.'/..'.'/../lib/ExpireSharesJob.php', |
|
50 | + 'OCA\\Files_Sharing\\External\\Cache' => __DIR__.'/..'.'/../lib/External/Cache.php', |
|
51 | + 'OCA\\Files_Sharing\\External\\Manager' => __DIR__.'/..'.'/../lib/External/Manager.php', |
|
52 | + 'OCA\\Files_Sharing\\External\\Mount' => __DIR__.'/..'.'/../lib/External/Mount.php', |
|
53 | + 'OCA\\Files_Sharing\\External\\MountProvider' => __DIR__.'/..'.'/../lib/External/MountProvider.php', |
|
54 | + 'OCA\\Files_Sharing\\External\\Scanner' => __DIR__.'/..'.'/../lib/External/Scanner.php', |
|
55 | + 'OCA\\Files_Sharing\\External\\Storage' => __DIR__.'/..'.'/../lib/External/Storage.php', |
|
56 | + 'OCA\\Files_Sharing\\External\\Watcher' => __DIR__.'/..'.'/../lib/External/Watcher.php', |
|
57 | + 'OCA\\Files_Sharing\\Helper' => __DIR__.'/..'.'/../lib/Helper.php', |
|
58 | + 'OCA\\Files_Sharing\\Hooks' => __DIR__.'/..'.'/../lib/Hooks.php', |
|
59 | + 'OCA\\Files_Sharing\\ISharedStorage' => __DIR__.'/..'.'/../lib/ISharedStorage.php', |
|
60 | + 'OCA\\Files_Sharing\\Middleware\\OCSShareAPIMiddleware' => __DIR__.'/..'.'/../lib/Middleware/OCSShareAPIMiddleware.php', |
|
61 | + 'OCA\\Files_Sharing\\Middleware\\ShareInfoMiddleware' => __DIR__.'/..'.'/../lib/Middleware/ShareInfoMiddleware.php', |
|
62 | + 'OCA\\Files_Sharing\\Middleware\\SharingCheckMiddleware' => __DIR__.'/..'.'/../lib/Middleware/SharingCheckMiddleware.php', |
|
63 | + 'OCA\\Files_Sharing\\Migration\\OwncloudGuestShareType' => __DIR__.'/..'.'/../lib/Migration/OwncloudGuestShareType.php', |
|
64 | + 'OCA\\Files_Sharing\\Migration\\SetPasswordColumn' => __DIR__.'/..'.'/../lib/Migration/SetPasswordColumn.php', |
|
65 | + 'OCA\\Files_Sharing\\MountProvider' => __DIR__.'/..'.'/../lib/MountProvider.php', |
|
66 | + 'OCA\\Files_Sharing\\Scanner' => __DIR__.'/..'.'/../lib/Scanner.php', |
|
67 | + 'OCA\\Files_Sharing\\ShareBackend\\File' => __DIR__.'/..'.'/../lib/ShareBackend/File.php', |
|
68 | + 'OCA\\Files_Sharing\\ShareBackend\\Folder' => __DIR__.'/..'.'/../lib/ShareBackend/Folder.php', |
|
69 | + 'OCA\\Files_Sharing\\SharedMount' => __DIR__.'/..'.'/../lib/SharedMount.php', |
|
70 | + 'OCA\\Files_Sharing\\SharedStorage' => __DIR__.'/..'.'/../lib/SharedStorage.php', |
|
71 | + 'OCA\\Files_Sharing\\Updater' => __DIR__.'/..'.'/../lib/Updater.php', |
|
72 | 72 | ); |
73 | 73 | |
74 | 74 | public static function getInitializer(ClassLoader $loader) |
75 | 75 | { |
76 | - return \Closure::bind(function () use ($loader) { |
|
76 | + return \Closure::bind(function() use ($loader) { |
|
77 | 77 | $loader->prefixLengthsPsr4 = ComposerStaticInitFiles_Sharing::$prefixLengthsPsr4; |
78 | 78 | $loader->prefixDirsPsr4 = ComposerStaticInitFiles_Sharing::$prefixDirsPsr4; |
79 | 79 | $loader->classMap = ComposerStaticInitFiles_Sharing::$classMap; |