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