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