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