Completed
Pull Request — master (#3531)
by Julius
37:26 queued 25:09
created
themes/example/defaults.php 1 patch
Indentation   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -20,145 +20,145 @@
 block discarded – undo
20 20
 
21 21
 class OC_Theme {
22 22
 
23
-	/**
24
-	 * Returns the base URL
25
-	 * @return string URL
26
-	 */
27
-	public function getBaseUrl() {
28
-		return 'https://nextcloud.com';
29
-	}
30
-
31
-	/**
32
-	 * Returns the URL where the sync clients are listed
33
-	 * @return string URL
34
-	 */
35
-	public function getSyncClientUrl() {
36
-		return 'https://nextcloud.com/install/#install-clients';
37
-	}
38
-
39
-	/**
40
-	 * Returns the URL to the App Store for the iOS Client
41
-	 * @return string URL
42
-	 */
43
-	public function getiOSClientUrl() {
44
-		return 'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8';
45
-	}
46
-
47
-	/**
48
-	 * Returns the AppId for the App Store for the iOS Client
49
-	 * @return string AppId
50
-	 */
51
-	public function getiTunesAppId() {
52
-		return '1125420102';
53
-	}
54
-
55
-	/**
56
-	 * Returns the URL to Google Play for the Android Client
57
-	 * @return string URL
58
-	 */
59
-	public function getAndroidClientUrl() {
60
-		return 'https://play.google.com/store/apps/details?id=com.nextcloud.client';
61
-	}
62
-
63
-	/**
64
-	 * Returns the documentation URL
65
-	 * @return string URL
66
-	 */
67
-	public function getDocBaseUrl() {
68
-		return 'https://docs.nextcloud.com';
69
-	}
70
-
71
-	/**
72
-	 * Returns the title
73
-	 * @return string title
74
-	 */
75
-	public function getTitle() {
76
-		return 'Custom Cloud';
77
-	}
78
-
79
-	/**
80
-	 * Returns the short name of the software
81
-	 * @return string title
82
-	 */
83
-	public function getName() {
84
-		return 'Custom Cloud';
85
-	}
86
-
87
-	/**
88
-	 * Returns the short name of the software containing HTML strings
89
-	 * @return string title
90
-	 */
91
-	public function getHTMLName() {
92
-		return 'Custom Cloud';
93
-	}
94
-
95
-	/**
96
-	 * Returns entity (e.g. company name) - used for footer, copyright
97
-	 * @return string entity name
98
-	 */
99
-	public function getEntity() {
100
-		return 'Custom Cloud Co.';
101
-	}
102
-
103
-	/**
104
-	 * Returns slogan
105
-	 * @return string slogan
106
-	 */
107
-	public function getSlogan() {
108
-		return 'Your custom cloud, personalized for you!';
109
-	}
110
-
111
-	/**
112
-	 * Returns logo claim
113
-	 * @return string logo claim
114
-	 */
115
-	public function getLogoClaim() {
116
-		return '';
117
-	}
118
-
119
-	/**
120
-	 * Returns short version of the footer
121
-	 * @return string short footer
122
-	 */
123
-	public function getShortFooter() {
124
-		$footer = '© 2016 <a href="'.$this->getBaseUrl().'" target="_blank\">'.$this->getEntity().'</a>'.
125
-			'<br/>' . $this->getSlogan();
126
-
127
-		return $footer;
128
-	}
129
-
130
-	/**
131
-	 * Returns long version of the footer
132
-	 * @return string long footer
133
-	 */
134
-	public function getLongFooter() {
135
-		$footer = '© 2016 <a href="'.$this->getBaseUrl().'" target="_blank\">'.$this->getEntity().'</a>'.
136
-			'<br/>' . $this->getSlogan();
137
-
138
-		return $footer;
139
-	}
140
-
141
-	public function buildDocLinkToKey($key) {
142
-		return $this->getDocBaseUrl() . '/server/11/go.php?to=' . $key;
143
-	}
144
-
145
-
146
-	/**
147
-	 * Returns mail header color
148
-	 * @return string
149
-	 */
150
-	public function getMailHeaderColor() {
151
-		return '#745bca';
152
-	}
153
-
154
-	/**
155
-	 * Returns variables to overload defaults from core/css/variables.scss
156
-	 * @return array
157
-	 */
158
-	public function getScssVariables() {
159
-		return [
160
-			'color-primary' => '#745bca'
161
-		];
162
-	}
23
+    /**
24
+     * Returns the base URL
25
+     * @return string URL
26
+     */
27
+    public function getBaseUrl() {
28
+        return 'https://nextcloud.com';
29
+    }
30
+
31
+    /**
32
+     * Returns the URL where the sync clients are listed
33
+     * @return string URL
34
+     */
35
+    public function getSyncClientUrl() {
36
+        return 'https://nextcloud.com/install/#install-clients';
37
+    }
38
+
39
+    /**
40
+     * Returns the URL to the App Store for the iOS Client
41
+     * @return string URL
42
+     */
43
+    public function getiOSClientUrl() {
44
+        return 'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8';
45
+    }
46
+
47
+    /**
48
+     * Returns the AppId for the App Store for the iOS Client
49
+     * @return string AppId
50
+     */
51
+    public function getiTunesAppId() {
52
+        return '1125420102';
53
+    }
54
+
55
+    /**
56
+     * Returns the URL to Google Play for the Android Client
57
+     * @return string URL
58
+     */
59
+    public function getAndroidClientUrl() {
60
+        return 'https://play.google.com/store/apps/details?id=com.nextcloud.client';
61
+    }
62
+
63
+    /**
64
+     * Returns the documentation URL
65
+     * @return string URL
66
+     */
67
+    public function getDocBaseUrl() {
68
+        return 'https://docs.nextcloud.com';
69
+    }
70
+
71
+    /**
72
+     * Returns the title
73
+     * @return string title
74
+     */
75
+    public function getTitle() {
76
+        return 'Custom Cloud';
77
+    }
78
+
79
+    /**
80
+     * Returns the short name of the software
81
+     * @return string title
82
+     */
83
+    public function getName() {
84
+        return 'Custom Cloud';
85
+    }
86
+
87
+    /**
88
+     * Returns the short name of the software containing HTML strings
89
+     * @return string title
90
+     */
91
+    public function getHTMLName() {
92
+        return 'Custom Cloud';
93
+    }
94
+
95
+    /**
96
+     * Returns entity (e.g. company name) - used for footer, copyright
97
+     * @return string entity name
98
+     */
99
+    public function getEntity() {
100
+        return 'Custom Cloud Co.';
101
+    }
102
+
103
+    /**
104
+     * Returns slogan
105
+     * @return string slogan
106
+     */
107
+    public function getSlogan() {
108
+        return 'Your custom cloud, personalized for you!';
109
+    }
110
+
111
+    /**
112
+     * Returns logo claim
113
+     * @return string logo claim
114
+     */
115
+    public function getLogoClaim() {
116
+        return '';
117
+    }
118
+
119
+    /**
120
+     * Returns short version of the footer
121
+     * @return string short footer
122
+     */
123
+    public function getShortFooter() {
124
+        $footer = '© 2016 <a href="'.$this->getBaseUrl().'" target="_blank\">'.$this->getEntity().'</a>'.
125
+            '<br/>' . $this->getSlogan();
126
+
127
+        return $footer;
128
+    }
129
+
130
+    /**
131
+     * Returns long version of the footer
132
+     * @return string long footer
133
+     */
134
+    public function getLongFooter() {
135
+        $footer = '© 2016 <a href="'.$this->getBaseUrl().'" target="_blank\">'.$this->getEntity().'</a>'.
136
+            '<br/>' . $this->getSlogan();
137
+
138
+        return $footer;
139
+    }
140
+
141
+    public function buildDocLinkToKey($key) {
142
+        return $this->getDocBaseUrl() . '/server/11/go.php?to=' . $key;
143
+    }
144
+
145
+
146
+    /**
147
+     * Returns mail header color
148
+     * @return string
149
+     */
150
+    public function getMailHeaderColor() {
151
+        return '#745bca';
152
+    }
153
+
154
+    /**
155
+     * Returns variables to overload defaults from core/css/variables.scss
156
+     * @return array
157
+     */
158
+    public function getScssVariables() {
159
+        return [
160
+            'color-primary' => '#745bca'
161
+        ];
162
+    }
163 163
 
164 164
 }
Please login to merge, or discard this patch.
lib/private/legacy/defaults.php 2 patches
Indentation   +240 added lines, -240 removed lines patch added patch discarded remove patch
@@ -31,269 +31,269 @@
 block discarded – undo
31 31
  */
32 32
 class OC_Defaults {
33 33
 
34
-	private $theme;
35
-	private $l;
34
+    private $theme;
35
+    private $l;
36 36
 
37
-	private $defaultEntity;
38
-	private $defaultName;
39
-	private $defaultTitle;
40
-	private $defaultBaseUrl;
41
-	private $defaultSyncClientUrl;
42
-	private $defaultiOSClientUrl;
43
-	private $defaultiTunesAppId;
44
-	private $defaultAndroidClientUrl;
45
-	private $defaultDocBaseUrl;
46
-	private $defaultDocVersion;
47
-	private $defaultSlogan;
48
-	private $defaultLogoClaim;
49
-	private $defaultMailHeaderColor;
37
+    private $defaultEntity;
38
+    private $defaultName;
39
+    private $defaultTitle;
40
+    private $defaultBaseUrl;
41
+    private $defaultSyncClientUrl;
42
+    private $defaultiOSClientUrl;
43
+    private $defaultiTunesAppId;
44
+    private $defaultAndroidClientUrl;
45
+    private $defaultDocBaseUrl;
46
+    private $defaultDocVersion;
47
+    private $defaultSlogan;
48
+    private $defaultLogoClaim;
49
+    private $defaultMailHeaderColor;
50 50
 
51
-	function __construct() {
52
-		$this->l = \OC::$server->getL10N('lib');
51
+    function __construct() {
52
+        $this->l = \OC::$server->getL10N('lib');
53 53
 
54
-		$this->defaultEntity = 'Nextcloud'; /* e.g. company name, used for footers and copyright notices */
55
-		$this->defaultName = 'Nextcloud'; /* short name, used when referring to the software */
56
-		$this->defaultTitle = 'Nextcloud'; /* can be a longer name, for titles */
57
-		$this->defaultBaseUrl = 'https://nextcloud.com';
58
-		$this->defaultSyncClientUrl = 'https://nextcloud.com/install/#install-clients';
59
-		$this->defaultiOSClientUrl = 'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8';
60
-		$this->defaultiTunesAppId = '1125420102';
61
-		$this->defaultAndroidClientUrl = 'https://play.google.com/store/apps/details?id=com.nextcloud.client';
62
-		$this->defaultDocBaseUrl = 'https://docs.nextcloud.com';
63
-		$this->defaultDocVersion = '11'; // used to generate doc links
64
-		$this->defaultSlogan = $this->l->t('a safe home for all your data');
65
-		$this->defaultLogoClaim = '';
66
-		$this->defaultMailHeaderColor = '#0082c9'; /* header color of mail notifications */
54
+        $this->defaultEntity = 'Nextcloud'; /* e.g. company name, used for footers and copyright notices */
55
+        $this->defaultName = 'Nextcloud'; /* short name, used when referring to the software */
56
+        $this->defaultTitle = 'Nextcloud'; /* can be a longer name, for titles */
57
+        $this->defaultBaseUrl = 'https://nextcloud.com';
58
+        $this->defaultSyncClientUrl = 'https://nextcloud.com/install/#install-clients';
59
+        $this->defaultiOSClientUrl = 'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8';
60
+        $this->defaultiTunesAppId = '1125420102';
61
+        $this->defaultAndroidClientUrl = 'https://play.google.com/store/apps/details?id=com.nextcloud.client';
62
+        $this->defaultDocBaseUrl = 'https://docs.nextcloud.com';
63
+        $this->defaultDocVersion = '11'; // used to generate doc links
64
+        $this->defaultSlogan = $this->l->t('a safe home for all your data');
65
+        $this->defaultLogoClaim = '';
66
+        $this->defaultMailHeaderColor = '#0082c9'; /* header color of mail notifications */
67 67
 
68
-		$themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php';
69
-		if (file_exists($themePath)) {
70
-			// prevent defaults.php from printing output
71
-			ob_start();
72
-			require_once $themePath;
73
-			ob_end_clean();
74
-			if (class_exists('OC_Theme')) {
75
-				$this->theme = new OC_Theme();
76
-			}
77
-		}
78
-	}
68
+        $themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php';
69
+        if (file_exists($themePath)) {
70
+            // prevent defaults.php from printing output
71
+            ob_start();
72
+            require_once $themePath;
73
+            ob_end_clean();
74
+            if (class_exists('OC_Theme')) {
75
+                $this->theme = new OC_Theme();
76
+            }
77
+        }
78
+    }
79 79
 
80
-	/**
81
-	 * @param string $method
82
-	 */
83
-	private function themeExist($method) {
84
-		if (isset($this->theme) && method_exists($this->theme, $method)) {
85
-			return true;
86
-		}
87
-		return false;
88
-	}
80
+    /**
81
+     * @param string $method
82
+     */
83
+    private function themeExist($method) {
84
+        if (isset($this->theme) && method_exists($this->theme, $method)) {
85
+            return true;
86
+        }
87
+        return false;
88
+    }
89 89
 
90
-	/**
91
-	 * Returns the base URL
92
-	 * @return string URL
93
-	 */
94
-	public function getBaseUrl() {
95
-		if ($this->themeExist('getBaseUrl')) {
96
-			return $this->theme->getBaseUrl();
97
-		} else {
98
-			return $this->defaultBaseUrl;
99
-		}
100
-	}
90
+    /**
91
+     * Returns the base URL
92
+     * @return string URL
93
+     */
94
+    public function getBaseUrl() {
95
+        if ($this->themeExist('getBaseUrl')) {
96
+            return $this->theme->getBaseUrl();
97
+        } else {
98
+            return $this->defaultBaseUrl;
99
+        }
100
+    }
101 101
 
102
-	/**
103
-	 * Returns the URL where the sync clients are listed
104
-	 * @return string URL
105
-	 */
106
-	public function getSyncClientUrl() {
107
-		if ($this->themeExist('getSyncClientUrl')) {
108
-			return $this->theme->getSyncClientUrl();
109
-		} else {
110
-			return $this->defaultSyncClientUrl;
111
-		}
112
-	}
102
+    /**
103
+     * Returns the URL where the sync clients are listed
104
+     * @return string URL
105
+     */
106
+    public function getSyncClientUrl() {
107
+        if ($this->themeExist('getSyncClientUrl')) {
108
+            return $this->theme->getSyncClientUrl();
109
+        } else {
110
+            return $this->defaultSyncClientUrl;
111
+        }
112
+    }
113 113
 
114
-	/**
115
-	 * Returns the URL to the App Store for the iOS Client
116
-	 * @return string URL
117
-	 */
118
-	public function getiOSClientUrl() {
119
-		if ($this->themeExist('getiOSClientUrl')) {
120
-			return $this->theme->getiOSClientUrl();
121
-		} else {
122
-			return $this->defaultiOSClientUrl;
123
-		}
124
-	}
114
+    /**
115
+     * Returns the URL to the App Store for the iOS Client
116
+     * @return string URL
117
+     */
118
+    public function getiOSClientUrl() {
119
+        if ($this->themeExist('getiOSClientUrl')) {
120
+            return $this->theme->getiOSClientUrl();
121
+        } else {
122
+            return $this->defaultiOSClientUrl;
123
+        }
124
+    }
125 125
 
126
-	/**
127
-	 * Returns the AppId for the App Store for the iOS Client
128
-	 * @return string AppId
129
-	 */
130
-	public function getiTunesAppId() {
131
-		if ($this->themeExist('getiTunesAppId')) {
132
-			return $this->theme->getiTunesAppId();
133
-		} else {
134
-			return $this->defaultiTunesAppId;
135
-		}
136
-	}
126
+    /**
127
+     * Returns the AppId for the App Store for the iOS Client
128
+     * @return string AppId
129
+     */
130
+    public function getiTunesAppId() {
131
+        if ($this->themeExist('getiTunesAppId')) {
132
+            return $this->theme->getiTunesAppId();
133
+        } else {
134
+            return $this->defaultiTunesAppId;
135
+        }
136
+    }
137 137
 
138
-	/**
139
-	 * Returns the URL to Google Play for the Android Client
140
-	 * @return string URL
141
-	 */
142
-	public function getAndroidClientUrl() {
143
-		if ($this->themeExist('getAndroidClientUrl')) {
144
-			return $this->theme->getAndroidClientUrl();
145
-		} else {
146
-			return $this->defaultAndroidClientUrl;
147
-		}
148
-	}
138
+    /**
139
+     * Returns the URL to Google Play for the Android Client
140
+     * @return string URL
141
+     */
142
+    public function getAndroidClientUrl() {
143
+        if ($this->themeExist('getAndroidClientUrl')) {
144
+            return $this->theme->getAndroidClientUrl();
145
+        } else {
146
+            return $this->defaultAndroidClientUrl;
147
+        }
148
+    }
149 149
 
150
-	/**
151
-	 * Returns the documentation URL
152
-	 * @return string URL
153
-	 */
154
-	public function getDocBaseUrl() {
155
-		if ($this->themeExist('getDocBaseUrl')) {
156
-			return $this->theme->getDocBaseUrl();
157
-		} else {
158
-			return $this->defaultDocBaseUrl;
159
-		}
160
-	}
150
+    /**
151
+     * Returns the documentation URL
152
+     * @return string URL
153
+     */
154
+    public function getDocBaseUrl() {
155
+        if ($this->themeExist('getDocBaseUrl')) {
156
+            return $this->theme->getDocBaseUrl();
157
+        } else {
158
+            return $this->defaultDocBaseUrl;
159
+        }
160
+    }
161 161
 
162
-	/**
163
-	 * Returns the title
164
-	 * @return string title
165
-	 */
166
-	public function getTitle() {
167
-		if ($this->themeExist('getTitle')) {
168
-			return $this->theme->getTitle();
169
-		} else {
170
-			return $this->defaultTitle;
171
-		}
172
-	}
162
+    /**
163
+     * Returns the title
164
+     * @return string title
165
+     */
166
+    public function getTitle() {
167
+        if ($this->themeExist('getTitle')) {
168
+            return $this->theme->getTitle();
169
+        } else {
170
+            return $this->defaultTitle;
171
+        }
172
+    }
173 173
 
174
-	/**
175
-	 * Returns the short name of the software
176
-	 * @return string title
177
-	 */
178
-	public function getName() {
179
-		if ($this->themeExist('getName')) {
180
-			return $this->theme->getName();
181
-		} else {
182
-			return $this->defaultName;
183
-		}
184
-	}
174
+    /**
175
+     * Returns the short name of the software
176
+     * @return string title
177
+     */
178
+    public function getName() {
179
+        if ($this->themeExist('getName')) {
180
+            return $this->theme->getName();
181
+        } else {
182
+            return $this->defaultName;
183
+        }
184
+    }
185 185
 
186
-	/**
187
-	 * Returns the short name of the software containing HTML strings
188
-	 * @return string title
189
-	 */
190
-	public function getHTMLName() {
191
-		if ($this->themeExist('getHTMLName')) {
192
-			return $this->theme->getHTMLName();
193
-		} else {
194
-			return $this->defaultName;
195
-		}
196
-	}
186
+    /**
187
+     * Returns the short name of the software containing HTML strings
188
+     * @return string title
189
+     */
190
+    public function getHTMLName() {
191
+        if ($this->themeExist('getHTMLName')) {
192
+            return $this->theme->getHTMLName();
193
+        } else {
194
+            return $this->defaultName;
195
+        }
196
+    }
197 197
 
198
-	/**
199
-	 * Returns entity (e.g. company name) - used for footer, copyright
200
-	 * @return string entity name
201
-	 */
202
-	public function getEntity() {
203
-		if ($this->themeExist('getEntity')) {
204
-			return $this->theme->getEntity();
205
-		} else {
206
-			return $this->defaultEntity;
207
-		}
208
-	}
198
+    /**
199
+     * Returns entity (e.g. company name) - used for footer, copyright
200
+     * @return string entity name
201
+     */
202
+    public function getEntity() {
203
+        if ($this->themeExist('getEntity')) {
204
+            return $this->theme->getEntity();
205
+        } else {
206
+            return $this->defaultEntity;
207
+        }
208
+    }
209 209
 
210
-	/**
211
-	 * Returns slogan
212
-	 * @return string slogan
213
-	 */
214
-	public function getSlogan() {
215
-		if ($this->themeExist('getSlogan')) {
216
-			return $this->theme->getSlogan();
217
-		} else {
218
-			return $this->defaultSlogan;
219
-		}
220
-	}
210
+    /**
211
+     * Returns slogan
212
+     * @return string slogan
213
+     */
214
+    public function getSlogan() {
215
+        if ($this->themeExist('getSlogan')) {
216
+            return $this->theme->getSlogan();
217
+        } else {
218
+            return $this->defaultSlogan;
219
+        }
220
+    }
221 221
 
222
-	/**
223
-	 * Returns logo claim
224
-	 * @return string logo claim
225
-	 */
226
-	public function getLogoClaim() {
227
-		if ($this->themeExist('getLogoClaim')) {
228
-			return $this->theme->getLogoClaim();
229
-		} else {
230
-			return $this->defaultLogoClaim;
231
-		}
232
-	}
222
+    /**
223
+     * Returns logo claim
224
+     * @return string logo claim
225
+     */
226
+    public function getLogoClaim() {
227
+        if ($this->themeExist('getLogoClaim')) {
228
+            return $this->theme->getLogoClaim();
229
+        } else {
230
+            return $this->defaultLogoClaim;
231
+        }
232
+    }
233 233
 
234
-	/**
235
-	 * Returns short version of the footer
236
-	 * @return string short footer
237
-	 */
238
-	public function getShortFooter() {
239
-		if ($this->themeExist('getShortFooter')) {
240
-			$footer = $this->theme->getShortFooter();
241
-		} else {
242
-			$footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' .
243
-				' rel="noreferrer">' .$this->getEntity() . '</a>'.
244
-				' – ' . $this->getSlogan();
245
-		}
234
+    /**
235
+     * Returns short version of the footer
236
+     * @return string short footer
237
+     */
238
+    public function getShortFooter() {
239
+        if ($this->themeExist('getShortFooter')) {
240
+            $footer = $this->theme->getShortFooter();
241
+        } else {
242
+            $footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' .
243
+                ' rel="noreferrer">' .$this->getEntity() . '</a>'.
244
+                ' – ' . $this->getSlogan();
245
+        }
246 246
 
247
-		return $footer;
248
-	}
247
+        return $footer;
248
+    }
249 249
 
250
-	/**
251
-	 * Returns long version of the footer
252
-	 * @return string long footer
253
-	 */
254
-	public function getLongFooter() {
255
-		if ($this->themeExist('getLongFooter')) {
256
-			$footer = $this->theme->getLongFooter();
257
-		} else {
258
-			$footer = $this->getShortFooter();
259
-		}
250
+    /**
251
+     * Returns long version of the footer
252
+     * @return string long footer
253
+     */
254
+    public function getLongFooter() {
255
+        if ($this->themeExist('getLongFooter')) {
256
+            $footer = $this->theme->getLongFooter();
257
+        } else {
258
+            $footer = $this->getShortFooter();
259
+        }
260 260
 
261
-		return $footer;
262
-	}
261
+        return $footer;
262
+    }
263 263
 
264
-	/**
265
-	 * @param string $key
266
-	 */
267
-	public function buildDocLinkToKey($key) {
268
-		if ($this->themeExist('buildDocLinkToKey')) {
269
-			return $this->theme->buildDocLinkToKey($key);
270
-		}
271
-		return $this->getDocBaseUrl() . '/server/' . $this->defaultDocVersion . '/go.php?to=' . $key;
272
-	}
264
+    /**
265
+     * @param string $key
266
+     */
267
+    public function buildDocLinkToKey($key) {
268
+        if ($this->themeExist('buildDocLinkToKey')) {
269
+            return $this->theme->buildDocLinkToKey($key);
270
+        }
271
+        return $this->getDocBaseUrl() . '/server/' . $this->defaultDocVersion . '/go.php?to=' . $key;
272
+    }
273 273
 
274
-	/**
275
-	 * Returns mail header color
276
-	 * @return string
277
-	 */
278
-	public function getMailHeaderColor() {
279
-		if ($this->themeExist('getMailHeaderColor')) {
280
-			return $this->theme->getMailHeaderColor();
281
-		} else {
282
-			return $this->defaultMailHeaderColor;
283
-		}
284
-	}
274
+    /**
275
+     * Returns mail header color
276
+     * @return string
277
+     */
278
+    public function getMailHeaderColor() {
279
+        if ($this->themeExist('getMailHeaderColor')) {
280
+            return $this->theme->getMailHeaderColor();
281
+        } else {
282
+            return $this->defaultMailHeaderColor;
283
+        }
284
+    }
285 285
 
286
-	/**
287
-	 * @return array scss variables to overwrite
288
-	 */
289
-	public function getScssVariables() {
290
-		if($this->themeExist('getScssVariables')) {
291
-			return $this->theme->getScssVariables();
292
-		}
293
-		return [];
294
-	}
286
+    /**
287
+     * @return array scss variables to overwrite
288
+     */
289
+    public function getScssVariables() {
290
+        if($this->themeExist('getScssVariables')) {
291
+            return $this->theme->getScssVariables();
292
+        }
293
+        return [];
294
+    }
295 295
 
296
-	public function shouldReplaceIcons() {
297
-		return false;
298
-	}
296
+    public function shouldReplaceIcons() {
297
+        return false;
298
+    }
299 299
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		$this->defaultLogoClaim = '';
66 66
 		$this->defaultMailHeaderColor = '#0082c9'; /* header color of mail notifications */
67 67
 
68
-		$themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php';
68
+		$themePath = OC::$SERVERROOT.'/themes/'.OC_Util::getTheme().'/defaults.php';
69 69
 		if (file_exists($themePath)) {
70 70
 			// prevent defaults.php from printing output
71 71
 			ob_start();
@@ -239,9 +239,9 @@  discard block
 block discarded – undo
239 239
 		if ($this->themeExist('getShortFooter')) {
240 240
 			$footer = $this->theme->getShortFooter();
241 241
 		} else {
242
-			$footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' .
243
-				' rel="noreferrer">' .$this->getEntity() . '</a>'.
244
-				' – ' . $this->getSlogan();
242
+			$footer = '<a href="'.$this->getBaseUrl().'" target="_blank"'.
243
+				' rel="noreferrer">'.$this->getEntity().'</a>'.
244
+				' – '.$this->getSlogan();
245 245
 		}
246 246
 
247 247
 		return $footer;
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 		if ($this->themeExist('buildDocLinkToKey')) {
269 269
 			return $this->theme->buildDocLinkToKey($key);
270 270
 		}
271
-		return $this->getDocBaseUrl() . '/server/' . $this->defaultDocVersion . '/go.php?to=' . $key;
271
+		return $this->getDocBaseUrl().'/server/'.$this->defaultDocVersion.'/go.php?to='.$key;
272 272
 	}
273 273
 
274 274
 	/**
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	 * @return array scss variables to overwrite
288 288
 	 */
289 289
 	public function getScssVariables() {
290
-		if($this->themeExist('getScssVariables')) {
290
+		if ($this->themeExist('getScssVariables')) {
291 291
 			return $this->theme->getScssVariables();
292 292
 		}
293 293
 		return [];
Please login to merge, or discard this patch.
lib/private/Server.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,6 @@
 block discarded – undo
95 95
 use OC\Tagging\TagMapper;
96 96
 use OC\Template\SCSSCacher;
97 97
 use OCA\Theming\ThemingDefaults;
98
-
99 98
 use OCP\App\IAppManager;
100 99
 use OCA\Theming\Util;
101 100
 use OCP\Federation\ICloudIdManager;
Please login to merge, or discard this patch.
Indentation   +1594 added lines, -1594 removed lines patch added patch discarded remove patch
@@ -119,1603 +119,1603 @@
 block discarded – undo
119 119
  * TODO: hookup all manager classes
120 120
  */
121 121
 class Server extends ServerContainer implements IServerContainer {
122
-	/** @var string */
123
-	private $webRoot;
124
-
125
-	/**
126
-	 * @param string $webRoot
127
-	 * @param \OC\Config $config
128
-	 */
129
-	public function __construct($webRoot, \OC\Config $config) {
130
-		parent::__construct();
131
-		$this->webRoot = $webRoot;
132
-
133
-		$this->registerAlias(\OCP\Contacts\IManager::class, \OC\ContactsManager::class);
134
-		$this->registerAlias('ContactsManager', \OCP\Contacts\IManager::class);
135
-
136
-		$this->registerService(\OCP\IPreview::class, function (Server $c) {
137
-			return new PreviewManager(
138
-				$c->getConfig(),
139
-				$c->getRootFolder(),
140
-				$c->getAppDataDir('preview'),
141
-				$c->getEventDispatcher(),
142
-				$c->getSession()->get('user_id')
143
-			);
144
-		});
145
-		$this->registerAlias('PreviewManager', \OCP\IPreview::class);
146
-
147
-		$this->registerService(\OC\Preview\Watcher::class, function (Server $c) {
148
-			return new \OC\Preview\Watcher(
149
-				$c->getAppDataDir('preview')
150
-			);
151
-		});
152
-
153
-		$this->registerService('EncryptionManager', function (Server $c) {
154
-			$view = new View();
155
-			$util = new Encryption\Util(
156
-				$view,
157
-				$c->getUserManager(),
158
-				$c->getGroupManager(),
159
-				$c->getConfig()
160
-			);
161
-			return new Encryption\Manager(
162
-				$c->getConfig(),
163
-				$c->getLogger(),
164
-				$c->getL10N('core'),
165
-				new View(),
166
-				$util,
167
-				new ArrayCache()
168
-			);
169
-		});
170
-
171
-		$this->registerService('EncryptionFileHelper', function (Server $c) {
172
-			$util = new Encryption\Util(
173
-				new View(),
174
-				$c->getUserManager(),
175
-				$c->getGroupManager(),
176
-				$c->getConfig()
177
-			);
178
-			return new Encryption\File($util);
179
-		});
180
-
181
-		$this->registerService('EncryptionKeyStorage', function (Server $c) {
182
-			$view = new View();
183
-			$util = new Encryption\Util(
184
-				$view,
185
-				$c->getUserManager(),
186
-				$c->getGroupManager(),
187
-				$c->getConfig()
188
-			);
189
-
190
-			return new Encryption\Keys\Storage($view, $util);
191
-		});
192
-		$this->registerService('TagMapper', function (Server $c) {
193
-			return new TagMapper($c->getDatabaseConnection());
194
-		});
195
-
196
-		$this->registerService(\OCP\ITagManager::class, function (Server $c) {
197
-			$tagMapper = $c->query('TagMapper');
198
-			return new TagManager($tagMapper, $c->getUserSession());
199
-		});
200
-		$this->registerAlias('TagManager', \OCP\ITagManager::class);
201
-
202
-		$this->registerService('SystemTagManagerFactory', function (Server $c) {
203
-			$config = $c->getConfig();
204
-			$factoryClass = $config->getSystemValue('systemtags.managerFactory', '\OC\SystemTag\ManagerFactory');
205
-			/** @var \OC\SystemTag\ManagerFactory $factory */
206
-			$factory = new $factoryClass($this);
207
-			return $factory;
208
-		});
209
-		$this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) {
210
-			return $c->query('SystemTagManagerFactory')->getManager();
211
-		});
212
-		$this->registerAlias('SystemTagManager', \OCP\SystemTag\ISystemTagManager::class);
213
-
214
-		$this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function (Server $c) {
215
-			return $c->query('SystemTagManagerFactory')->getObjectMapper();
216
-		});
217
-		$this->registerService('RootFolder', function (Server $c) {
218
-			$manager = \OC\Files\Filesystem::getMountManager(null);
219
-			$view = new View();
220
-			$root = new Root(
221
-				$manager,
222
-				$view,
223
-				null,
224
-				$c->getUserMountCache(),
225
-				$this->getLogger(),
226
-				$this->getUserManager()
227
-			);
228
-			$connector = new HookConnector($root, $view);
229
-			$connector->viewToNode();
230
-
231
-			$previewConnector = new \OC\Preview\WatcherConnector($root, $c->getSystemConfig());
232
-			$previewConnector->connectWatcher();
233
-
234
-			return $root;
235
-		});
236
-		$this->registerAlias('SystemTagObjectMapper', \OCP\SystemTag\ISystemTagObjectMapper::class);
237
-
238
-		$this->registerService(\OCP\Files\IRootFolder::class, function(Server $c) {
239
-			return new LazyRoot(function() use ($c) {
240
-				return $c->query('RootFolder');
241
-			});
242
-		});
243
-		$this->registerAlias('LazyRootFolder', \OCP\Files\IRootFolder::class);
244
-
245
-		$this->registerService(\OCP\IUserManager::class, function (Server $c) {
246
-			$config = $c->getConfig();
247
-			return new \OC\User\Manager($config);
248
-		});
249
-		$this->registerAlias('UserManager', \OCP\IUserManager::class);
250
-
251
-		$this->registerService(\OCP\IGroupManager::class, function (Server $c) {
252
-			$groupManager = new \OC\Group\Manager($this->getUserManager(), $this->getLogger());
253
-			$groupManager->listen('\OC\Group', 'preCreate', function ($gid) {
254
-				\OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid));
255
-			});
256
-			$groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) {
257
-				\OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID()));
258
-			});
259
-			$groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) {
260
-				\OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID()));
261
-			});
262
-			$groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) {
263
-				\OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID()));
264
-			});
265
-			$groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
266
-				\OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID()));
267
-			});
268
-			$groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
269
-				\OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
270
-				//Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks
271
-				\OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
272
-			});
273
-			return $groupManager;
274
-		});
275
-		$this->registerAlias('GroupManager', \OCP\IGroupManager::class);
276
-
277
-		$this->registerService(Store::class, function(Server $c) {
278
-			$session = $c->getSession();
279
-			if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
280
-				$tokenProvider = $c->query('OC\Authentication\Token\IProvider');
281
-			} else {
282
-				$tokenProvider = null;
283
-			}
284
-			$logger = $c->getLogger();
285
-			return new Store($session, $logger, $tokenProvider);
286
-		});
287
-		$this->registerAlias(IStore::class, Store::class);
288
-		$this->registerService('OC\Authentication\Token\DefaultTokenMapper', function (Server $c) {
289
-			$dbConnection = $c->getDatabaseConnection();
290
-			return new Authentication\Token\DefaultTokenMapper($dbConnection);
291
-		});
292
-		$this->registerService('OC\Authentication\Token\DefaultTokenProvider', function (Server $c) {
293
-			$mapper = $c->query('OC\Authentication\Token\DefaultTokenMapper');
294
-			$crypto = $c->getCrypto();
295
-			$config = $c->getConfig();
296
-			$logger = $c->getLogger();
297
-			$timeFactory = new TimeFactory();
298
-			return new \OC\Authentication\Token\DefaultTokenProvider($mapper, $crypto, $config, $logger, $timeFactory);
299
-		});
300
-		$this->registerAlias('OC\Authentication\Token\IProvider', 'OC\Authentication\Token\DefaultTokenProvider');
301
-
302
-		$this->registerService(\OCP\IUserSession::class, function (Server $c) {
303
-			$manager = $c->getUserManager();
304
-			$session = new \OC\Session\Memory('');
305
-			$timeFactory = new TimeFactory();
306
-			// Token providers might require a working database. This code
307
-			// might however be called when ownCloud is not yet setup.
308
-			if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
309
-				$defaultTokenProvider = $c->query('OC\Authentication\Token\IProvider');
310
-			} else {
311
-				$defaultTokenProvider = null;
312
-			}
313
-
314
-			$userSession = new \OC\User\Session($manager, $session, $timeFactory, $defaultTokenProvider, $c->getConfig(), $c->getSecureRandom());
315
-			$userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) {
316
-				\OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password));
317
-			});
318
-			$userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) {
319
-				/** @var $user \OC\User\User */
320
-				\OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password));
321
-			});
322
-			$userSession->listen('\OC\User', 'preDelete', function ($user) {
323
-				/** @var $user \OC\User\User */
324
-				\OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID()));
325
-			});
326
-			$userSession->listen('\OC\User', 'postDelete', function ($user) {
327
-				/** @var $user \OC\User\User */
328
-				\OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID()));
329
-			});
330
-			$userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) {
331
-				/** @var $user \OC\User\User */
332
-				\OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
333
-			});
334
-			$userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) {
335
-				/** @var $user \OC\User\User */
336
-				\OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
337
-			});
338
-			$userSession->listen('\OC\User', 'preLogin', function ($uid, $password) {
339
-				\OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password));
340
-			});
341
-			$userSession->listen('\OC\User', 'postLogin', function ($user, $password) {
342
-				/** @var $user \OC\User\User */
343
-				\OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password));
344
-			});
345
-			$userSession->listen('\OC\User', 'logout', function () {
346
-				\OC_Hook::emit('OC_User', 'logout', array());
347
-			});
348
-			$userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value) {
349
-				/** @var $user \OC\User\User */
350
-				\OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value));
351
-			});
352
-			return $userSession;
353
-		});
354
-		$this->registerAlias('UserSession', \OCP\IUserSession::class);
355
-
356
-		$this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function (Server $c) {
357
-			return new \OC\Authentication\TwoFactorAuth\Manager($c->getAppManager(), $c->getSession(), $c->getConfig(), $c->getActivityManager(), $c->getLogger());
358
-		});
359
-
360
-		$this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class);
361
-		$this->registerAlias('NavigationManager', \OCP\INavigationManager::class);
362
-
363
-		$this->registerService(\OC\AllConfig::class, function (Server $c) {
364
-			return new \OC\AllConfig(
365
-				$c->getSystemConfig()
366
-			);
367
-		});
368
-		$this->registerAlias('AllConfig', \OC\AllConfig::class);
369
-		$this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class);
370
-
371
-		$this->registerService('SystemConfig', function ($c) use ($config) {
372
-			return new \OC\SystemConfig($config);
373
-		});
374
-
375
-		$this->registerService(\OC\AppConfig::class, function (Server $c) {
376
-			return new \OC\AppConfig($c->getDatabaseConnection());
377
-		});
378
-		$this->registerAlias('AppConfig', \OC\AppConfig::class);
379
-		$this->registerAlias(\OCP\IAppConfig::class, \OC\AppConfig::class);
380
-
381
-		$this->registerService(\OCP\L10N\IFactory::class, function (Server $c) {
382
-			return new \OC\L10N\Factory(
383
-				$c->getConfig(),
384
-				$c->getRequest(),
385
-				$c->getUserSession(),
386
-				\OC::$SERVERROOT
387
-			);
388
-		});
389
-		$this->registerAlias('L10NFactory', \OCP\L10N\IFactory::class);
390
-
391
-		$this->registerService(\OCP\IURLGenerator::class, function (Server $c) {
392
-			$config = $c->getConfig();
393
-			$cacheFactory = $c->getMemCacheFactory();
394
-			return new \OC\URLGenerator(
395
-				$config,
396
-				$cacheFactory
397
-			);
398
-		});
399
-		$this->registerAlias('URLGenerator', \OCP\IURLGenerator::class);
400
-
401
-		$this->registerService('AppHelper', function ($c) {
402
-			return new \OC\AppHelper();
403
-		});
404
-		$this->registerService('AppFetcher', function ($c) {
405
-			return new AppFetcher(
406
-				$this->getAppDataDir('appstore'),
407
-				$this->getHTTPClientService(),
408
-				$this->query(TimeFactory::class),
409
-				$this->getConfig()
410
-			);
411
-		});
412
-		$this->registerService('CategoryFetcher', function ($c) {
413
-			return new CategoryFetcher(
414
-				$this->getAppDataDir('appstore'),
415
-				$this->getHTTPClientService(),
416
-				$this->query(TimeFactory::class),
417
-				$this->getConfig()
418
-			);
419
-		});
420
-
421
-		$this->registerService(\OCP\ICache::class, function ($c) {
422
-			return new Cache\File();
423
-		});
424
-		$this->registerAlias('UserCache', \OCP\ICache::class);
425
-
426
-		$this->registerService(Factory::class, function (Server $c) {
427
-			$config = $c->getConfig();
428
-
429
-			if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
430
-				$v = \OC_App::getAppVersions();
431
-				$v['core'] = md5(file_get_contents(\OC::$SERVERROOT . '/version.php'));
432
-				$version = implode(',', $v);
433
-				$instanceId = \OC_Util::getInstanceId();
434
-				$path = \OC::$SERVERROOT;
435
-				$prefix = md5($instanceId . '-' . $version . '-' . $path . '-' . \OC::$WEBROOT);
436
-				return new \OC\Memcache\Factory($prefix, $c->getLogger(),
437
-					$config->getSystemValue('memcache.local', null),
438
-					$config->getSystemValue('memcache.distributed', null),
439
-					$config->getSystemValue('memcache.locking', null)
440
-				);
441
-			}
442
-
443
-			return new \OC\Memcache\Factory('', $c->getLogger(),
444
-				'\\OC\\Memcache\\ArrayCache',
445
-				'\\OC\\Memcache\\ArrayCache',
446
-				'\\OC\\Memcache\\ArrayCache'
447
-			);
448
-		});
449
-		$this->registerAlias('MemCacheFactory', Factory::class);
450
-		$this->registerAlias(ICacheFactory::class, Factory::class);
451
-
452
-		$this->registerService('RedisFactory', function (Server $c) {
453
-			$systemConfig = $c->getSystemConfig();
454
-			return new RedisFactory($systemConfig);
455
-		});
456
-
457
-		$this->registerService(\OCP\Activity\IManager::class, function (Server $c) {
458
-			return new \OC\Activity\Manager(
459
-				$c->getRequest(),
460
-				$c->getUserSession(),
461
-				$c->getConfig(),
462
-				$c->query(IValidator::class)
463
-			);
464
-		});
465
-		$this->registerAlias('ActivityManager', \OCP\Activity\IManager::class);
466
-
467
-		$this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) {
468
-			return new \OC\Activity\EventMerger(
469
-				$c->getL10N('lib')
470
-			);
471
-		});
472
-		$this->registerAlias(IValidator::class, Validator::class);
473
-
474
-		$this->registerService(\OCP\IAvatarManager::class, function (Server $c) {
475
-			return new AvatarManager(
476
-				$c->getUserManager(),
477
-				$c->getAppDataDir('avatar'),
478
-				$c->getL10N('lib'),
479
-				$c->getLogger(),
480
-				$c->getConfig()
481
-			);
482
-		});
483
-		$this->registerAlias('AvatarManager', \OCP\IAvatarManager::class);
484
-
485
-		$this->registerService(\OCP\ILogger::class, function (Server $c) {
486
-			$logType = $c->query('AllConfig')->getSystemValue('log_type', 'file');
487
-			$logger = Log::getLogClass($logType);
488
-			call_user_func(array($logger, 'init'));
489
-
490
-			return new Log($logger);
491
-		});
492
-		$this->registerAlias('Logger', \OCP\ILogger::class);
493
-
494
-		$this->registerService(\OCP\BackgroundJob\IJobList::class, function (Server $c) {
495
-			$config = $c->getConfig();
496
-			return new \OC\BackgroundJob\JobList(
497
-				$c->getDatabaseConnection(),
498
-				$config,
499
-				new TimeFactory()
500
-			);
501
-		});
502
-		$this->registerAlias('JobList', \OCP\BackgroundJob\IJobList::class);
503
-
504
-		$this->registerService(\OCP\Route\IRouter::class, function (Server $c) {
505
-			$cacheFactory = $c->getMemCacheFactory();
506
-			$logger = $c->getLogger();
507
-			if ($cacheFactory->isAvailable()) {
508
-				$router = new \OC\Route\CachingRouter($cacheFactory->create('route'), $logger);
509
-			} else {
510
-				$router = new \OC\Route\Router($logger);
511
-			}
512
-			return $router;
513
-		});
514
-		$this->registerAlias('Router', \OCP\Route\IRouter::class);
515
-
516
-		$this->registerService(\OCP\ISearch::class, function ($c) {
517
-			return new Search();
518
-		});
519
-		$this->registerAlias('Search', \OCP\ISearch::class);
520
-
521
-		$this->registerService(\OCP\Security\ISecureRandom::class, function ($c) {
522
-			return new SecureRandom();
523
-		});
524
-		$this->registerAlias('SecureRandom', \OCP\Security\ISecureRandom::class);
525
-
526
-		$this->registerService(\OCP\Security\ICrypto::class, function (Server $c) {
527
-			return new Crypto($c->getConfig(), $c->getSecureRandom());
528
-		});
529
-		$this->registerAlias('Crypto', \OCP\Security\ICrypto::class);
530
-
531
-		$this->registerService(\OCP\Security\IHasher::class, function (Server $c) {
532
-			return new Hasher($c->getConfig());
533
-		});
534
-		$this->registerAlias('Hasher', \OCP\Security\IHasher::class);
535
-
536
-		$this->registerService(\OCP\Security\ICredentialsManager::class, function (Server $c) {
537
-			return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection());
538
-		});
539
-		$this->registerAlias('CredentialsManager', \OCP\Security\ICredentialsManager::class);
540
-
541
-		$this->registerService(IDBConnection::class, function (Server $c) {
542
-			$systemConfig = $c->getSystemConfig();
543
-			$factory = new \OC\DB\ConnectionFactory($systemConfig);
544
-			$type = $systemConfig->getValue('dbtype', 'sqlite');
545
-			if (!$factory->isValidType($type)) {
546
-				throw new \OC\DatabaseException('Invalid database type');
547
-			}
548
-			$connectionParams = $factory->createConnectionParams();
549
-			$connection = $factory->getConnection($type, $connectionParams);
550
-			$connection->getConfiguration()->setSQLLogger($c->getQueryLogger());
551
-			return $connection;
552
-		});
553
-		$this->registerAlias('DatabaseConnection', IDBConnection::class);
554
-
555
-		$this->registerService('HTTPHelper', function (Server $c) {
556
-			$config = $c->getConfig();
557
-			return new HTTPHelper(
558
-				$config,
559
-				$c->getHTTPClientService()
560
-			);
561
-		});
562
-
563
-		$this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) {
564
-			$user = \OC_User::getUser();
565
-			$uid = $user ? $user : null;
566
-			return new ClientService(
567
-				$c->getConfig(),
568
-				new \OC\Security\CertificateManager($uid, new View(), $c->getConfig(), $c->getLogger())
569
-			);
570
-		});
571
-		$this->registerAlias('HttpClientService', \OCP\Http\Client\IClientService::class);
572
-
573
-		$this->registerService(\OCP\Diagnostics\IEventLogger::class, function (Server $c) {
574
-			if ($c->getSystemConfig()->getValue('debug', false)) {
575
-				return new EventLogger();
576
-			} else {
577
-				return new NullEventLogger();
578
-			}
579
-		});
580
-		$this->registerAlias('EventLogger', \OCP\Diagnostics\IEventLogger::class);
581
-
582
-		$this->registerService(\OCP\Diagnostics\IQueryLogger::class, function (Server $c) {
583
-			if ($c->getSystemConfig()->getValue('debug', false)) {
584
-				return new QueryLogger();
585
-			} else {
586
-				return new NullQueryLogger();
587
-			}
588
-		});
589
-		$this->registerAlias('QueryLogger', \OCP\Diagnostics\IQueryLogger::class);
590
-
591
-		$this->registerService(TempManager::class, function (Server $c) {
592
-			return new TempManager(
593
-				$c->getLogger(),
594
-				$c->getConfig()
595
-			);
596
-		});
597
-		$this->registerAlias('TempManager', TempManager::class);
598
-		$this->registerAlias(ITempManager::class, TempManager::class);
599
-
600
-		$this->registerService(AppManager::class, function (Server $c) {
601
-			return new \OC\App\AppManager(
602
-				$c->getUserSession(),
603
-				$c->getAppConfig(),
604
-				$c->getGroupManager(),
605
-				$c->getMemCacheFactory(),
606
-				$c->getEventDispatcher()
607
-			);
608
-		});
609
-		$this->registerAlias('AppManager', AppManager::class);
610
-		$this->registerAlias(IAppManager::class, AppManager::class);
611
-
612
-		$this->registerService(\OCP\IDateTimeZone::class, function (Server $c) {
613
-			return new DateTimeZone(
614
-				$c->getConfig(),
615
-				$c->getSession()
616
-			);
617
-		});
618
-		$this->registerAlias('DateTimeZone', \OCP\IDateTimeZone::class);
619
-
620
-		$this->registerService(\OCP\IDateTimeFormatter::class, function (Server $c) {
621
-			$language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null);
622
-
623
-			return new DateTimeFormatter(
624
-				$c->getDateTimeZone()->getTimeZone(),
625
-				$c->getL10N('lib', $language)
626
-			);
627
-		});
628
-		$this->registerAlias('DateTimeFormatter', \OCP\IDateTimeFormatter::class);
629
-
630
-		$this->registerService(\OCP\Files\Config\IUserMountCache::class, function (Server $c) {
631
-			$mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger());
632
-			$listener = new UserMountCacheListener($mountCache);
633
-			$listener->listen($c->getUserManager());
634
-			return $mountCache;
635
-		});
636
-		$this->registerAlias('UserMountCache', \OCP\Files\Config\IUserMountCache::class);
637
-
638
-		$this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function (Server $c) {
639
-			$loader = \OC\Files\Filesystem::getLoader();
640
-			$mountCache = $c->query('UserMountCache');
641
-			$manager =  new \OC\Files\Config\MountProviderCollection($loader, $mountCache);
642
-
643
-			// builtin providers
644
-
645
-			$config = $c->getConfig();
646
-			$manager->registerProvider(new CacheMountProvider($config));
647
-			$manager->registerHomeProvider(new LocalHomeMountProvider());
648
-			$manager->registerHomeProvider(new ObjectHomeMountProvider($config));
649
-
650
-			return $manager;
651
-		});
652
-		$this->registerAlias('MountConfigManager', \OCP\Files\Config\IMountProviderCollection::class);
653
-
654
-		$this->registerService('IniWrapper', function ($c) {
655
-			return new IniGetWrapper();
656
-		});
657
-		$this->registerService('AsyncCommandBus', function (Server $c) {
658
-			$jobList = $c->getJobList();
659
-			return new AsyncBus($jobList);
660
-		});
661
-		$this->registerService('TrustedDomainHelper', function ($c) {
662
-			return new TrustedDomainHelper($this->getConfig());
663
-		});
664
-		$this->registerService('Throttler', function(Server $c) {
665
-			return new Throttler(
666
-				$c->getDatabaseConnection(),
667
-				new TimeFactory(),
668
-				$c->getLogger(),
669
-				$c->getConfig()
670
-			);
671
-		});
672
-		$this->registerService('IntegrityCodeChecker', function (Server $c) {
673
-			// IConfig and IAppManager requires a working database. This code
674
-			// might however be called when ownCloud is not yet setup.
675
-			if(\OC::$server->getSystemConfig()->getValue('installed', false)) {
676
-				$config = $c->getConfig();
677
-				$appManager = $c->getAppManager();
678
-			} else {
679
-				$config = null;
680
-				$appManager = null;
681
-			}
682
-
683
-			return new Checker(
684
-					new EnvironmentHelper(),
685
-					new FileAccessHelper(),
686
-					new AppLocator(),
687
-					$config,
688
-					$c->getMemCacheFactory(),
689
-					$appManager,
690
-					$c->getTempManager()
691
-			);
692
-		});
693
-		$this->registerService(\OCP\IRequest::class, function ($c) {
694
-			if (isset($this['urlParams'])) {
695
-				$urlParams = $this['urlParams'];
696
-			} else {
697
-				$urlParams = [];
698
-			}
699
-
700
-			if (defined('PHPUNIT_RUN') && PHPUNIT_RUN
701
-				&& in_array('fakeinput', stream_get_wrappers())
702
-			) {
703
-				$stream = 'fakeinput://data';
704
-			} else {
705
-				$stream = 'php://input';
706
-			}
707
-
708
-			return new Request(
709
-				[
710
-					'get' => $_GET,
711
-					'post' => $_POST,
712
-					'files' => $_FILES,
713
-					'server' => $_SERVER,
714
-					'env' => $_ENV,
715
-					'cookies' => $_COOKIE,
716
-					'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD']))
717
-						? $_SERVER['REQUEST_METHOD']
718
-						: null,
719
-					'urlParams' => $urlParams,
720
-				],
721
-				$this->getSecureRandom(),
722
-				$this->getConfig(),
723
-				$this->getCsrfTokenManager(),
724
-				$stream
725
-			);
726
-		});
727
-		$this->registerAlias('Request', \OCP\IRequest::class);
728
-
729
-		$this->registerService(\OCP\Mail\IMailer::class, function (Server $c) {
730
-			return new Mailer(
731
-				$c->getConfig(),
732
-				$c->getLogger(),
733
-				$c->getThemingDefaults()
734
-			);
735
-		});
736
-		$this->registerAlias('Mailer', \OCP\Mail\IMailer::class);
737
-
738
-		$this->registerService('LDAPProvider', function(Server $c) {
739
-			$config = $c->getConfig();
740
-			$factoryClass = $config->getSystemValue('ldapProviderFactory', null);
741
-			if(is_null($factoryClass)) {
742
-				throw new \Exception('ldapProviderFactory not set');
743
-			}
744
-			/** @var \OCP\LDAP\ILDAPProviderFactory $factory */
745
-			$factory = new $factoryClass($this);
746
-			return $factory->getLDAPProvider();
747
-		});
748
-		$this->registerService('LockingProvider', function (Server $c) {
749
-			$ini = $c->getIniWrapper();
750
-			$config = $c->getConfig();
751
-			$ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time')));
752
-			if ($config->getSystemValue('filelocking.enabled', true) or (defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
753
-				/** @var \OC\Memcache\Factory $memcacheFactory */
754
-				$memcacheFactory = $c->getMemCacheFactory();
755
-				$memcache = $memcacheFactory->createLocking('lock');
756
-				if (!($memcache instanceof \OC\Memcache\NullCache)) {
757
-					return new MemcacheLockingProvider($memcache, $ttl);
758
-				}
759
-				return new DBLockingProvider($c->getDatabaseConnection(), $c->getLogger(), new TimeFactory(), $ttl);
760
-			}
761
-			return new NoopLockingProvider();
762
-		});
763
-
764
-		$this->registerService(\OCP\Files\Mount\IMountManager::class, function () {
765
-			return new \OC\Files\Mount\Manager();
766
-		});
767
-		$this->registerAlias('MountManager', \OCP\Files\Mount\IMountManager::class);
768
-
769
-		$this->registerService(\OCP\Files\IMimeTypeDetector::class, function (Server $c) {
770
-			return new \OC\Files\Type\Detection(
771
-				$c->getURLGenerator(),
772
-				\OC::$configDir,
773
-				\OC::$SERVERROOT . '/resources/config/'
774
-			);
775
-		});
776
-		$this->registerAlias('MimeTypeDetector', \OCP\Files\IMimeTypeDetector::class);
777
-
778
-		$this->registerService(\OCP\Files\IMimeTypeLoader::class, function (Server $c) {
779
-			return new \OC\Files\Type\Loader(
780
-				$c->getDatabaseConnection()
781
-			);
782
-		});
783
-		$this->registerAlias('MimeTypeLoader', \OCP\Files\IMimeTypeLoader::class);
784
-
785
-		$this->registerService(\OCP\Notification\IManager::class, function (Server $c) {
786
-			return new Manager(
787
-				$c->query(IValidator::class)
788
-			);
789
-		});
790
-		$this->registerAlias('NotificationManager', \OCP\Notification\IManager::class);
791
-
792
-		$this->registerService(\OC\CapabilitiesManager::class, function (Server $c) {
793
-			$manager = new \OC\CapabilitiesManager($c->getLogger());
794
-			$manager->registerCapability(function () use ($c) {
795
-				return new \OC\OCS\CoreCapabilities($c->getConfig());
796
-			});
797
-			return $manager;
798
-		});
799
-		$this->registerAlias('CapabilitiesManager', \OC\CapabilitiesManager::class);
800
-
801
-		$this->registerService(\OCP\Comments\ICommentsManager::class, function(Server $c) {
802
-			$config = $c->getConfig();
803
-			$factoryClass = $config->getSystemValue('comments.managerFactory', '\OC\Comments\ManagerFactory');
804
-			/** @var \OCP\Comments\ICommentsManagerFactory $factory */
805
-			$factory = new $factoryClass($this);
806
-			return $factory->getManager();
807
-		});
808
-		$this->registerAlias('CommentsManager', \OCP\Comments\ICommentsManager::class);
809
-
810
-		$this->registerService('ThemingDefaults', function(Server $c) {
811
-			/*
122
+    /** @var string */
123
+    private $webRoot;
124
+
125
+    /**
126
+     * @param string $webRoot
127
+     * @param \OC\Config $config
128
+     */
129
+    public function __construct($webRoot, \OC\Config $config) {
130
+        parent::__construct();
131
+        $this->webRoot = $webRoot;
132
+
133
+        $this->registerAlias(\OCP\Contacts\IManager::class, \OC\ContactsManager::class);
134
+        $this->registerAlias('ContactsManager', \OCP\Contacts\IManager::class);
135
+
136
+        $this->registerService(\OCP\IPreview::class, function (Server $c) {
137
+            return new PreviewManager(
138
+                $c->getConfig(),
139
+                $c->getRootFolder(),
140
+                $c->getAppDataDir('preview'),
141
+                $c->getEventDispatcher(),
142
+                $c->getSession()->get('user_id')
143
+            );
144
+        });
145
+        $this->registerAlias('PreviewManager', \OCP\IPreview::class);
146
+
147
+        $this->registerService(\OC\Preview\Watcher::class, function (Server $c) {
148
+            return new \OC\Preview\Watcher(
149
+                $c->getAppDataDir('preview')
150
+            );
151
+        });
152
+
153
+        $this->registerService('EncryptionManager', function (Server $c) {
154
+            $view = new View();
155
+            $util = new Encryption\Util(
156
+                $view,
157
+                $c->getUserManager(),
158
+                $c->getGroupManager(),
159
+                $c->getConfig()
160
+            );
161
+            return new Encryption\Manager(
162
+                $c->getConfig(),
163
+                $c->getLogger(),
164
+                $c->getL10N('core'),
165
+                new View(),
166
+                $util,
167
+                new ArrayCache()
168
+            );
169
+        });
170
+
171
+        $this->registerService('EncryptionFileHelper', function (Server $c) {
172
+            $util = new Encryption\Util(
173
+                new View(),
174
+                $c->getUserManager(),
175
+                $c->getGroupManager(),
176
+                $c->getConfig()
177
+            );
178
+            return new Encryption\File($util);
179
+        });
180
+
181
+        $this->registerService('EncryptionKeyStorage', function (Server $c) {
182
+            $view = new View();
183
+            $util = new Encryption\Util(
184
+                $view,
185
+                $c->getUserManager(),
186
+                $c->getGroupManager(),
187
+                $c->getConfig()
188
+            );
189
+
190
+            return new Encryption\Keys\Storage($view, $util);
191
+        });
192
+        $this->registerService('TagMapper', function (Server $c) {
193
+            return new TagMapper($c->getDatabaseConnection());
194
+        });
195
+
196
+        $this->registerService(\OCP\ITagManager::class, function (Server $c) {
197
+            $tagMapper = $c->query('TagMapper');
198
+            return new TagManager($tagMapper, $c->getUserSession());
199
+        });
200
+        $this->registerAlias('TagManager', \OCP\ITagManager::class);
201
+
202
+        $this->registerService('SystemTagManagerFactory', function (Server $c) {
203
+            $config = $c->getConfig();
204
+            $factoryClass = $config->getSystemValue('systemtags.managerFactory', '\OC\SystemTag\ManagerFactory');
205
+            /** @var \OC\SystemTag\ManagerFactory $factory */
206
+            $factory = new $factoryClass($this);
207
+            return $factory;
208
+        });
209
+        $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) {
210
+            return $c->query('SystemTagManagerFactory')->getManager();
211
+        });
212
+        $this->registerAlias('SystemTagManager', \OCP\SystemTag\ISystemTagManager::class);
213
+
214
+        $this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function (Server $c) {
215
+            return $c->query('SystemTagManagerFactory')->getObjectMapper();
216
+        });
217
+        $this->registerService('RootFolder', function (Server $c) {
218
+            $manager = \OC\Files\Filesystem::getMountManager(null);
219
+            $view = new View();
220
+            $root = new Root(
221
+                $manager,
222
+                $view,
223
+                null,
224
+                $c->getUserMountCache(),
225
+                $this->getLogger(),
226
+                $this->getUserManager()
227
+            );
228
+            $connector = new HookConnector($root, $view);
229
+            $connector->viewToNode();
230
+
231
+            $previewConnector = new \OC\Preview\WatcherConnector($root, $c->getSystemConfig());
232
+            $previewConnector->connectWatcher();
233
+
234
+            return $root;
235
+        });
236
+        $this->registerAlias('SystemTagObjectMapper', \OCP\SystemTag\ISystemTagObjectMapper::class);
237
+
238
+        $this->registerService(\OCP\Files\IRootFolder::class, function(Server $c) {
239
+            return new LazyRoot(function() use ($c) {
240
+                return $c->query('RootFolder');
241
+            });
242
+        });
243
+        $this->registerAlias('LazyRootFolder', \OCP\Files\IRootFolder::class);
244
+
245
+        $this->registerService(\OCP\IUserManager::class, function (Server $c) {
246
+            $config = $c->getConfig();
247
+            return new \OC\User\Manager($config);
248
+        });
249
+        $this->registerAlias('UserManager', \OCP\IUserManager::class);
250
+
251
+        $this->registerService(\OCP\IGroupManager::class, function (Server $c) {
252
+            $groupManager = new \OC\Group\Manager($this->getUserManager(), $this->getLogger());
253
+            $groupManager->listen('\OC\Group', 'preCreate', function ($gid) {
254
+                \OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid));
255
+            });
256
+            $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) {
257
+                \OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID()));
258
+            });
259
+            $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) {
260
+                \OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID()));
261
+            });
262
+            $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) {
263
+                \OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID()));
264
+            });
265
+            $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
266
+                \OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID()));
267
+            });
268
+            $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
269
+                \OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
270
+                //Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks
271
+                \OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
272
+            });
273
+            return $groupManager;
274
+        });
275
+        $this->registerAlias('GroupManager', \OCP\IGroupManager::class);
276
+
277
+        $this->registerService(Store::class, function(Server $c) {
278
+            $session = $c->getSession();
279
+            if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
280
+                $tokenProvider = $c->query('OC\Authentication\Token\IProvider');
281
+            } else {
282
+                $tokenProvider = null;
283
+            }
284
+            $logger = $c->getLogger();
285
+            return new Store($session, $logger, $tokenProvider);
286
+        });
287
+        $this->registerAlias(IStore::class, Store::class);
288
+        $this->registerService('OC\Authentication\Token\DefaultTokenMapper', function (Server $c) {
289
+            $dbConnection = $c->getDatabaseConnection();
290
+            return new Authentication\Token\DefaultTokenMapper($dbConnection);
291
+        });
292
+        $this->registerService('OC\Authentication\Token\DefaultTokenProvider', function (Server $c) {
293
+            $mapper = $c->query('OC\Authentication\Token\DefaultTokenMapper');
294
+            $crypto = $c->getCrypto();
295
+            $config = $c->getConfig();
296
+            $logger = $c->getLogger();
297
+            $timeFactory = new TimeFactory();
298
+            return new \OC\Authentication\Token\DefaultTokenProvider($mapper, $crypto, $config, $logger, $timeFactory);
299
+        });
300
+        $this->registerAlias('OC\Authentication\Token\IProvider', 'OC\Authentication\Token\DefaultTokenProvider');
301
+
302
+        $this->registerService(\OCP\IUserSession::class, function (Server $c) {
303
+            $manager = $c->getUserManager();
304
+            $session = new \OC\Session\Memory('');
305
+            $timeFactory = new TimeFactory();
306
+            // Token providers might require a working database. This code
307
+            // might however be called when ownCloud is not yet setup.
308
+            if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
309
+                $defaultTokenProvider = $c->query('OC\Authentication\Token\IProvider');
310
+            } else {
311
+                $defaultTokenProvider = null;
312
+            }
313
+
314
+            $userSession = new \OC\User\Session($manager, $session, $timeFactory, $defaultTokenProvider, $c->getConfig(), $c->getSecureRandom());
315
+            $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) {
316
+                \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password));
317
+            });
318
+            $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) {
319
+                /** @var $user \OC\User\User */
320
+                \OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password));
321
+            });
322
+            $userSession->listen('\OC\User', 'preDelete', function ($user) {
323
+                /** @var $user \OC\User\User */
324
+                \OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID()));
325
+            });
326
+            $userSession->listen('\OC\User', 'postDelete', function ($user) {
327
+                /** @var $user \OC\User\User */
328
+                \OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID()));
329
+            });
330
+            $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) {
331
+                /** @var $user \OC\User\User */
332
+                \OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
333
+            });
334
+            $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) {
335
+                /** @var $user \OC\User\User */
336
+                \OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
337
+            });
338
+            $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) {
339
+                \OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password));
340
+            });
341
+            $userSession->listen('\OC\User', 'postLogin', function ($user, $password) {
342
+                /** @var $user \OC\User\User */
343
+                \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password));
344
+            });
345
+            $userSession->listen('\OC\User', 'logout', function () {
346
+                \OC_Hook::emit('OC_User', 'logout', array());
347
+            });
348
+            $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value) {
349
+                /** @var $user \OC\User\User */
350
+                \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value));
351
+            });
352
+            return $userSession;
353
+        });
354
+        $this->registerAlias('UserSession', \OCP\IUserSession::class);
355
+
356
+        $this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function (Server $c) {
357
+            return new \OC\Authentication\TwoFactorAuth\Manager($c->getAppManager(), $c->getSession(), $c->getConfig(), $c->getActivityManager(), $c->getLogger());
358
+        });
359
+
360
+        $this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class);
361
+        $this->registerAlias('NavigationManager', \OCP\INavigationManager::class);
362
+
363
+        $this->registerService(\OC\AllConfig::class, function (Server $c) {
364
+            return new \OC\AllConfig(
365
+                $c->getSystemConfig()
366
+            );
367
+        });
368
+        $this->registerAlias('AllConfig', \OC\AllConfig::class);
369
+        $this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class);
370
+
371
+        $this->registerService('SystemConfig', function ($c) use ($config) {
372
+            return new \OC\SystemConfig($config);
373
+        });
374
+
375
+        $this->registerService(\OC\AppConfig::class, function (Server $c) {
376
+            return new \OC\AppConfig($c->getDatabaseConnection());
377
+        });
378
+        $this->registerAlias('AppConfig', \OC\AppConfig::class);
379
+        $this->registerAlias(\OCP\IAppConfig::class, \OC\AppConfig::class);
380
+
381
+        $this->registerService(\OCP\L10N\IFactory::class, function (Server $c) {
382
+            return new \OC\L10N\Factory(
383
+                $c->getConfig(),
384
+                $c->getRequest(),
385
+                $c->getUserSession(),
386
+                \OC::$SERVERROOT
387
+            );
388
+        });
389
+        $this->registerAlias('L10NFactory', \OCP\L10N\IFactory::class);
390
+
391
+        $this->registerService(\OCP\IURLGenerator::class, function (Server $c) {
392
+            $config = $c->getConfig();
393
+            $cacheFactory = $c->getMemCacheFactory();
394
+            return new \OC\URLGenerator(
395
+                $config,
396
+                $cacheFactory
397
+            );
398
+        });
399
+        $this->registerAlias('URLGenerator', \OCP\IURLGenerator::class);
400
+
401
+        $this->registerService('AppHelper', function ($c) {
402
+            return new \OC\AppHelper();
403
+        });
404
+        $this->registerService('AppFetcher', function ($c) {
405
+            return new AppFetcher(
406
+                $this->getAppDataDir('appstore'),
407
+                $this->getHTTPClientService(),
408
+                $this->query(TimeFactory::class),
409
+                $this->getConfig()
410
+            );
411
+        });
412
+        $this->registerService('CategoryFetcher', function ($c) {
413
+            return new CategoryFetcher(
414
+                $this->getAppDataDir('appstore'),
415
+                $this->getHTTPClientService(),
416
+                $this->query(TimeFactory::class),
417
+                $this->getConfig()
418
+            );
419
+        });
420
+
421
+        $this->registerService(\OCP\ICache::class, function ($c) {
422
+            return new Cache\File();
423
+        });
424
+        $this->registerAlias('UserCache', \OCP\ICache::class);
425
+
426
+        $this->registerService(Factory::class, function (Server $c) {
427
+            $config = $c->getConfig();
428
+
429
+            if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
430
+                $v = \OC_App::getAppVersions();
431
+                $v['core'] = md5(file_get_contents(\OC::$SERVERROOT . '/version.php'));
432
+                $version = implode(',', $v);
433
+                $instanceId = \OC_Util::getInstanceId();
434
+                $path = \OC::$SERVERROOT;
435
+                $prefix = md5($instanceId . '-' . $version . '-' . $path . '-' . \OC::$WEBROOT);
436
+                return new \OC\Memcache\Factory($prefix, $c->getLogger(),
437
+                    $config->getSystemValue('memcache.local', null),
438
+                    $config->getSystemValue('memcache.distributed', null),
439
+                    $config->getSystemValue('memcache.locking', null)
440
+                );
441
+            }
442
+
443
+            return new \OC\Memcache\Factory('', $c->getLogger(),
444
+                '\\OC\\Memcache\\ArrayCache',
445
+                '\\OC\\Memcache\\ArrayCache',
446
+                '\\OC\\Memcache\\ArrayCache'
447
+            );
448
+        });
449
+        $this->registerAlias('MemCacheFactory', Factory::class);
450
+        $this->registerAlias(ICacheFactory::class, Factory::class);
451
+
452
+        $this->registerService('RedisFactory', function (Server $c) {
453
+            $systemConfig = $c->getSystemConfig();
454
+            return new RedisFactory($systemConfig);
455
+        });
456
+
457
+        $this->registerService(\OCP\Activity\IManager::class, function (Server $c) {
458
+            return new \OC\Activity\Manager(
459
+                $c->getRequest(),
460
+                $c->getUserSession(),
461
+                $c->getConfig(),
462
+                $c->query(IValidator::class)
463
+            );
464
+        });
465
+        $this->registerAlias('ActivityManager', \OCP\Activity\IManager::class);
466
+
467
+        $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) {
468
+            return new \OC\Activity\EventMerger(
469
+                $c->getL10N('lib')
470
+            );
471
+        });
472
+        $this->registerAlias(IValidator::class, Validator::class);
473
+
474
+        $this->registerService(\OCP\IAvatarManager::class, function (Server $c) {
475
+            return new AvatarManager(
476
+                $c->getUserManager(),
477
+                $c->getAppDataDir('avatar'),
478
+                $c->getL10N('lib'),
479
+                $c->getLogger(),
480
+                $c->getConfig()
481
+            );
482
+        });
483
+        $this->registerAlias('AvatarManager', \OCP\IAvatarManager::class);
484
+
485
+        $this->registerService(\OCP\ILogger::class, function (Server $c) {
486
+            $logType = $c->query('AllConfig')->getSystemValue('log_type', 'file');
487
+            $logger = Log::getLogClass($logType);
488
+            call_user_func(array($logger, 'init'));
489
+
490
+            return new Log($logger);
491
+        });
492
+        $this->registerAlias('Logger', \OCP\ILogger::class);
493
+
494
+        $this->registerService(\OCP\BackgroundJob\IJobList::class, function (Server $c) {
495
+            $config = $c->getConfig();
496
+            return new \OC\BackgroundJob\JobList(
497
+                $c->getDatabaseConnection(),
498
+                $config,
499
+                new TimeFactory()
500
+            );
501
+        });
502
+        $this->registerAlias('JobList', \OCP\BackgroundJob\IJobList::class);
503
+
504
+        $this->registerService(\OCP\Route\IRouter::class, function (Server $c) {
505
+            $cacheFactory = $c->getMemCacheFactory();
506
+            $logger = $c->getLogger();
507
+            if ($cacheFactory->isAvailable()) {
508
+                $router = new \OC\Route\CachingRouter($cacheFactory->create('route'), $logger);
509
+            } else {
510
+                $router = new \OC\Route\Router($logger);
511
+            }
512
+            return $router;
513
+        });
514
+        $this->registerAlias('Router', \OCP\Route\IRouter::class);
515
+
516
+        $this->registerService(\OCP\ISearch::class, function ($c) {
517
+            return new Search();
518
+        });
519
+        $this->registerAlias('Search', \OCP\ISearch::class);
520
+
521
+        $this->registerService(\OCP\Security\ISecureRandom::class, function ($c) {
522
+            return new SecureRandom();
523
+        });
524
+        $this->registerAlias('SecureRandom', \OCP\Security\ISecureRandom::class);
525
+
526
+        $this->registerService(\OCP\Security\ICrypto::class, function (Server $c) {
527
+            return new Crypto($c->getConfig(), $c->getSecureRandom());
528
+        });
529
+        $this->registerAlias('Crypto', \OCP\Security\ICrypto::class);
530
+
531
+        $this->registerService(\OCP\Security\IHasher::class, function (Server $c) {
532
+            return new Hasher($c->getConfig());
533
+        });
534
+        $this->registerAlias('Hasher', \OCP\Security\IHasher::class);
535
+
536
+        $this->registerService(\OCP\Security\ICredentialsManager::class, function (Server $c) {
537
+            return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection());
538
+        });
539
+        $this->registerAlias('CredentialsManager', \OCP\Security\ICredentialsManager::class);
540
+
541
+        $this->registerService(IDBConnection::class, function (Server $c) {
542
+            $systemConfig = $c->getSystemConfig();
543
+            $factory = new \OC\DB\ConnectionFactory($systemConfig);
544
+            $type = $systemConfig->getValue('dbtype', 'sqlite');
545
+            if (!$factory->isValidType($type)) {
546
+                throw new \OC\DatabaseException('Invalid database type');
547
+            }
548
+            $connectionParams = $factory->createConnectionParams();
549
+            $connection = $factory->getConnection($type, $connectionParams);
550
+            $connection->getConfiguration()->setSQLLogger($c->getQueryLogger());
551
+            return $connection;
552
+        });
553
+        $this->registerAlias('DatabaseConnection', IDBConnection::class);
554
+
555
+        $this->registerService('HTTPHelper', function (Server $c) {
556
+            $config = $c->getConfig();
557
+            return new HTTPHelper(
558
+                $config,
559
+                $c->getHTTPClientService()
560
+            );
561
+        });
562
+
563
+        $this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) {
564
+            $user = \OC_User::getUser();
565
+            $uid = $user ? $user : null;
566
+            return new ClientService(
567
+                $c->getConfig(),
568
+                new \OC\Security\CertificateManager($uid, new View(), $c->getConfig(), $c->getLogger())
569
+            );
570
+        });
571
+        $this->registerAlias('HttpClientService', \OCP\Http\Client\IClientService::class);
572
+
573
+        $this->registerService(\OCP\Diagnostics\IEventLogger::class, function (Server $c) {
574
+            if ($c->getSystemConfig()->getValue('debug', false)) {
575
+                return new EventLogger();
576
+            } else {
577
+                return new NullEventLogger();
578
+            }
579
+        });
580
+        $this->registerAlias('EventLogger', \OCP\Diagnostics\IEventLogger::class);
581
+
582
+        $this->registerService(\OCP\Diagnostics\IQueryLogger::class, function (Server $c) {
583
+            if ($c->getSystemConfig()->getValue('debug', false)) {
584
+                return new QueryLogger();
585
+            } else {
586
+                return new NullQueryLogger();
587
+            }
588
+        });
589
+        $this->registerAlias('QueryLogger', \OCP\Diagnostics\IQueryLogger::class);
590
+
591
+        $this->registerService(TempManager::class, function (Server $c) {
592
+            return new TempManager(
593
+                $c->getLogger(),
594
+                $c->getConfig()
595
+            );
596
+        });
597
+        $this->registerAlias('TempManager', TempManager::class);
598
+        $this->registerAlias(ITempManager::class, TempManager::class);
599
+
600
+        $this->registerService(AppManager::class, function (Server $c) {
601
+            return new \OC\App\AppManager(
602
+                $c->getUserSession(),
603
+                $c->getAppConfig(),
604
+                $c->getGroupManager(),
605
+                $c->getMemCacheFactory(),
606
+                $c->getEventDispatcher()
607
+            );
608
+        });
609
+        $this->registerAlias('AppManager', AppManager::class);
610
+        $this->registerAlias(IAppManager::class, AppManager::class);
611
+
612
+        $this->registerService(\OCP\IDateTimeZone::class, function (Server $c) {
613
+            return new DateTimeZone(
614
+                $c->getConfig(),
615
+                $c->getSession()
616
+            );
617
+        });
618
+        $this->registerAlias('DateTimeZone', \OCP\IDateTimeZone::class);
619
+
620
+        $this->registerService(\OCP\IDateTimeFormatter::class, function (Server $c) {
621
+            $language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null);
622
+
623
+            return new DateTimeFormatter(
624
+                $c->getDateTimeZone()->getTimeZone(),
625
+                $c->getL10N('lib', $language)
626
+            );
627
+        });
628
+        $this->registerAlias('DateTimeFormatter', \OCP\IDateTimeFormatter::class);
629
+
630
+        $this->registerService(\OCP\Files\Config\IUserMountCache::class, function (Server $c) {
631
+            $mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger());
632
+            $listener = new UserMountCacheListener($mountCache);
633
+            $listener->listen($c->getUserManager());
634
+            return $mountCache;
635
+        });
636
+        $this->registerAlias('UserMountCache', \OCP\Files\Config\IUserMountCache::class);
637
+
638
+        $this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function (Server $c) {
639
+            $loader = \OC\Files\Filesystem::getLoader();
640
+            $mountCache = $c->query('UserMountCache');
641
+            $manager =  new \OC\Files\Config\MountProviderCollection($loader, $mountCache);
642
+
643
+            // builtin providers
644
+
645
+            $config = $c->getConfig();
646
+            $manager->registerProvider(new CacheMountProvider($config));
647
+            $manager->registerHomeProvider(new LocalHomeMountProvider());
648
+            $manager->registerHomeProvider(new ObjectHomeMountProvider($config));
649
+
650
+            return $manager;
651
+        });
652
+        $this->registerAlias('MountConfigManager', \OCP\Files\Config\IMountProviderCollection::class);
653
+
654
+        $this->registerService('IniWrapper', function ($c) {
655
+            return new IniGetWrapper();
656
+        });
657
+        $this->registerService('AsyncCommandBus', function (Server $c) {
658
+            $jobList = $c->getJobList();
659
+            return new AsyncBus($jobList);
660
+        });
661
+        $this->registerService('TrustedDomainHelper', function ($c) {
662
+            return new TrustedDomainHelper($this->getConfig());
663
+        });
664
+        $this->registerService('Throttler', function(Server $c) {
665
+            return new Throttler(
666
+                $c->getDatabaseConnection(),
667
+                new TimeFactory(),
668
+                $c->getLogger(),
669
+                $c->getConfig()
670
+            );
671
+        });
672
+        $this->registerService('IntegrityCodeChecker', function (Server $c) {
673
+            // IConfig and IAppManager requires a working database. This code
674
+            // might however be called when ownCloud is not yet setup.
675
+            if(\OC::$server->getSystemConfig()->getValue('installed', false)) {
676
+                $config = $c->getConfig();
677
+                $appManager = $c->getAppManager();
678
+            } else {
679
+                $config = null;
680
+                $appManager = null;
681
+            }
682
+
683
+            return new Checker(
684
+                    new EnvironmentHelper(),
685
+                    new FileAccessHelper(),
686
+                    new AppLocator(),
687
+                    $config,
688
+                    $c->getMemCacheFactory(),
689
+                    $appManager,
690
+                    $c->getTempManager()
691
+            );
692
+        });
693
+        $this->registerService(\OCP\IRequest::class, function ($c) {
694
+            if (isset($this['urlParams'])) {
695
+                $urlParams = $this['urlParams'];
696
+            } else {
697
+                $urlParams = [];
698
+            }
699
+
700
+            if (defined('PHPUNIT_RUN') && PHPUNIT_RUN
701
+                && in_array('fakeinput', stream_get_wrappers())
702
+            ) {
703
+                $stream = 'fakeinput://data';
704
+            } else {
705
+                $stream = 'php://input';
706
+            }
707
+
708
+            return new Request(
709
+                [
710
+                    'get' => $_GET,
711
+                    'post' => $_POST,
712
+                    'files' => $_FILES,
713
+                    'server' => $_SERVER,
714
+                    'env' => $_ENV,
715
+                    'cookies' => $_COOKIE,
716
+                    'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD']))
717
+                        ? $_SERVER['REQUEST_METHOD']
718
+                        : null,
719
+                    'urlParams' => $urlParams,
720
+                ],
721
+                $this->getSecureRandom(),
722
+                $this->getConfig(),
723
+                $this->getCsrfTokenManager(),
724
+                $stream
725
+            );
726
+        });
727
+        $this->registerAlias('Request', \OCP\IRequest::class);
728
+
729
+        $this->registerService(\OCP\Mail\IMailer::class, function (Server $c) {
730
+            return new Mailer(
731
+                $c->getConfig(),
732
+                $c->getLogger(),
733
+                $c->getThemingDefaults()
734
+            );
735
+        });
736
+        $this->registerAlias('Mailer', \OCP\Mail\IMailer::class);
737
+
738
+        $this->registerService('LDAPProvider', function(Server $c) {
739
+            $config = $c->getConfig();
740
+            $factoryClass = $config->getSystemValue('ldapProviderFactory', null);
741
+            if(is_null($factoryClass)) {
742
+                throw new \Exception('ldapProviderFactory not set');
743
+            }
744
+            /** @var \OCP\LDAP\ILDAPProviderFactory $factory */
745
+            $factory = new $factoryClass($this);
746
+            return $factory->getLDAPProvider();
747
+        });
748
+        $this->registerService('LockingProvider', function (Server $c) {
749
+            $ini = $c->getIniWrapper();
750
+            $config = $c->getConfig();
751
+            $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time')));
752
+            if ($config->getSystemValue('filelocking.enabled', true) or (defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
753
+                /** @var \OC\Memcache\Factory $memcacheFactory */
754
+                $memcacheFactory = $c->getMemCacheFactory();
755
+                $memcache = $memcacheFactory->createLocking('lock');
756
+                if (!($memcache instanceof \OC\Memcache\NullCache)) {
757
+                    return new MemcacheLockingProvider($memcache, $ttl);
758
+                }
759
+                return new DBLockingProvider($c->getDatabaseConnection(), $c->getLogger(), new TimeFactory(), $ttl);
760
+            }
761
+            return new NoopLockingProvider();
762
+        });
763
+
764
+        $this->registerService(\OCP\Files\Mount\IMountManager::class, function () {
765
+            return new \OC\Files\Mount\Manager();
766
+        });
767
+        $this->registerAlias('MountManager', \OCP\Files\Mount\IMountManager::class);
768
+
769
+        $this->registerService(\OCP\Files\IMimeTypeDetector::class, function (Server $c) {
770
+            return new \OC\Files\Type\Detection(
771
+                $c->getURLGenerator(),
772
+                \OC::$configDir,
773
+                \OC::$SERVERROOT . '/resources/config/'
774
+            );
775
+        });
776
+        $this->registerAlias('MimeTypeDetector', \OCP\Files\IMimeTypeDetector::class);
777
+
778
+        $this->registerService(\OCP\Files\IMimeTypeLoader::class, function (Server $c) {
779
+            return new \OC\Files\Type\Loader(
780
+                $c->getDatabaseConnection()
781
+            );
782
+        });
783
+        $this->registerAlias('MimeTypeLoader', \OCP\Files\IMimeTypeLoader::class);
784
+
785
+        $this->registerService(\OCP\Notification\IManager::class, function (Server $c) {
786
+            return new Manager(
787
+                $c->query(IValidator::class)
788
+            );
789
+        });
790
+        $this->registerAlias('NotificationManager', \OCP\Notification\IManager::class);
791
+
792
+        $this->registerService(\OC\CapabilitiesManager::class, function (Server $c) {
793
+            $manager = new \OC\CapabilitiesManager($c->getLogger());
794
+            $manager->registerCapability(function () use ($c) {
795
+                return new \OC\OCS\CoreCapabilities($c->getConfig());
796
+            });
797
+            return $manager;
798
+        });
799
+        $this->registerAlias('CapabilitiesManager', \OC\CapabilitiesManager::class);
800
+
801
+        $this->registerService(\OCP\Comments\ICommentsManager::class, function(Server $c) {
802
+            $config = $c->getConfig();
803
+            $factoryClass = $config->getSystemValue('comments.managerFactory', '\OC\Comments\ManagerFactory');
804
+            /** @var \OCP\Comments\ICommentsManagerFactory $factory */
805
+            $factory = new $factoryClass($this);
806
+            return $factory->getManager();
807
+        });
808
+        $this->registerAlias('CommentsManager', \OCP\Comments\ICommentsManager::class);
809
+
810
+        $this->registerService('ThemingDefaults', function(Server $c) {
811
+            /*
812 812
 			 * Dark magic for autoloader.
813 813
 			 * If we do a class_exists it will try to load the class which will
814 814
 			 * make composer cache the result. Resulting in errors when enabling
815 815
 			 * the theming app.
816 816
 			 */
817
-			$prefixes = \OC::$composerAutoloader->getPrefixesPsr4();
818
-			if (isset($prefixes['OCA\\Theming\\'])) {
819
-				$classExists = true;
820
-			} else {
821
-				$classExists = false;
822
-			}
823
-
824
-			if ($classExists && $c->getConfig()->getSystemValue('installed', false) && $c->getAppManager()->isInstalled('theming')) {
825
-				return new ThemingDefaults(
826
-					$c->getConfig(),
827
-					$c->getL10N('theming'),
828
-					$c->getURLGenerator(),
829
-					new \OC_Defaults(),
830
-					$c->getAppDataDir('theming'),
831
-					$c->getMemCacheFactory(),
832
-					new Util($c->getConfig(), $this->getRootFolder(), $this->getAppManager())
833
-				);
834
-			}
835
-			return new \OC_Defaults();
836
-		});
837
-		$this->registerService(SCSSCacher::class, function(Server $c) {
838
-			/** @var Factory $cacheFactory */
839
-			$cacheFactory = $c->query(Factory::class);
840
-			return new SCSSCacher(
841
-				$c->getLogger(),
842
-				$c->query(\OC\Files\AppData\Factory::class),
843
-				$c->getURLGenerator(),
844
-				$c->getConfig(),
845
-				$c->getThemingDefaults(),
846
-				\OC::$SERVERROOT,
847
-				$cacheFactory->createLocal('SCSS')
848
-
849
-			);
850
-		});
851
-		$this->registerService(EventDispatcher::class, function () {
852
-			return new EventDispatcher();
853
-		});
854
-		$this->registerAlias('EventDispatcher', EventDispatcher::class);
855
-		$this->registerAlias(EventDispatcherInterface::class, EventDispatcher::class);
856
-
857
-		$this->registerService('CryptoWrapper', function (Server $c) {
858
-			// FIXME: Instantiiated here due to cyclic dependency
859
-			$request = new Request(
860
-				[
861
-					'get' => $_GET,
862
-					'post' => $_POST,
863
-					'files' => $_FILES,
864
-					'server' => $_SERVER,
865
-					'env' => $_ENV,
866
-					'cookies' => $_COOKIE,
867
-					'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD']))
868
-						? $_SERVER['REQUEST_METHOD']
869
-						: null,
870
-				],
871
-				$c->getSecureRandom(),
872
-				$c->getConfig()
873
-			);
874
-
875
-			return new CryptoWrapper(
876
-				$c->getConfig(),
877
-				$c->getCrypto(),
878
-				$c->getSecureRandom(),
879
-				$request
880
-			);
881
-		});
882
-		$this->registerService('CsrfTokenManager', function (Server $c) {
883
-			$tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom());
884
-
885
-			return new CsrfTokenManager(
886
-				$tokenGenerator,
887
-				$c->query(SessionStorage::class)
888
-			);
889
-		});
890
-		$this->registerService(SessionStorage::class, function (Server $c) {
891
-			return new SessionStorage($c->getSession());
892
-		});
893
-		$this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function (Server $c) {
894
-			return new ContentSecurityPolicyManager();
895
-		});
896
-		$this->registerAlias('ContentSecurityPolicyManager', \OCP\Security\IContentSecurityPolicyManager::class);
897
-
898
-		$this->registerService('ContentSecurityPolicyNonceManager', function(Server $c) {
899
-			return new ContentSecurityPolicyNonceManager(
900
-				$c->getCsrfTokenManager(),
901
-				$c->getRequest()
902
-			);
903
-		});
904
-
905
-		$this->registerService(\OCP\Share\IManager::class, function(Server $c) {
906
-			$config = $c->getConfig();
907
-			$factoryClass = $config->getSystemValue('sharing.managerFactory', '\OC\Share20\ProviderFactory');
908
-			/** @var \OCP\Share\IProviderFactory $factory */
909
-			$factory = new $factoryClass($this);
910
-
911
-			$manager = new \OC\Share20\Manager(
912
-				$c->getLogger(),
913
-				$c->getConfig(),
914
-				$c->getSecureRandom(),
915
-				$c->getHasher(),
916
-				$c->getMountManager(),
917
-				$c->getGroupManager(),
918
-				$c->getL10N('core'),
919
-				$factory,
920
-				$c->getUserManager(),
921
-				$c->getLazyRootFolder(),
922
-				$c->getEventDispatcher()
923
-			);
924
-
925
-			return $manager;
926
-		});
927
-		$this->registerAlias('ShareManager', \OCP\Share\IManager::class);
928
-
929
-		$this->registerService('SettingsManager', function(Server $c) {
930
-			$manager = new \OC\Settings\Manager(
931
-				$c->getLogger(),
932
-				$c->getDatabaseConnection(),
933
-				$c->getL10N('lib'),
934
-				$c->getConfig(),
935
-				$c->getEncryptionManager(),
936
-				$c->getUserManager(),
937
-				$c->getLockingProvider(),
938
-				$c->getRequest(),
939
-				new \OC\Settings\Mapper($c->getDatabaseConnection()),
940
-				$c->getURLGenerator()
941
-			);
942
-			return $manager;
943
-		});
944
-		$this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) {
945
-			return new \OC\Files\AppData\Factory(
946
-				$c->getRootFolder(),
947
-				$c->getSystemConfig()
948
-			);
949
-		});
950
-
951
-		$this->registerService('LockdownManager', function (Server $c) {
952
-			return new LockdownManager();
953
-		});
954
-
955
-		$this->registerService(ICloudIdManager::class, function (Server $c) {
956
-			return new CloudIdManager();
957
-		});
958
-
959
-		/* To trick DI since we don't extend the DIContainer here */
960
-		$this->registerService(CleanPreviewsBackgroundJob::class, function (Server $c) {
961
-			return new CleanPreviewsBackgroundJob(
962
-				$c->getRootFolder(),
963
-				$c->getLogger(),
964
-				$c->getJobList(),
965
-				new TimeFactory()
966
-			);
967
-		});
968
-
969
-		$this->registerAlias(\OCP\AppFramework\Utility\IControllerMethodReflector::class, \OC\AppFramework\Utility\ControllerMethodReflector::class);
970
-		$this->registerAlias('ControllerMethodReflector', \OCP\AppFramework\Utility\IControllerMethodReflector::class);
971
-
972
-		$this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class);
973
-		$this->registerAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class);
974
-
975
-		$this->registerService(\OCP\ISession::class, function(SimpleContainer $c) {
976
-			return $c->query(\OCP\IUserSession::class)->getSession();
977
-		});
978
-	}
979
-
980
-	/**
981
-	 * @return \OCP\Contacts\IManager
982
-	 */
983
-	public function getContactsManager() {
984
-		return $this->query('ContactsManager');
985
-	}
986
-
987
-	/**
988
-	 * @return \OC\Encryption\Manager
989
-	 */
990
-	public function getEncryptionManager() {
991
-		return $this->query('EncryptionManager');
992
-	}
993
-
994
-	/**
995
-	 * @return \OC\Encryption\File
996
-	 */
997
-	public function getEncryptionFilesHelper() {
998
-		return $this->query('EncryptionFileHelper');
999
-	}
1000
-
1001
-	/**
1002
-	 * @return \OCP\Encryption\Keys\IStorage
1003
-	 */
1004
-	public function getEncryptionKeyStorage() {
1005
-		return $this->query('EncryptionKeyStorage');
1006
-	}
1007
-
1008
-	/**
1009
-	 * The current request object holding all information about the request
1010
-	 * currently being processed is returned from this method.
1011
-	 * In case the current execution was not initiated by a web request null is returned
1012
-	 *
1013
-	 * @return \OCP\IRequest
1014
-	 */
1015
-	public function getRequest() {
1016
-		return $this->query('Request');
1017
-	}
1018
-
1019
-	/**
1020
-	 * Returns the preview manager which can create preview images for a given file
1021
-	 *
1022
-	 * @return \OCP\IPreview
1023
-	 */
1024
-	public function getPreviewManager() {
1025
-		return $this->query('PreviewManager');
1026
-	}
1027
-
1028
-	/**
1029
-	 * Returns the tag manager which can get and set tags for different object types
1030
-	 *
1031
-	 * @see \OCP\ITagManager::load()
1032
-	 * @return \OCP\ITagManager
1033
-	 */
1034
-	public function getTagManager() {
1035
-		return $this->query('TagManager');
1036
-	}
1037
-
1038
-	/**
1039
-	 * Returns the system-tag manager
1040
-	 *
1041
-	 * @return \OCP\SystemTag\ISystemTagManager
1042
-	 *
1043
-	 * @since 9.0.0
1044
-	 */
1045
-	public function getSystemTagManager() {
1046
-		return $this->query('SystemTagManager');
1047
-	}
1048
-
1049
-	/**
1050
-	 * Returns the system-tag object mapper
1051
-	 *
1052
-	 * @return \OCP\SystemTag\ISystemTagObjectMapper
1053
-	 *
1054
-	 * @since 9.0.0
1055
-	 */
1056
-	public function getSystemTagObjectMapper() {
1057
-		return $this->query('SystemTagObjectMapper');
1058
-	}
1059
-
1060
-	/**
1061
-	 * Returns the avatar manager, used for avatar functionality
1062
-	 *
1063
-	 * @return \OCP\IAvatarManager
1064
-	 */
1065
-	public function getAvatarManager() {
1066
-		return $this->query('AvatarManager');
1067
-	}
1068
-
1069
-	/**
1070
-	 * Returns the root folder of ownCloud's data directory
1071
-	 *
1072
-	 * @return \OCP\Files\IRootFolder
1073
-	 */
1074
-	public function getRootFolder() {
1075
-		return $this->query('LazyRootFolder');
1076
-	}
1077
-
1078
-	/**
1079
-	 * Returns the root folder of ownCloud's data directory
1080
-	 * This is the lazy variant so this gets only initialized once it
1081
-	 * is actually used.
1082
-	 *
1083
-	 * @return \OCP\Files\IRootFolder
1084
-	 */
1085
-	public function getLazyRootFolder() {
1086
-		return $this->query('LazyRootFolder');
1087
-	}
1088
-
1089
-	/**
1090
-	 * Returns a view to ownCloud's files folder
1091
-	 *
1092
-	 * @param string $userId user ID
1093
-	 * @return \OCP\Files\Folder|null
1094
-	 */
1095
-	public function getUserFolder($userId = null) {
1096
-		if ($userId === null) {
1097
-			$user = $this->getUserSession()->getUser();
1098
-			if (!$user) {
1099
-				return null;
1100
-			}
1101
-			$userId = $user->getUID();
1102
-		}
1103
-		$root = $this->getRootFolder();
1104
-		return $root->getUserFolder($userId);
1105
-	}
1106
-
1107
-	/**
1108
-	 * Returns an app-specific view in ownClouds data directory
1109
-	 *
1110
-	 * @return \OCP\Files\Folder
1111
-	 * @deprecated since 9.2.0 use IAppData
1112
-	 */
1113
-	public function getAppFolder() {
1114
-		$dir = '/' . \OC_App::getCurrentApp();
1115
-		$root = $this->getRootFolder();
1116
-		if (!$root->nodeExists($dir)) {
1117
-			$folder = $root->newFolder($dir);
1118
-		} else {
1119
-			$folder = $root->get($dir);
1120
-		}
1121
-		return $folder;
1122
-	}
1123
-
1124
-	/**
1125
-	 * @return \OC\User\Manager
1126
-	 */
1127
-	public function getUserManager() {
1128
-		return $this->query('UserManager');
1129
-	}
1130
-
1131
-	/**
1132
-	 * @return \OC\Group\Manager
1133
-	 */
1134
-	public function getGroupManager() {
1135
-		return $this->query('GroupManager');
1136
-	}
1137
-
1138
-	/**
1139
-	 * @return \OC\User\Session
1140
-	 */
1141
-	public function getUserSession() {
1142
-		return $this->query('UserSession');
1143
-	}
1144
-
1145
-	/**
1146
-	 * @return \OCP\ISession
1147
-	 */
1148
-	public function getSession() {
1149
-		return $this->query('UserSession')->getSession();
1150
-	}
1151
-
1152
-	/**
1153
-	 * @param \OCP\ISession $session
1154
-	 */
1155
-	public function setSession(\OCP\ISession $session) {
1156
-		$this->query(SessionStorage::class)->setSession($session);
1157
-		$this->query('UserSession')->setSession($session);
1158
-		$this->query(Store::class)->setSession($session);
1159
-	}
1160
-
1161
-	/**
1162
-	 * @return \OC\Authentication\TwoFactorAuth\Manager
1163
-	 */
1164
-	public function getTwoFactorAuthManager() {
1165
-		return $this->query('\OC\Authentication\TwoFactorAuth\Manager');
1166
-	}
1167
-
1168
-	/**
1169
-	 * @return \OC\NavigationManager
1170
-	 */
1171
-	public function getNavigationManager() {
1172
-		return $this->query('NavigationManager');
1173
-	}
1174
-
1175
-	/**
1176
-	 * @return \OCP\IConfig
1177
-	 */
1178
-	public function getConfig() {
1179
-		return $this->query('AllConfig');
1180
-	}
1181
-
1182
-	/**
1183
-	 * @internal For internal use only
1184
-	 * @return \OC\SystemConfig
1185
-	 */
1186
-	public function getSystemConfig() {
1187
-		return $this->query('SystemConfig');
1188
-	}
1189
-
1190
-	/**
1191
-	 * Returns the app config manager
1192
-	 *
1193
-	 * @return \OCP\IAppConfig
1194
-	 */
1195
-	public function getAppConfig() {
1196
-		return $this->query('AppConfig');
1197
-	}
1198
-
1199
-	/**
1200
-	 * @return \OCP\L10N\IFactory
1201
-	 */
1202
-	public function getL10NFactory() {
1203
-		return $this->query('L10NFactory');
1204
-	}
1205
-
1206
-	/**
1207
-	 * get an L10N instance
1208
-	 *
1209
-	 * @param string $app appid
1210
-	 * @param string $lang
1211
-	 * @return IL10N
1212
-	 */
1213
-	public function getL10N($app, $lang = null) {
1214
-		return $this->getL10NFactory()->get($app, $lang);
1215
-	}
1216
-
1217
-	/**
1218
-	 * @return \OCP\IURLGenerator
1219
-	 */
1220
-	public function getURLGenerator() {
1221
-		return $this->query('URLGenerator');
1222
-	}
1223
-
1224
-	/**
1225
-	 * @return \OCP\IHelper
1226
-	 */
1227
-	public function getHelper() {
1228
-		return $this->query('AppHelper');
1229
-	}
1230
-
1231
-	/**
1232
-	 * @return AppFetcher
1233
-	 */
1234
-	public function getAppFetcher() {
1235
-		return $this->query('AppFetcher');
1236
-	}
1237
-
1238
-	/**
1239
-	 * Returns an ICache instance. Since 8.1.0 it returns a fake cache. Use
1240
-	 * getMemCacheFactory() instead.
1241
-	 *
1242
-	 * @return \OCP\ICache
1243
-	 * @deprecated 8.1.0 use getMemCacheFactory to obtain a proper cache
1244
-	 */
1245
-	public function getCache() {
1246
-		return $this->query('UserCache');
1247
-	}
1248
-
1249
-	/**
1250
-	 * Returns an \OCP\CacheFactory instance
1251
-	 *
1252
-	 * @return \OCP\ICacheFactory
1253
-	 */
1254
-	public function getMemCacheFactory() {
1255
-		return $this->query('MemCacheFactory');
1256
-	}
1257
-
1258
-	/**
1259
-	 * Returns an \OC\RedisFactory instance
1260
-	 *
1261
-	 * @return \OC\RedisFactory
1262
-	 */
1263
-	public function getGetRedisFactory() {
1264
-		return $this->query('RedisFactory');
1265
-	}
1266
-
1267
-
1268
-	/**
1269
-	 * Returns the current session
1270
-	 *
1271
-	 * @return \OCP\IDBConnection
1272
-	 */
1273
-	public function getDatabaseConnection() {
1274
-		return $this->query('DatabaseConnection');
1275
-	}
1276
-
1277
-	/**
1278
-	 * Returns the activity manager
1279
-	 *
1280
-	 * @return \OCP\Activity\IManager
1281
-	 */
1282
-	public function getActivityManager() {
1283
-		return $this->query('ActivityManager');
1284
-	}
1285
-
1286
-	/**
1287
-	 * Returns an job list for controlling background jobs
1288
-	 *
1289
-	 * @return \OCP\BackgroundJob\IJobList
1290
-	 */
1291
-	public function getJobList() {
1292
-		return $this->query('JobList');
1293
-	}
1294
-
1295
-	/**
1296
-	 * Returns a logger instance
1297
-	 *
1298
-	 * @return \OCP\ILogger
1299
-	 */
1300
-	public function getLogger() {
1301
-		return $this->query('Logger');
1302
-	}
1303
-
1304
-	/**
1305
-	 * Returns a router for generating and matching urls
1306
-	 *
1307
-	 * @return \OCP\Route\IRouter
1308
-	 */
1309
-	public function getRouter() {
1310
-		return $this->query('Router');
1311
-	}
1312
-
1313
-	/**
1314
-	 * Returns a search instance
1315
-	 *
1316
-	 * @return \OCP\ISearch
1317
-	 */
1318
-	public function getSearch() {
1319
-		return $this->query('Search');
1320
-	}
1321
-
1322
-	/**
1323
-	 * Returns a SecureRandom instance
1324
-	 *
1325
-	 * @return \OCP\Security\ISecureRandom
1326
-	 */
1327
-	public function getSecureRandom() {
1328
-		return $this->query('SecureRandom');
1329
-	}
1330
-
1331
-	/**
1332
-	 * Returns a Crypto instance
1333
-	 *
1334
-	 * @return \OCP\Security\ICrypto
1335
-	 */
1336
-	public function getCrypto() {
1337
-		return $this->query('Crypto');
1338
-	}
1339
-
1340
-	/**
1341
-	 * Returns a Hasher instance
1342
-	 *
1343
-	 * @return \OCP\Security\IHasher
1344
-	 */
1345
-	public function getHasher() {
1346
-		return $this->query('Hasher');
1347
-	}
1348
-
1349
-	/**
1350
-	 * Returns a CredentialsManager instance
1351
-	 *
1352
-	 * @return \OCP\Security\ICredentialsManager
1353
-	 */
1354
-	public function getCredentialsManager() {
1355
-		return $this->query('CredentialsManager');
1356
-	}
1357
-
1358
-	/**
1359
-	 * Returns an instance of the HTTP helper class
1360
-	 *
1361
-	 * @deprecated Use getHTTPClientService()
1362
-	 * @return \OC\HTTPHelper
1363
-	 */
1364
-	public function getHTTPHelper() {
1365
-		return $this->query('HTTPHelper');
1366
-	}
1367
-
1368
-	/**
1369
-	 * Get the certificate manager for the user
1370
-	 *
1371
-	 * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager
1372
-	 * @return \OCP\ICertificateManager | null if $uid is null and no user is logged in
1373
-	 */
1374
-	public function getCertificateManager($userId = '') {
1375
-		if ($userId === '') {
1376
-			$userSession = $this->getUserSession();
1377
-			$user = $userSession->getUser();
1378
-			if (is_null($user)) {
1379
-				return null;
1380
-			}
1381
-			$userId = $user->getUID();
1382
-		}
1383
-		return new CertificateManager($userId, new View(), $this->getConfig(), $this->getLogger());
1384
-	}
1385
-
1386
-	/**
1387
-	 * Returns an instance of the HTTP client service
1388
-	 *
1389
-	 * @return \OCP\Http\Client\IClientService
1390
-	 */
1391
-	public function getHTTPClientService() {
1392
-		return $this->query('HttpClientService');
1393
-	}
1394
-
1395
-	/**
1396
-	 * Create a new event source
1397
-	 *
1398
-	 * @return \OCP\IEventSource
1399
-	 */
1400
-	public function createEventSource() {
1401
-		return new \OC_EventSource();
1402
-	}
1403
-
1404
-	/**
1405
-	 * Get the active event logger
1406
-	 *
1407
-	 * The returned logger only logs data when debug mode is enabled
1408
-	 *
1409
-	 * @return \OCP\Diagnostics\IEventLogger
1410
-	 */
1411
-	public function getEventLogger() {
1412
-		return $this->query('EventLogger');
1413
-	}
1414
-
1415
-	/**
1416
-	 * Get the active query logger
1417
-	 *
1418
-	 * The returned logger only logs data when debug mode is enabled
1419
-	 *
1420
-	 * @return \OCP\Diagnostics\IQueryLogger
1421
-	 */
1422
-	public function getQueryLogger() {
1423
-		return $this->query('QueryLogger');
1424
-	}
1425
-
1426
-	/**
1427
-	 * Get the manager for temporary files and folders
1428
-	 *
1429
-	 * @return \OCP\ITempManager
1430
-	 */
1431
-	public function getTempManager() {
1432
-		return $this->query('TempManager');
1433
-	}
1434
-
1435
-	/**
1436
-	 * Get the app manager
1437
-	 *
1438
-	 * @return \OCP\App\IAppManager
1439
-	 */
1440
-	public function getAppManager() {
1441
-		return $this->query('AppManager');
1442
-	}
1443
-
1444
-	/**
1445
-	 * Creates a new mailer
1446
-	 *
1447
-	 * @return \OCP\Mail\IMailer
1448
-	 */
1449
-	public function getMailer() {
1450
-		return $this->query('Mailer');
1451
-	}
1452
-
1453
-	/**
1454
-	 * Get the webroot
1455
-	 *
1456
-	 * @return string
1457
-	 */
1458
-	public function getWebRoot() {
1459
-		return $this->webRoot;
1460
-	}
1461
-
1462
-	/**
1463
-	 * @return \OC\OCSClient
1464
-	 */
1465
-	public function getOcsClient() {
1466
-		return $this->query('OcsClient');
1467
-	}
1468
-
1469
-	/**
1470
-	 * @return \OCP\IDateTimeZone
1471
-	 */
1472
-	public function getDateTimeZone() {
1473
-		return $this->query('DateTimeZone');
1474
-	}
1475
-
1476
-	/**
1477
-	 * @return \OCP\IDateTimeFormatter
1478
-	 */
1479
-	public function getDateTimeFormatter() {
1480
-		return $this->query('DateTimeFormatter');
1481
-	}
1482
-
1483
-	/**
1484
-	 * @return \OCP\Files\Config\IMountProviderCollection
1485
-	 */
1486
-	public function getMountProviderCollection() {
1487
-		return $this->query('MountConfigManager');
1488
-	}
1489
-
1490
-	/**
1491
-	 * Get the IniWrapper
1492
-	 *
1493
-	 * @return IniGetWrapper
1494
-	 */
1495
-	public function getIniWrapper() {
1496
-		return $this->query('IniWrapper');
1497
-	}
1498
-
1499
-	/**
1500
-	 * @return \OCP\Command\IBus
1501
-	 */
1502
-	public function getCommandBus() {
1503
-		return $this->query('AsyncCommandBus');
1504
-	}
1505
-
1506
-	/**
1507
-	 * Get the trusted domain helper
1508
-	 *
1509
-	 * @return TrustedDomainHelper
1510
-	 */
1511
-	public function getTrustedDomainHelper() {
1512
-		return $this->query('TrustedDomainHelper');
1513
-	}
1514
-
1515
-	/**
1516
-	 * Get the locking provider
1517
-	 *
1518
-	 * @return \OCP\Lock\ILockingProvider
1519
-	 * @since 8.1.0
1520
-	 */
1521
-	public function getLockingProvider() {
1522
-		return $this->query('LockingProvider');
1523
-	}
1524
-
1525
-	/**
1526
-	 * @return \OCP\Files\Mount\IMountManager
1527
-	 **/
1528
-	function getMountManager() {
1529
-		return $this->query('MountManager');
1530
-	}
1531
-
1532
-	/** @return \OCP\Files\Config\IUserMountCache */
1533
-	function getUserMountCache() {
1534
-		return $this->query('UserMountCache');
1535
-	}
1536
-
1537
-	/**
1538
-	 * Get the MimeTypeDetector
1539
-	 *
1540
-	 * @return \OCP\Files\IMimeTypeDetector
1541
-	 */
1542
-	public function getMimeTypeDetector() {
1543
-		return $this->query('MimeTypeDetector');
1544
-	}
1545
-
1546
-	/**
1547
-	 * Get the MimeTypeLoader
1548
-	 *
1549
-	 * @return \OCP\Files\IMimeTypeLoader
1550
-	 */
1551
-	public function getMimeTypeLoader() {
1552
-		return $this->query('MimeTypeLoader');
1553
-	}
1554
-
1555
-	/**
1556
-	 * Get the manager of all the capabilities
1557
-	 *
1558
-	 * @return \OC\CapabilitiesManager
1559
-	 */
1560
-	public function getCapabilitiesManager() {
1561
-		return $this->query('CapabilitiesManager');
1562
-	}
1563
-
1564
-	/**
1565
-	 * Get the EventDispatcher
1566
-	 *
1567
-	 * @return EventDispatcherInterface
1568
-	 * @since 8.2.0
1569
-	 */
1570
-	public function getEventDispatcher() {
1571
-		return $this->query('EventDispatcher');
1572
-	}
1573
-
1574
-	/**
1575
-	 * Get the Notification Manager
1576
-	 *
1577
-	 * @return \OCP\Notification\IManager
1578
-	 * @since 8.2.0
1579
-	 */
1580
-	public function getNotificationManager() {
1581
-		return $this->query('NotificationManager');
1582
-	}
1583
-
1584
-	/**
1585
-	 * @return \OCP\Comments\ICommentsManager
1586
-	 */
1587
-	public function getCommentsManager() {
1588
-		return $this->query('CommentsManager');
1589
-	}
1590
-
1591
-	/**
1592
-	 * @return \OC_Defaults
1593
-	 */
1594
-	public function getThemingDefaults() {
1595
-		return $this->query('ThemingDefaults');
1596
-	}
1597
-
1598
-	/**
1599
-	 * @return \OC\IntegrityCheck\Checker
1600
-	 */
1601
-	public function getIntegrityCodeChecker() {
1602
-		return $this->query('IntegrityCodeChecker');
1603
-	}
1604
-
1605
-	/**
1606
-	 * @return \OC\Session\CryptoWrapper
1607
-	 */
1608
-	public function getSessionCryptoWrapper() {
1609
-		return $this->query('CryptoWrapper');
1610
-	}
1611
-
1612
-	/**
1613
-	 * @return CsrfTokenManager
1614
-	 */
1615
-	public function getCsrfTokenManager() {
1616
-		return $this->query('CsrfTokenManager');
1617
-	}
1618
-
1619
-	/**
1620
-	 * @return Throttler
1621
-	 */
1622
-	public function getBruteForceThrottler() {
1623
-		return $this->query('Throttler');
1624
-	}
1625
-
1626
-	/**
1627
-	 * @return IContentSecurityPolicyManager
1628
-	 */
1629
-	public function getContentSecurityPolicyManager() {
1630
-		return $this->query('ContentSecurityPolicyManager');
1631
-	}
1632
-
1633
-	/**
1634
-	 * @return ContentSecurityPolicyNonceManager
1635
-	 */
1636
-	public function getContentSecurityPolicyNonceManager() {
1637
-		return $this->query('ContentSecurityPolicyNonceManager');
1638
-	}
1639
-
1640
-	/**
1641
-	 * Not a public API as of 8.2, wait for 9.0
1642
-	 *
1643
-	 * @return \OCA\Files_External\Service\BackendService
1644
-	 */
1645
-	public function getStoragesBackendService() {
1646
-		return $this->query('OCA\\Files_External\\Service\\BackendService');
1647
-	}
1648
-
1649
-	/**
1650
-	 * Not a public API as of 8.2, wait for 9.0
1651
-	 *
1652
-	 * @return \OCA\Files_External\Service\GlobalStoragesService
1653
-	 */
1654
-	public function getGlobalStoragesService() {
1655
-		return $this->query('OCA\\Files_External\\Service\\GlobalStoragesService');
1656
-	}
1657
-
1658
-	/**
1659
-	 * Not a public API as of 8.2, wait for 9.0
1660
-	 *
1661
-	 * @return \OCA\Files_External\Service\UserGlobalStoragesService
1662
-	 */
1663
-	public function getUserGlobalStoragesService() {
1664
-		return $this->query('OCA\\Files_External\\Service\\UserGlobalStoragesService');
1665
-	}
1666
-
1667
-	/**
1668
-	 * Not a public API as of 8.2, wait for 9.0
1669
-	 *
1670
-	 * @return \OCA\Files_External\Service\UserStoragesService
1671
-	 */
1672
-	public function getUserStoragesService() {
1673
-		return $this->query('OCA\\Files_External\\Service\\UserStoragesService');
1674
-	}
1675
-
1676
-	/**
1677
-	 * @return \OCP\Share\IManager
1678
-	 */
1679
-	public function getShareManager() {
1680
-		return $this->query('ShareManager');
1681
-	}
1682
-
1683
-	/**
1684
-	 * Returns the LDAP Provider
1685
-	 *
1686
-	 * @return \OCP\LDAP\ILDAPProvider
1687
-	 */
1688
-	public function getLDAPProvider() {
1689
-		return $this->query('LDAPProvider');
1690
-	}
1691
-
1692
-	/**
1693
-	 * @return \OCP\Settings\IManager
1694
-	 */
1695
-	public function getSettingsManager() {
1696
-		return $this->query('SettingsManager');
1697
-	}
1698
-
1699
-	/**
1700
-	 * @return \OCP\Files\IAppData
1701
-	 */
1702
-	public function getAppDataDir($app) {
1703
-		/** @var \OC\Files\AppData\Factory $factory */
1704
-		$factory = $this->query(\OC\Files\AppData\Factory::class);
1705
-		return $factory->get($app);
1706
-	}
1707
-
1708
-	/**
1709
-	 * @return \OCP\Lockdown\ILockdownManager
1710
-	 */
1711
-	public function getLockdownManager() {
1712
-		return $this->query('LockdownManager');
1713
-	}
1714
-
1715
-	/**
1716
-	 * @return \OCP\Federation\ICloudIdManager
1717
-	 */
1718
-	public function getCloudIdManager() {
1719
-		return $this->query(ICloudIdManager::class);
1720
-	}
817
+            $prefixes = \OC::$composerAutoloader->getPrefixesPsr4();
818
+            if (isset($prefixes['OCA\\Theming\\'])) {
819
+                $classExists = true;
820
+            } else {
821
+                $classExists = false;
822
+            }
823
+
824
+            if ($classExists && $c->getConfig()->getSystemValue('installed', false) && $c->getAppManager()->isInstalled('theming')) {
825
+                return new ThemingDefaults(
826
+                    $c->getConfig(),
827
+                    $c->getL10N('theming'),
828
+                    $c->getURLGenerator(),
829
+                    new \OC_Defaults(),
830
+                    $c->getAppDataDir('theming'),
831
+                    $c->getMemCacheFactory(),
832
+                    new Util($c->getConfig(), $this->getRootFolder(), $this->getAppManager())
833
+                );
834
+            }
835
+            return new \OC_Defaults();
836
+        });
837
+        $this->registerService(SCSSCacher::class, function(Server $c) {
838
+            /** @var Factory $cacheFactory */
839
+            $cacheFactory = $c->query(Factory::class);
840
+            return new SCSSCacher(
841
+                $c->getLogger(),
842
+                $c->query(\OC\Files\AppData\Factory::class),
843
+                $c->getURLGenerator(),
844
+                $c->getConfig(),
845
+                $c->getThemingDefaults(),
846
+                \OC::$SERVERROOT,
847
+                $cacheFactory->createLocal('SCSS')
848
+
849
+            );
850
+        });
851
+        $this->registerService(EventDispatcher::class, function () {
852
+            return new EventDispatcher();
853
+        });
854
+        $this->registerAlias('EventDispatcher', EventDispatcher::class);
855
+        $this->registerAlias(EventDispatcherInterface::class, EventDispatcher::class);
856
+
857
+        $this->registerService('CryptoWrapper', function (Server $c) {
858
+            // FIXME: Instantiiated here due to cyclic dependency
859
+            $request = new Request(
860
+                [
861
+                    'get' => $_GET,
862
+                    'post' => $_POST,
863
+                    'files' => $_FILES,
864
+                    'server' => $_SERVER,
865
+                    'env' => $_ENV,
866
+                    'cookies' => $_COOKIE,
867
+                    'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD']))
868
+                        ? $_SERVER['REQUEST_METHOD']
869
+                        : null,
870
+                ],
871
+                $c->getSecureRandom(),
872
+                $c->getConfig()
873
+            );
874
+
875
+            return new CryptoWrapper(
876
+                $c->getConfig(),
877
+                $c->getCrypto(),
878
+                $c->getSecureRandom(),
879
+                $request
880
+            );
881
+        });
882
+        $this->registerService('CsrfTokenManager', function (Server $c) {
883
+            $tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom());
884
+
885
+            return new CsrfTokenManager(
886
+                $tokenGenerator,
887
+                $c->query(SessionStorage::class)
888
+            );
889
+        });
890
+        $this->registerService(SessionStorage::class, function (Server $c) {
891
+            return new SessionStorage($c->getSession());
892
+        });
893
+        $this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function (Server $c) {
894
+            return new ContentSecurityPolicyManager();
895
+        });
896
+        $this->registerAlias('ContentSecurityPolicyManager', \OCP\Security\IContentSecurityPolicyManager::class);
897
+
898
+        $this->registerService('ContentSecurityPolicyNonceManager', function(Server $c) {
899
+            return new ContentSecurityPolicyNonceManager(
900
+                $c->getCsrfTokenManager(),
901
+                $c->getRequest()
902
+            );
903
+        });
904
+
905
+        $this->registerService(\OCP\Share\IManager::class, function(Server $c) {
906
+            $config = $c->getConfig();
907
+            $factoryClass = $config->getSystemValue('sharing.managerFactory', '\OC\Share20\ProviderFactory');
908
+            /** @var \OCP\Share\IProviderFactory $factory */
909
+            $factory = new $factoryClass($this);
910
+
911
+            $manager = new \OC\Share20\Manager(
912
+                $c->getLogger(),
913
+                $c->getConfig(),
914
+                $c->getSecureRandom(),
915
+                $c->getHasher(),
916
+                $c->getMountManager(),
917
+                $c->getGroupManager(),
918
+                $c->getL10N('core'),
919
+                $factory,
920
+                $c->getUserManager(),
921
+                $c->getLazyRootFolder(),
922
+                $c->getEventDispatcher()
923
+            );
924
+
925
+            return $manager;
926
+        });
927
+        $this->registerAlias('ShareManager', \OCP\Share\IManager::class);
928
+
929
+        $this->registerService('SettingsManager', function(Server $c) {
930
+            $manager = new \OC\Settings\Manager(
931
+                $c->getLogger(),
932
+                $c->getDatabaseConnection(),
933
+                $c->getL10N('lib'),
934
+                $c->getConfig(),
935
+                $c->getEncryptionManager(),
936
+                $c->getUserManager(),
937
+                $c->getLockingProvider(),
938
+                $c->getRequest(),
939
+                new \OC\Settings\Mapper($c->getDatabaseConnection()),
940
+                $c->getURLGenerator()
941
+            );
942
+            return $manager;
943
+        });
944
+        $this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) {
945
+            return new \OC\Files\AppData\Factory(
946
+                $c->getRootFolder(),
947
+                $c->getSystemConfig()
948
+            );
949
+        });
950
+
951
+        $this->registerService('LockdownManager', function (Server $c) {
952
+            return new LockdownManager();
953
+        });
954
+
955
+        $this->registerService(ICloudIdManager::class, function (Server $c) {
956
+            return new CloudIdManager();
957
+        });
958
+
959
+        /* To trick DI since we don't extend the DIContainer here */
960
+        $this->registerService(CleanPreviewsBackgroundJob::class, function (Server $c) {
961
+            return new CleanPreviewsBackgroundJob(
962
+                $c->getRootFolder(),
963
+                $c->getLogger(),
964
+                $c->getJobList(),
965
+                new TimeFactory()
966
+            );
967
+        });
968
+
969
+        $this->registerAlias(\OCP\AppFramework\Utility\IControllerMethodReflector::class, \OC\AppFramework\Utility\ControllerMethodReflector::class);
970
+        $this->registerAlias('ControllerMethodReflector', \OCP\AppFramework\Utility\IControllerMethodReflector::class);
971
+
972
+        $this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class);
973
+        $this->registerAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class);
974
+
975
+        $this->registerService(\OCP\ISession::class, function(SimpleContainer $c) {
976
+            return $c->query(\OCP\IUserSession::class)->getSession();
977
+        });
978
+    }
979
+
980
+    /**
981
+     * @return \OCP\Contacts\IManager
982
+     */
983
+    public function getContactsManager() {
984
+        return $this->query('ContactsManager');
985
+    }
986
+
987
+    /**
988
+     * @return \OC\Encryption\Manager
989
+     */
990
+    public function getEncryptionManager() {
991
+        return $this->query('EncryptionManager');
992
+    }
993
+
994
+    /**
995
+     * @return \OC\Encryption\File
996
+     */
997
+    public function getEncryptionFilesHelper() {
998
+        return $this->query('EncryptionFileHelper');
999
+    }
1000
+
1001
+    /**
1002
+     * @return \OCP\Encryption\Keys\IStorage
1003
+     */
1004
+    public function getEncryptionKeyStorage() {
1005
+        return $this->query('EncryptionKeyStorage');
1006
+    }
1007
+
1008
+    /**
1009
+     * The current request object holding all information about the request
1010
+     * currently being processed is returned from this method.
1011
+     * In case the current execution was not initiated by a web request null is returned
1012
+     *
1013
+     * @return \OCP\IRequest
1014
+     */
1015
+    public function getRequest() {
1016
+        return $this->query('Request');
1017
+    }
1018
+
1019
+    /**
1020
+     * Returns the preview manager which can create preview images for a given file
1021
+     *
1022
+     * @return \OCP\IPreview
1023
+     */
1024
+    public function getPreviewManager() {
1025
+        return $this->query('PreviewManager');
1026
+    }
1027
+
1028
+    /**
1029
+     * Returns the tag manager which can get and set tags for different object types
1030
+     *
1031
+     * @see \OCP\ITagManager::load()
1032
+     * @return \OCP\ITagManager
1033
+     */
1034
+    public function getTagManager() {
1035
+        return $this->query('TagManager');
1036
+    }
1037
+
1038
+    /**
1039
+     * Returns the system-tag manager
1040
+     *
1041
+     * @return \OCP\SystemTag\ISystemTagManager
1042
+     *
1043
+     * @since 9.0.0
1044
+     */
1045
+    public function getSystemTagManager() {
1046
+        return $this->query('SystemTagManager');
1047
+    }
1048
+
1049
+    /**
1050
+     * Returns the system-tag object mapper
1051
+     *
1052
+     * @return \OCP\SystemTag\ISystemTagObjectMapper
1053
+     *
1054
+     * @since 9.0.0
1055
+     */
1056
+    public function getSystemTagObjectMapper() {
1057
+        return $this->query('SystemTagObjectMapper');
1058
+    }
1059
+
1060
+    /**
1061
+     * Returns the avatar manager, used for avatar functionality
1062
+     *
1063
+     * @return \OCP\IAvatarManager
1064
+     */
1065
+    public function getAvatarManager() {
1066
+        return $this->query('AvatarManager');
1067
+    }
1068
+
1069
+    /**
1070
+     * Returns the root folder of ownCloud's data directory
1071
+     *
1072
+     * @return \OCP\Files\IRootFolder
1073
+     */
1074
+    public function getRootFolder() {
1075
+        return $this->query('LazyRootFolder');
1076
+    }
1077
+
1078
+    /**
1079
+     * Returns the root folder of ownCloud's data directory
1080
+     * This is the lazy variant so this gets only initialized once it
1081
+     * is actually used.
1082
+     *
1083
+     * @return \OCP\Files\IRootFolder
1084
+     */
1085
+    public function getLazyRootFolder() {
1086
+        return $this->query('LazyRootFolder');
1087
+    }
1088
+
1089
+    /**
1090
+     * Returns a view to ownCloud's files folder
1091
+     *
1092
+     * @param string $userId user ID
1093
+     * @return \OCP\Files\Folder|null
1094
+     */
1095
+    public function getUserFolder($userId = null) {
1096
+        if ($userId === null) {
1097
+            $user = $this->getUserSession()->getUser();
1098
+            if (!$user) {
1099
+                return null;
1100
+            }
1101
+            $userId = $user->getUID();
1102
+        }
1103
+        $root = $this->getRootFolder();
1104
+        return $root->getUserFolder($userId);
1105
+    }
1106
+
1107
+    /**
1108
+     * Returns an app-specific view in ownClouds data directory
1109
+     *
1110
+     * @return \OCP\Files\Folder
1111
+     * @deprecated since 9.2.0 use IAppData
1112
+     */
1113
+    public function getAppFolder() {
1114
+        $dir = '/' . \OC_App::getCurrentApp();
1115
+        $root = $this->getRootFolder();
1116
+        if (!$root->nodeExists($dir)) {
1117
+            $folder = $root->newFolder($dir);
1118
+        } else {
1119
+            $folder = $root->get($dir);
1120
+        }
1121
+        return $folder;
1122
+    }
1123
+
1124
+    /**
1125
+     * @return \OC\User\Manager
1126
+     */
1127
+    public function getUserManager() {
1128
+        return $this->query('UserManager');
1129
+    }
1130
+
1131
+    /**
1132
+     * @return \OC\Group\Manager
1133
+     */
1134
+    public function getGroupManager() {
1135
+        return $this->query('GroupManager');
1136
+    }
1137
+
1138
+    /**
1139
+     * @return \OC\User\Session
1140
+     */
1141
+    public function getUserSession() {
1142
+        return $this->query('UserSession');
1143
+    }
1144
+
1145
+    /**
1146
+     * @return \OCP\ISession
1147
+     */
1148
+    public function getSession() {
1149
+        return $this->query('UserSession')->getSession();
1150
+    }
1151
+
1152
+    /**
1153
+     * @param \OCP\ISession $session
1154
+     */
1155
+    public function setSession(\OCP\ISession $session) {
1156
+        $this->query(SessionStorage::class)->setSession($session);
1157
+        $this->query('UserSession')->setSession($session);
1158
+        $this->query(Store::class)->setSession($session);
1159
+    }
1160
+
1161
+    /**
1162
+     * @return \OC\Authentication\TwoFactorAuth\Manager
1163
+     */
1164
+    public function getTwoFactorAuthManager() {
1165
+        return $this->query('\OC\Authentication\TwoFactorAuth\Manager');
1166
+    }
1167
+
1168
+    /**
1169
+     * @return \OC\NavigationManager
1170
+     */
1171
+    public function getNavigationManager() {
1172
+        return $this->query('NavigationManager');
1173
+    }
1174
+
1175
+    /**
1176
+     * @return \OCP\IConfig
1177
+     */
1178
+    public function getConfig() {
1179
+        return $this->query('AllConfig');
1180
+    }
1181
+
1182
+    /**
1183
+     * @internal For internal use only
1184
+     * @return \OC\SystemConfig
1185
+     */
1186
+    public function getSystemConfig() {
1187
+        return $this->query('SystemConfig');
1188
+    }
1189
+
1190
+    /**
1191
+     * Returns the app config manager
1192
+     *
1193
+     * @return \OCP\IAppConfig
1194
+     */
1195
+    public function getAppConfig() {
1196
+        return $this->query('AppConfig');
1197
+    }
1198
+
1199
+    /**
1200
+     * @return \OCP\L10N\IFactory
1201
+     */
1202
+    public function getL10NFactory() {
1203
+        return $this->query('L10NFactory');
1204
+    }
1205
+
1206
+    /**
1207
+     * get an L10N instance
1208
+     *
1209
+     * @param string $app appid
1210
+     * @param string $lang
1211
+     * @return IL10N
1212
+     */
1213
+    public function getL10N($app, $lang = null) {
1214
+        return $this->getL10NFactory()->get($app, $lang);
1215
+    }
1216
+
1217
+    /**
1218
+     * @return \OCP\IURLGenerator
1219
+     */
1220
+    public function getURLGenerator() {
1221
+        return $this->query('URLGenerator');
1222
+    }
1223
+
1224
+    /**
1225
+     * @return \OCP\IHelper
1226
+     */
1227
+    public function getHelper() {
1228
+        return $this->query('AppHelper');
1229
+    }
1230
+
1231
+    /**
1232
+     * @return AppFetcher
1233
+     */
1234
+    public function getAppFetcher() {
1235
+        return $this->query('AppFetcher');
1236
+    }
1237
+
1238
+    /**
1239
+     * Returns an ICache instance. Since 8.1.0 it returns a fake cache. Use
1240
+     * getMemCacheFactory() instead.
1241
+     *
1242
+     * @return \OCP\ICache
1243
+     * @deprecated 8.1.0 use getMemCacheFactory to obtain a proper cache
1244
+     */
1245
+    public function getCache() {
1246
+        return $this->query('UserCache');
1247
+    }
1248
+
1249
+    /**
1250
+     * Returns an \OCP\CacheFactory instance
1251
+     *
1252
+     * @return \OCP\ICacheFactory
1253
+     */
1254
+    public function getMemCacheFactory() {
1255
+        return $this->query('MemCacheFactory');
1256
+    }
1257
+
1258
+    /**
1259
+     * Returns an \OC\RedisFactory instance
1260
+     *
1261
+     * @return \OC\RedisFactory
1262
+     */
1263
+    public function getGetRedisFactory() {
1264
+        return $this->query('RedisFactory');
1265
+    }
1266
+
1267
+
1268
+    /**
1269
+     * Returns the current session
1270
+     *
1271
+     * @return \OCP\IDBConnection
1272
+     */
1273
+    public function getDatabaseConnection() {
1274
+        return $this->query('DatabaseConnection');
1275
+    }
1276
+
1277
+    /**
1278
+     * Returns the activity manager
1279
+     *
1280
+     * @return \OCP\Activity\IManager
1281
+     */
1282
+    public function getActivityManager() {
1283
+        return $this->query('ActivityManager');
1284
+    }
1285
+
1286
+    /**
1287
+     * Returns an job list for controlling background jobs
1288
+     *
1289
+     * @return \OCP\BackgroundJob\IJobList
1290
+     */
1291
+    public function getJobList() {
1292
+        return $this->query('JobList');
1293
+    }
1294
+
1295
+    /**
1296
+     * Returns a logger instance
1297
+     *
1298
+     * @return \OCP\ILogger
1299
+     */
1300
+    public function getLogger() {
1301
+        return $this->query('Logger');
1302
+    }
1303
+
1304
+    /**
1305
+     * Returns a router for generating and matching urls
1306
+     *
1307
+     * @return \OCP\Route\IRouter
1308
+     */
1309
+    public function getRouter() {
1310
+        return $this->query('Router');
1311
+    }
1312
+
1313
+    /**
1314
+     * Returns a search instance
1315
+     *
1316
+     * @return \OCP\ISearch
1317
+     */
1318
+    public function getSearch() {
1319
+        return $this->query('Search');
1320
+    }
1321
+
1322
+    /**
1323
+     * Returns a SecureRandom instance
1324
+     *
1325
+     * @return \OCP\Security\ISecureRandom
1326
+     */
1327
+    public function getSecureRandom() {
1328
+        return $this->query('SecureRandom');
1329
+    }
1330
+
1331
+    /**
1332
+     * Returns a Crypto instance
1333
+     *
1334
+     * @return \OCP\Security\ICrypto
1335
+     */
1336
+    public function getCrypto() {
1337
+        return $this->query('Crypto');
1338
+    }
1339
+
1340
+    /**
1341
+     * Returns a Hasher instance
1342
+     *
1343
+     * @return \OCP\Security\IHasher
1344
+     */
1345
+    public function getHasher() {
1346
+        return $this->query('Hasher');
1347
+    }
1348
+
1349
+    /**
1350
+     * Returns a CredentialsManager instance
1351
+     *
1352
+     * @return \OCP\Security\ICredentialsManager
1353
+     */
1354
+    public function getCredentialsManager() {
1355
+        return $this->query('CredentialsManager');
1356
+    }
1357
+
1358
+    /**
1359
+     * Returns an instance of the HTTP helper class
1360
+     *
1361
+     * @deprecated Use getHTTPClientService()
1362
+     * @return \OC\HTTPHelper
1363
+     */
1364
+    public function getHTTPHelper() {
1365
+        return $this->query('HTTPHelper');
1366
+    }
1367
+
1368
+    /**
1369
+     * Get the certificate manager for the user
1370
+     *
1371
+     * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager
1372
+     * @return \OCP\ICertificateManager | null if $uid is null and no user is logged in
1373
+     */
1374
+    public function getCertificateManager($userId = '') {
1375
+        if ($userId === '') {
1376
+            $userSession = $this->getUserSession();
1377
+            $user = $userSession->getUser();
1378
+            if (is_null($user)) {
1379
+                return null;
1380
+            }
1381
+            $userId = $user->getUID();
1382
+        }
1383
+        return new CertificateManager($userId, new View(), $this->getConfig(), $this->getLogger());
1384
+    }
1385
+
1386
+    /**
1387
+     * Returns an instance of the HTTP client service
1388
+     *
1389
+     * @return \OCP\Http\Client\IClientService
1390
+     */
1391
+    public function getHTTPClientService() {
1392
+        return $this->query('HttpClientService');
1393
+    }
1394
+
1395
+    /**
1396
+     * Create a new event source
1397
+     *
1398
+     * @return \OCP\IEventSource
1399
+     */
1400
+    public function createEventSource() {
1401
+        return new \OC_EventSource();
1402
+    }
1403
+
1404
+    /**
1405
+     * Get the active event logger
1406
+     *
1407
+     * The returned logger only logs data when debug mode is enabled
1408
+     *
1409
+     * @return \OCP\Diagnostics\IEventLogger
1410
+     */
1411
+    public function getEventLogger() {
1412
+        return $this->query('EventLogger');
1413
+    }
1414
+
1415
+    /**
1416
+     * Get the active query logger
1417
+     *
1418
+     * The returned logger only logs data when debug mode is enabled
1419
+     *
1420
+     * @return \OCP\Diagnostics\IQueryLogger
1421
+     */
1422
+    public function getQueryLogger() {
1423
+        return $this->query('QueryLogger');
1424
+    }
1425
+
1426
+    /**
1427
+     * Get the manager for temporary files and folders
1428
+     *
1429
+     * @return \OCP\ITempManager
1430
+     */
1431
+    public function getTempManager() {
1432
+        return $this->query('TempManager');
1433
+    }
1434
+
1435
+    /**
1436
+     * Get the app manager
1437
+     *
1438
+     * @return \OCP\App\IAppManager
1439
+     */
1440
+    public function getAppManager() {
1441
+        return $this->query('AppManager');
1442
+    }
1443
+
1444
+    /**
1445
+     * Creates a new mailer
1446
+     *
1447
+     * @return \OCP\Mail\IMailer
1448
+     */
1449
+    public function getMailer() {
1450
+        return $this->query('Mailer');
1451
+    }
1452
+
1453
+    /**
1454
+     * Get the webroot
1455
+     *
1456
+     * @return string
1457
+     */
1458
+    public function getWebRoot() {
1459
+        return $this->webRoot;
1460
+    }
1461
+
1462
+    /**
1463
+     * @return \OC\OCSClient
1464
+     */
1465
+    public function getOcsClient() {
1466
+        return $this->query('OcsClient');
1467
+    }
1468
+
1469
+    /**
1470
+     * @return \OCP\IDateTimeZone
1471
+     */
1472
+    public function getDateTimeZone() {
1473
+        return $this->query('DateTimeZone');
1474
+    }
1475
+
1476
+    /**
1477
+     * @return \OCP\IDateTimeFormatter
1478
+     */
1479
+    public function getDateTimeFormatter() {
1480
+        return $this->query('DateTimeFormatter');
1481
+    }
1482
+
1483
+    /**
1484
+     * @return \OCP\Files\Config\IMountProviderCollection
1485
+     */
1486
+    public function getMountProviderCollection() {
1487
+        return $this->query('MountConfigManager');
1488
+    }
1489
+
1490
+    /**
1491
+     * Get the IniWrapper
1492
+     *
1493
+     * @return IniGetWrapper
1494
+     */
1495
+    public function getIniWrapper() {
1496
+        return $this->query('IniWrapper');
1497
+    }
1498
+
1499
+    /**
1500
+     * @return \OCP\Command\IBus
1501
+     */
1502
+    public function getCommandBus() {
1503
+        return $this->query('AsyncCommandBus');
1504
+    }
1505
+
1506
+    /**
1507
+     * Get the trusted domain helper
1508
+     *
1509
+     * @return TrustedDomainHelper
1510
+     */
1511
+    public function getTrustedDomainHelper() {
1512
+        return $this->query('TrustedDomainHelper');
1513
+    }
1514
+
1515
+    /**
1516
+     * Get the locking provider
1517
+     *
1518
+     * @return \OCP\Lock\ILockingProvider
1519
+     * @since 8.1.0
1520
+     */
1521
+    public function getLockingProvider() {
1522
+        return $this->query('LockingProvider');
1523
+    }
1524
+
1525
+    /**
1526
+     * @return \OCP\Files\Mount\IMountManager
1527
+     **/
1528
+    function getMountManager() {
1529
+        return $this->query('MountManager');
1530
+    }
1531
+
1532
+    /** @return \OCP\Files\Config\IUserMountCache */
1533
+    function getUserMountCache() {
1534
+        return $this->query('UserMountCache');
1535
+    }
1536
+
1537
+    /**
1538
+     * Get the MimeTypeDetector
1539
+     *
1540
+     * @return \OCP\Files\IMimeTypeDetector
1541
+     */
1542
+    public function getMimeTypeDetector() {
1543
+        return $this->query('MimeTypeDetector');
1544
+    }
1545
+
1546
+    /**
1547
+     * Get the MimeTypeLoader
1548
+     *
1549
+     * @return \OCP\Files\IMimeTypeLoader
1550
+     */
1551
+    public function getMimeTypeLoader() {
1552
+        return $this->query('MimeTypeLoader');
1553
+    }
1554
+
1555
+    /**
1556
+     * Get the manager of all the capabilities
1557
+     *
1558
+     * @return \OC\CapabilitiesManager
1559
+     */
1560
+    public function getCapabilitiesManager() {
1561
+        return $this->query('CapabilitiesManager');
1562
+    }
1563
+
1564
+    /**
1565
+     * Get the EventDispatcher
1566
+     *
1567
+     * @return EventDispatcherInterface
1568
+     * @since 8.2.0
1569
+     */
1570
+    public function getEventDispatcher() {
1571
+        return $this->query('EventDispatcher');
1572
+    }
1573
+
1574
+    /**
1575
+     * Get the Notification Manager
1576
+     *
1577
+     * @return \OCP\Notification\IManager
1578
+     * @since 8.2.0
1579
+     */
1580
+    public function getNotificationManager() {
1581
+        return $this->query('NotificationManager');
1582
+    }
1583
+
1584
+    /**
1585
+     * @return \OCP\Comments\ICommentsManager
1586
+     */
1587
+    public function getCommentsManager() {
1588
+        return $this->query('CommentsManager');
1589
+    }
1590
+
1591
+    /**
1592
+     * @return \OC_Defaults
1593
+     */
1594
+    public function getThemingDefaults() {
1595
+        return $this->query('ThemingDefaults');
1596
+    }
1597
+
1598
+    /**
1599
+     * @return \OC\IntegrityCheck\Checker
1600
+     */
1601
+    public function getIntegrityCodeChecker() {
1602
+        return $this->query('IntegrityCodeChecker');
1603
+    }
1604
+
1605
+    /**
1606
+     * @return \OC\Session\CryptoWrapper
1607
+     */
1608
+    public function getSessionCryptoWrapper() {
1609
+        return $this->query('CryptoWrapper');
1610
+    }
1611
+
1612
+    /**
1613
+     * @return CsrfTokenManager
1614
+     */
1615
+    public function getCsrfTokenManager() {
1616
+        return $this->query('CsrfTokenManager');
1617
+    }
1618
+
1619
+    /**
1620
+     * @return Throttler
1621
+     */
1622
+    public function getBruteForceThrottler() {
1623
+        return $this->query('Throttler');
1624
+    }
1625
+
1626
+    /**
1627
+     * @return IContentSecurityPolicyManager
1628
+     */
1629
+    public function getContentSecurityPolicyManager() {
1630
+        return $this->query('ContentSecurityPolicyManager');
1631
+    }
1632
+
1633
+    /**
1634
+     * @return ContentSecurityPolicyNonceManager
1635
+     */
1636
+    public function getContentSecurityPolicyNonceManager() {
1637
+        return $this->query('ContentSecurityPolicyNonceManager');
1638
+    }
1639
+
1640
+    /**
1641
+     * Not a public API as of 8.2, wait for 9.0
1642
+     *
1643
+     * @return \OCA\Files_External\Service\BackendService
1644
+     */
1645
+    public function getStoragesBackendService() {
1646
+        return $this->query('OCA\\Files_External\\Service\\BackendService');
1647
+    }
1648
+
1649
+    /**
1650
+     * Not a public API as of 8.2, wait for 9.0
1651
+     *
1652
+     * @return \OCA\Files_External\Service\GlobalStoragesService
1653
+     */
1654
+    public function getGlobalStoragesService() {
1655
+        return $this->query('OCA\\Files_External\\Service\\GlobalStoragesService');
1656
+    }
1657
+
1658
+    /**
1659
+     * Not a public API as of 8.2, wait for 9.0
1660
+     *
1661
+     * @return \OCA\Files_External\Service\UserGlobalStoragesService
1662
+     */
1663
+    public function getUserGlobalStoragesService() {
1664
+        return $this->query('OCA\\Files_External\\Service\\UserGlobalStoragesService');
1665
+    }
1666
+
1667
+    /**
1668
+     * Not a public API as of 8.2, wait for 9.0
1669
+     *
1670
+     * @return \OCA\Files_External\Service\UserStoragesService
1671
+     */
1672
+    public function getUserStoragesService() {
1673
+        return $this->query('OCA\\Files_External\\Service\\UserStoragesService');
1674
+    }
1675
+
1676
+    /**
1677
+     * @return \OCP\Share\IManager
1678
+     */
1679
+    public function getShareManager() {
1680
+        return $this->query('ShareManager');
1681
+    }
1682
+
1683
+    /**
1684
+     * Returns the LDAP Provider
1685
+     *
1686
+     * @return \OCP\LDAP\ILDAPProvider
1687
+     */
1688
+    public function getLDAPProvider() {
1689
+        return $this->query('LDAPProvider');
1690
+    }
1691
+
1692
+    /**
1693
+     * @return \OCP\Settings\IManager
1694
+     */
1695
+    public function getSettingsManager() {
1696
+        return $this->query('SettingsManager');
1697
+    }
1698
+
1699
+    /**
1700
+     * @return \OCP\Files\IAppData
1701
+     */
1702
+    public function getAppDataDir($app) {
1703
+        /** @var \OC\Files\AppData\Factory $factory */
1704
+        $factory = $this->query(\OC\Files\AppData\Factory::class);
1705
+        return $factory->get($app);
1706
+    }
1707
+
1708
+    /**
1709
+     * @return \OCP\Lockdown\ILockdownManager
1710
+     */
1711
+    public function getLockdownManager() {
1712
+        return $this->query('LockdownManager');
1713
+    }
1714
+
1715
+    /**
1716
+     * @return \OCP\Federation\ICloudIdManager
1717
+     */
1718
+    public function getCloudIdManager() {
1719
+        return $this->query(ICloudIdManager::class);
1720
+    }
1721 1721
 }
Please login to merge, or discard this patch.
Spacing   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 		$this->registerAlias(\OCP\Contacts\IManager::class, \OC\ContactsManager::class);
134 134
 		$this->registerAlias('ContactsManager', \OCP\Contacts\IManager::class);
135 135
 
136
-		$this->registerService(\OCP\IPreview::class, function (Server $c) {
136
+		$this->registerService(\OCP\IPreview::class, function(Server $c) {
137 137
 			return new PreviewManager(
138 138
 				$c->getConfig(),
139 139
 				$c->getRootFolder(),
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 		});
145 145
 		$this->registerAlias('PreviewManager', \OCP\IPreview::class);
146 146
 
147
-		$this->registerService(\OC\Preview\Watcher::class, function (Server $c) {
147
+		$this->registerService(\OC\Preview\Watcher::class, function(Server $c) {
148 148
 			return new \OC\Preview\Watcher(
149 149
 				$c->getAppDataDir('preview')
150 150
 			);
151 151
 		});
152 152
 
153
-		$this->registerService('EncryptionManager', function (Server $c) {
153
+		$this->registerService('EncryptionManager', function(Server $c) {
154 154
 			$view = new View();
155 155
 			$util = new Encryption\Util(
156 156
 				$view,
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 			);
169 169
 		});
170 170
 
171
-		$this->registerService('EncryptionFileHelper', function (Server $c) {
171
+		$this->registerService('EncryptionFileHelper', function(Server $c) {
172 172
 			$util = new Encryption\Util(
173 173
 				new View(),
174 174
 				$c->getUserManager(),
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 			return new Encryption\File($util);
179 179
 		});
180 180
 
181
-		$this->registerService('EncryptionKeyStorage', function (Server $c) {
181
+		$this->registerService('EncryptionKeyStorage', function(Server $c) {
182 182
 			$view = new View();
183 183
 			$util = new Encryption\Util(
184 184
 				$view,
@@ -189,32 +189,32 @@  discard block
 block discarded – undo
189 189
 
190 190
 			return new Encryption\Keys\Storage($view, $util);
191 191
 		});
192
-		$this->registerService('TagMapper', function (Server $c) {
192
+		$this->registerService('TagMapper', function(Server $c) {
193 193
 			return new TagMapper($c->getDatabaseConnection());
194 194
 		});
195 195
 
196
-		$this->registerService(\OCP\ITagManager::class, function (Server $c) {
196
+		$this->registerService(\OCP\ITagManager::class, function(Server $c) {
197 197
 			$tagMapper = $c->query('TagMapper');
198 198
 			return new TagManager($tagMapper, $c->getUserSession());
199 199
 		});
200 200
 		$this->registerAlias('TagManager', \OCP\ITagManager::class);
201 201
 
202
-		$this->registerService('SystemTagManagerFactory', function (Server $c) {
202
+		$this->registerService('SystemTagManagerFactory', function(Server $c) {
203 203
 			$config = $c->getConfig();
204 204
 			$factoryClass = $config->getSystemValue('systemtags.managerFactory', '\OC\SystemTag\ManagerFactory');
205 205
 			/** @var \OC\SystemTag\ManagerFactory $factory */
206 206
 			$factory = new $factoryClass($this);
207 207
 			return $factory;
208 208
 		});
209
-		$this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) {
209
+		$this->registerService(\OCP\SystemTag\ISystemTagManager::class, function(Server $c) {
210 210
 			return $c->query('SystemTagManagerFactory')->getManager();
211 211
 		});
212 212
 		$this->registerAlias('SystemTagManager', \OCP\SystemTag\ISystemTagManager::class);
213 213
 
214
-		$this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function (Server $c) {
214
+		$this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function(Server $c) {
215 215
 			return $c->query('SystemTagManagerFactory')->getObjectMapper();
216 216
 		});
217
-		$this->registerService('RootFolder', function (Server $c) {
217
+		$this->registerService('RootFolder', function(Server $c) {
218 218
 			$manager = \OC\Files\Filesystem::getMountManager(null);
219 219
 			$view = new View();
220 220
 			$root = new Root(
@@ -242,30 +242,30 @@  discard block
 block discarded – undo
242 242
 		});
243 243
 		$this->registerAlias('LazyRootFolder', \OCP\Files\IRootFolder::class);
244 244
 
245
-		$this->registerService(\OCP\IUserManager::class, function (Server $c) {
245
+		$this->registerService(\OCP\IUserManager::class, function(Server $c) {
246 246
 			$config = $c->getConfig();
247 247
 			return new \OC\User\Manager($config);
248 248
 		});
249 249
 		$this->registerAlias('UserManager', \OCP\IUserManager::class);
250 250
 
251
-		$this->registerService(\OCP\IGroupManager::class, function (Server $c) {
251
+		$this->registerService(\OCP\IGroupManager::class, function(Server $c) {
252 252
 			$groupManager = new \OC\Group\Manager($this->getUserManager(), $this->getLogger());
253
-			$groupManager->listen('\OC\Group', 'preCreate', function ($gid) {
253
+			$groupManager->listen('\OC\Group', 'preCreate', function($gid) {
254 254
 				\OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid));
255 255
 			});
256
-			$groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) {
256
+			$groupManager->listen('\OC\Group', 'postCreate', function(\OC\Group\Group $gid) {
257 257
 				\OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID()));
258 258
 			});
259
-			$groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) {
259
+			$groupManager->listen('\OC\Group', 'preDelete', function(\OC\Group\Group $group) {
260 260
 				\OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID()));
261 261
 			});
262
-			$groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) {
262
+			$groupManager->listen('\OC\Group', 'postDelete', function(\OC\Group\Group $group) {
263 263
 				\OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID()));
264 264
 			});
265
-			$groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
265
+			$groupManager->listen('\OC\Group', 'preAddUser', function(\OC\Group\Group $group, \OC\User\User $user) {
266 266
 				\OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID()));
267 267
 			});
268
-			$groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
268
+			$groupManager->listen('\OC\Group', 'postAddUser', function(\OC\Group\Group $group, \OC\User\User $user) {
269 269
 				\OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
270 270
 				//Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks
271 271
 				\OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
@@ -285,11 +285,11 @@  discard block
 block discarded – undo
285 285
 			return new Store($session, $logger, $tokenProvider);
286 286
 		});
287 287
 		$this->registerAlias(IStore::class, Store::class);
288
-		$this->registerService('OC\Authentication\Token\DefaultTokenMapper', function (Server $c) {
288
+		$this->registerService('OC\Authentication\Token\DefaultTokenMapper', function(Server $c) {
289 289
 			$dbConnection = $c->getDatabaseConnection();
290 290
 			return new Authentication\Token\DefaultTokenMapper($dbConnection);
291 291
 		});
292
-		$this->registerService('OC\Authentication\Token\DefaultTokenProvider', function (Server $c) {
292
+		$this->registerService('OC\Authentication\Token\DefaultTokenProvider', function(Server $c) {
293 293
 			$mapper = $c->query('OC\Authentication\Token\DefaultTokenMapper');
294 294
 			$crypto = $c->getCrypto();
295 295
 			$config = $c->getConfig();
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 		});
300 300
 		$this->registerAlias('OC\Authentication\Token\IProvider', 'OC\Authentication\Token\DefaultTokenProvider');
301 301
 
302
-		$this->registerService(\OCP\IUserSession::class, function (Server $c) {
302
+		$this->registerService(\OCP\IUserSession::class, function(Server $c) {
303 303
 			$manager = $c->getUserManager();
304 304
 			$session = new \OC\Session\Memory('');
305 305
 			$timeFactory = new TimeFactory();
@@ -312,40 +312,40 @@  discard block
 block discarded – undo
312 312
 			}
313 313
 
314 314
 			$userSession = new \OC\User\Session($manager, $session, $timeFactory, $defaultTokenProvider, $c->getConfig(), $c->getSecureRandom());
315
-			$userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) {
315
+			$userSession->listen('\OC\User', 'preCreateUser', function($uid, $password) {
316 316
 				\OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password));
317 317
 			});
318
-			$userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) {
318
+			$userSession->listen('\OC\User', 'postCreateUser', function($user, $password) {
319 319
 				/** @var $user \OC\User\User */
320 320
 				\OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password));
321 321
 			});
322
-			$userSession->listen('\OC\User', 'preDelete', function ($user) {
322
+			$userSession->listen('\OC\User', 'preDelete', function($user) {
323 323
 				/** @var $user \OC\User\User */
324 324
 				\OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID()));
325 325
 			});
326
-			$userSession->listen('\OC\User', 'postDelete', function ($user) {
326
+			$userSession->listen('\OC\User', 'postDelete', function($user) {
327 327
 				/** @var $user \OC\User\User */
328 328
 				\OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID()));
329 329
 			});
330
-			$userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) {
330
+			$userSession->listen('\OC\User', 'preSetPassword', function($user, $password, $recoveryPassword) {
331 331
 				/** @var $user \OC\User\User */
332 332
 				\OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
333 333
 			});
334
-			$userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) {
334
+			$userSession->listen('\OC\User', 'postSetPassword', function($user, $password, $recoveryPassword) {
335 335
 				/** @var $user \OC\User\User */
336 336
 				\OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
337 337
 			});
338
-			$userSession->listen('\OC\User', 'preLogin', function ($uid, $password) {
338
+			$userSession->listen('\OC\User', 'preLogin', function($uid, $password) {
339 339
 				\OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password));
340 340
 			});
341
-			$userSession->listen('\OC\User', 'postLogin', function ($user, $password) {
341
+			$userSession->listen('\OC\User', 'postLogin', function($user, $password) {
342 342
 				/** @var $user \OC\User\User */
343 343
 				\OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password));
344 344
 			});
345
-			$userSession->listen('\OC\User', 'logout', function () {
345
+			$userSession->listen('\OC\User', 'logout', function() {
346 346
 				\OC_Hook::emit('OC_User', 'logout', array());
347 347
 			});
348
-			$userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value) {
348
+			$userSession->listen('\OC\User', 'changeUser', function($user, $feature, $value) {
349 349
 				/** @var $user \OC\User\User */
350 350
 				\OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value));
351 351
 			});
@@ -353,14 +353,14 @@  discard block
 block discarded – undo
353 353
 		});
354 354
 		$this->registerAlias('UserSession', \OCP\IUserSession::class);
355 355
 
356
-		$this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function (Server $c) {
356
+		$this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function(Server $c) {
357 357
 			return new \OC\Authentication\TwoFactorAuth\Manager($c->getAppManager(), $c->getSession(), $c->getConfig(), $c->getActivityManager(), $c->getLogger());
358 358
 		});
359 359
 
360 360
 		$this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class);
361 361
 		$this->registerAlias('NavigationManager', \OCP\INavigationManager::class);
362 362
 
363
-		$this->registerService(\OC\AllConfig::class, function (Server $c) {
363
+		$this->registerService(\OC\AllConfig::class, function(Server $c) {
364 364
 			return new \OC\AllConfig(
365 365
 				$c->getSystemConfig()
366 366
 			);
@@ -368,17 +368,17 @@  discard block
 block discarded – undo
368 368
 		$this->registerAlias('AllConfig', \OC\AllConfig::class);
369 369
 		$this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class);
370 370
 
371
-		$this->registerService('SystemConfig', function ($c) use ($config) {
371
+		$this->registerService('SystemConfig', function($c) use ($config) {
372 372
 			return new \OC\SystemConfig($config);
373 373
 		});
374 374
 
375
-		$this->registerService(\OC\AppConfig::class, function (Server $c) {
375
+		$this->registerService(\OC\AppConfig::class, function(Server $c) {
376 376
 			return new \OC\AppConfig($c->getDatabaseConnection());
377 377
 		});
378 378
 		$this->registerAlias('AppConfig', \OC\AppConfig::class);
379 379
 		$this->registerAlias(\OCP\IAppConfig::class, \OC\AppConfig::class);
380 380
 
381
-		$this->registerService(\OCP\L10N\IFactory::class, function (Server $c) {
381
+		$this->registerService(\OCP\L10N\IFactory::class, function(Server $c) {
382 382
 			return new \OC\L10N\Factory(
383 383
 				$c->getConfig(),
384 384
 				$c->getRequest(),
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 		});
389 389
 		$this->registerAlias('L10NFactory', \OCP\L10N\IFactory::class);
390 390
 
391
-		$this->registerService(\OCP\IURLGenerator::class, function (Server $c) {
391
+		$this->registerService(\OCP\IURLGenerator::class, function(Server $c) {
392 392
 			$config = $c->getConfig();
393 393
 			$cacheFactory = $c->getMemCacheFactory();
394 394
 			return new \OC\URLGenerator(
@@ -398,10 +398,10 @@  discard block
 block discarded – undo
398 398
 		});
399 399
 		$this->registerAlias('URLGenerator', \OCP\IURLGenerator::class);
400 400
 
401
-		$this->registerService('AppHelper', function ($c) {
401
+		$this->registerService('AppHelper', function($c) {
402 402
 			return new \OC\AppHelper();
403 403
 		});
404
-		$this->registerService('AppFetcher', function ($c) {
404
+		$this->registerService('AppFetcher', function($c) {
405 405
 			return new AppFetcher(
406 406
 				$this->getAppDataDir('appstore'),
407 407
 				$this->getHTTPClientService(),
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 				$this->getConfig()
410 410
 			);
411 411
 		});
412
-		$this->registerService('CategoryFetcher', function ($c) {
412
+		$this->registerService('CategoryFetcher', function($c) {
413 413
 			return new CategoryFetcher(
414 414
 				$this->getAppDataDir('appstore'),
415 415
 				$this->getHTTPClientService(),
@@ -418,21 +418,21 @@  discard block
 block discarded – undo
418 418
 			);
419 419
 		});
420 420
 
421
-		$this->registerService(\OCP\ICache::class, function ($c) {
421
+		$this->registerService(\OCP\ICache::class, function($c) {
422 422
 			return new Cache\File();
423 423
 		});
424 424
 		$this->registerAlias('UserCache', \OCP\ICache::class);
425 425
 
426
-		$this->registerService(Factory::class, function (Server $c) {
426
+		$this->registerService(Factory::class, function(Server $c) {
427 427
 			$config = $c->getConfig();
428 428
 
429 429
 			if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
430 430
 				$v = \OC_App::getAppVersions();
431
-				$v['core'] = md5(file_get_contents(\OC::$SERVERROOT . '/version.php'));
431
+				$v['core'] = md5(file_get_contents(\OC::$SERVERROOT.'/version.php'));
432 432
 				$version = implode(',', $v);
433 433
 				$instanceId = \OC_Util::getInstanceId();
434 434
 				$path = \OC::$SERVERROOT;
435
-				$prefix = md5($instanceId . '-' . $version . '-' . $path . '-' . \OC::$WEBROOT);
435
+				$prefix = md5($instanceId.'-'.$version.'-'.$path.'-'.\OC::$WEBROOT);
436 436
 				return new \OC\Memcache\Factory($prefix, $c->getLogger(),
437 437
 					$config->getSystemValue('memcache.local', null),
438 438
 					$config->getSystemValue('memcache.distributed', null),
@@ -449,12 +449,12 @@  discard block
 block discarded – undo
449 449
 		$this->registerAlias('MemCacheFactory', Factory::class);
450 450
 		$this->registerAlias(ICacheFactory::class, Factory::class);
451 451
 
452
-		$this->registerService('RedisFactory', function (Server $c) {
452
+		$this->registerService('RedisFactory', function(Server $c) {
453 453
 			$systemConfig = $c->getSystemConfig();
454 454
 			return new RedisFactory($systemConfig);
455 455
 		});
456 456
 
457
-		$this->registerService(\OCP\Activity\IManager::class, function (Server $c) {
457
+		$this->registerService(\OCP\Activity\IManager::class, function(Server $c) {
458 458
 			return new \OC\Activity\Manager(
459 459
 				$c->getRequest(),
460 460
 				$c->getUserSession(),
@@ -464,14 +464,14 @@  discard block
 block discarded – undo
464 464
 		});
465 465
 		$this->registerAlias('ActivityManager', \OCP\Activity\IManager::class);
466 466
 
467
-		$this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) {
467
+		$this->registerService(\OCP\Activity\IEventMerger::class, function(Server $c) {
468 468
 			return new \OC\Activity\EventMerger(
469 469
 				$c->getL10N('lib')
470 470
 			);
471 471
 		});
472 472
 		$this->registerAlias(IValidator::class, Validator::class);
473 473
 
474
-		$this->registerService(\OCP\IAvatarManager::class, function (Server $c) {
474
+		$this->registerService(\OCP\IAvatarManager::class, function(Server $c) {
475 475
 			return new AvatarManager(
476 476
 				$c->getUserManager(),
477 477
 				$c->getAppDataDir('avatar'),
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 		});
483 483
 		$this->registerAlias('AvatarManager', \OCP\IAvatarManager::class);
484 484
 
485
-		$this->registerService(\OCP\ILogger::class, function (Server $c) {
485
+		$this->registerService(\OCP\ILogger::class, function(Server $c) {
486 486
 			$logType = $c->query('AllConfig')->getSystemValue('log_type', 'file');
487 487
 			$logger = Log::getLogClass($logType);
488 488
 			call_user_func(array($logger, 'init'));
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 		});
492 492
 		$this->registerAlias('Logger', \OCP\ILogger::class);
493 493
 
494
-		$this->registerService(\OCP\BackgroundJob\IJobList::class, function (Server $c) {
494
+		$this->registerService(\OCP\BackgroundJob\IJobList::class, function(Server $c) {
495 495
 			$config = $c->getConfig();
496 496
 			return new \OC\BackgroundJob\JobList(
497 497
 				$c->getDatabaseConnection(),
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 		});
502 502
 		$this->registerAlias('JobList', \OCP\BackgroundJob\IJobList::class);
503 503
 
504
-		$this->registerService(\OCP\Route\IRouter::class, function (Server $c) {
504
+		$this->registerService(\OCP\Route\IRouter::class, function(Server $c) {
505 505
 			$cacheFactory = $c->getMemCacheFactory();
506 506
 			$logger = $c->getLogger();
507 507
 			if ($cacheFactory->isAvailable()) {
@@ -513,32 +513,32 @@  discard block
 block discarded – undo
513 513
 		});
514 514
 		$this->registerAlias('Router', \OCP\Route\IRouter::class);
515 515
 
516
-		$this->registerService(\OCP\ISearch::class, function ($c) {
516
+		$this->registerService(\OCP\ISearch::class, function($c) {
517 517
 			return new Search();
518 518
 		});
519 519
 		$this->registerAlias('Search', \OCP\ISearch::class);
520 520
 
521
-		$this->registerService(\OCP\Security\ISecureRandom::class, function ($c) {
521
+		$this->registerService(\OCP\Security\ISecureRandom::class, function($c) {
522 522
 			return new SecureRandom();
523 523
 		});
524 524
 		$this->registerAlias('SecureRandom', \OCP\Security\ISecureRandom::class);
525 525
 
526
-		$this->registerService(\OCP\Security\ICrypto::class, function (Server $c) {
526
+		$this->registerService(\OCP\Security\ICrypto::class, function(Server $c) {
527 527
 			return new Crypto($c->getConfig(), $c->getSecureRandom());
528 528
 		});
529 529
 		$this->registerAlias('Crypto', \OCP\Security\ICrypto::class);
530 530
 
531
-		$this->registerService(\OCP\Security\IHasher::class, function (Server $c) {
531
+		$this->registerService(\OCP\Security\IHasher::class, function(Server $c) {
532 532
 			return new Hasher($c->getConfig());
533 533
 		});
534 534
 		$this->registerAlias('Hasher', \OCP\Security\IHasher::class);
535 535
 
536
-		$this->registerService(\OCP\Security\ICredentialsManager::class, function (Server $c) {
536
+		$this->registerService(\OCP\Security\ICredentialsManager::class, function(Server $c) {
537 537
 			return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection());
538 538
 		});
539 539
 		$this->registerAlias('CredentialsManager', \OCP\Security\ICredentialsManager::class);
540 540
 
541
-		$this->registerService(IDBConnection::class, function (Server $c) {
541
+		$this->registerService(IDBConnection::class, function(Server $c) {
542 542
 			$systemConfig = $c->getSystemConfig();
543 543
 			$factory = new \OC\DB\ConnectionFactory($systemConfig);
544 544
 			$type = $systemConfig->getValue('dbtype', 'sqlite');
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 		});
553 553
 		$this->registerAlias('DatabaseConnection', IDBConnection::class);
554 554
 
555
-		$this->registerService('HTTPHelper', function (Server $c) {
555
+		$this->registerService('HTTPHelper', function(Server $c) {
556 556
 			$config = $c->getConfig();
557 557
 			return new HTTPHelper(
558 558
 				$config,
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 			);
561 561
 		});
562 562
 
563
-		$this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) {
563
+		$this->registerService(\OCP\Http\Client\IClientService::class, function(Server $c) {
564 564
 			$user = \OC_User::getUser();
565 565
 			$uid = $user ? $user : null;
566 566
 			return new ClientService(
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 		});
571 571
 		$this->registerAlias('HttpClientService', \OCP\Http\Client\IClientService::class);
572 572
 
573
-		$this->registerService(\OCP\Diagnostics\IEventLogger::class, function (Server $c) {
573
+		$this->registerService(\OCP\Diagnostics\IEventLogger::class, function(Server $c) {
574 574
 			if ($c->getSystemConfig()->getValue('debug', false)) {
575 575
 				return new EventLogger();
576 576
 			} else {
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 		});
580 580
 		$this->registerAlias('EventLogger', \OCP\Diagnostics\IEventLogger::class);
581 581
 
582
-		$this->registerService(\OCP\Diagnostics\IQueryLogger::class, function (Server $c) {
582
+		$this->registerService(\OCP\Diagnostics\IQueryLogger::class, function(Server $c) {
583 583
 			if ($c->getSystemConfig()->getValue('debug', false)) {
584 584
 				return new QueryLogger();
585 585
 			} else {
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 		});
589 589
 		$this->registerAlias('QueryLogger', \OCP\Diagnostics\IQueryLogger::class);
590 590
 
591
-		$this->registerService(TempManager::class, function (Server $c) {
591
+		$this->registerService(TempManager::class, function(Server $c) {
592 592
 			return new TempManager(
593 593
 				$c->getLogger(),
594 594
 				$c->getConfig()
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 		$this->registerAlias('TempManager', TempManager::class);
598 598
 		$this->registerAlias(ITempManager::class, TempManager::class);
599 599
 
600
-		$this->registerService(AppManager::class, function (Server $c) {
600
+		$this->registerService(AppManager::class, function(Server $c) {
601 601
 			return new \OC\App\AppManager(
602 602
 				$c->getUserSession(),
603 603
 				$c->getAppConfig(),
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 		$this->registerAlias('AppManager', AppManager::class);
610 610
 		$this->registerAlias(IAppManager::class, AppManager::class);
611 611
 
612
-		$this->registerService(\OCP\IDateTimeZone::class, function (Server $c) {
612
+		$this->registerService(\OCP\IDateTimeZone::class, function(Server $c) {
613 613
 			return new DateTimeZone(
614 614
 				$c->getConfig(),
615 615
 				$c->getSession()
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 		});
618 618
 		$this->registerAlias('DateTimeZone', \OCP\IDateTimeZone::class);
619 619
 
620
-		$this->registerService(\OCP\IDateTimeFormatter::class, function (Server $c) {
620
+		$this->registerService(\OCP\IDateTimeFormatter::class, function(Server $c) {
621 621
 			$language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null);
622 622
 
623 623
 			return new DateTimeFormatter(
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 		});
628 628
 		$this->registerAlias('DateTimeFormatter', \OCP\IDateTimeFormatter::class);
629 629
 
630
-		$this->registerService(\OCP\Files\Config\IUserMountCache::class, function (Server $c) {
630
+		$this->registerService(\OCP\Files\Config\IUserMountCache::class, function(Server $c) {
631 631
 			$mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger());
632 632
 			$listener = new UserMountCacheListener($mountCache);
633 633
 			$listener->listen($c->getUserManager());
@@ -635,10 +635,10 @@  discard block
 block discarded – undo
635 635
 		});
636 636
 		$this->registerAlias('UserMountCache', \OCP\Files\Config\IUserMountCache::class);
637 637
 
638
-		$this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function (Server $c) {
638
+		$this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function(Server $c) {
639 639
 			$loader = \OC\Files\Filesystem::getLoader();
640 640
 			$mountCache = $c->query('UserMountCache');
641
-			$manager =  new \OC\Files\Config\MountProviderCollection($loader, $mountCache);
641
+			$manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache);
642 642
 
643 643
 			// builtin providers
644 644
 
@@ -651,14 +651,14 @@  discard block
 block discarded – undo
651 651
 		});
652 652
 		$this->registerAlias('MountConfigManager', \OCP\Files\Config\IMountProviderCollection::class);
653 653
 
654
-		$this->registerService('IniWrapper', function ($c) {
654
+		$this->registerService('IniWrapper', function($c) {
655 655
 			return new IniGetWrapper();
656 656
 		});
657
-		$this->registerService('AsyncCommandBus', function (Server $c) {
657
+		$this->registerService('AsyncCommandBus', function(Server $c) {
658 658
 			$jobList = $c->getJobList();
659 659
 			return new AsyncBus($jobList);
660 660
 		});
661
-		$this->registerService('TrustedDomainHelper', function ($c) {
661
+		$this->registerService('TrustedDomainHelper', function($c) {
662 662
 			return new TrustedDomainHelper($this->getConfig());
663 663
 		});
664 664
 		$this->registerService('Throttler', function(Server $c) {
@@ -669,10 +669,10 @@  discard block
 block discarded – undo
669 669
 				$c->getConfig()
670 670
 			);
671 671
 		});
672
-		$this->registerService('IntegrityCodeChecker', function (Server $c) {
672
+		$this->registerService('IntegrityCodeChecker', function(Server $c) {
673 673
 			// IConfig and IAppManager requires a working database. This code
674 674
 			// might however be called when ownCloud is not yet setup.
675
-			if(\OC::$server->getSystemConfig()->getValue('installed', false)) {
675
+			if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
676 676
 				$config = $c->getConfig();
677 677
 				$appManager = $c->getAppManager();
678 678
 			} else {
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 					$c->getTempManager()
691 691
 			);
692 692
 		});
693
-		$this->registerService(\OCP\IRequest::class, function ($c) {
693
+		$this->registerService(\OCP\IRequest::class, function($c) {
694 694
 			if (isset($this['urlParams'])) {
695 695
 				$urlParams = $this['urlParams'];
696 696
 			} else {
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 		});
727 727
 		$this->registerAlias('Request', \OCP\IRequest::class);
728 728
 
729
-		$this->registerService(\OCP\Mail\IMailer::class, function (Server $c) {
729
+		$this->registerService(\OCP\Mail\IMailer::class, function(Server $c) {
730 730
 			return new Mailer(
731 731
 				$c->getConfig(),
732 732
 				$c->getLogger(),
@@ -738,14 +738,14 @@  discard block
 block discarded – undo
738 738
 		$this->registerService('LDAPProvider', function(Server $c) {
739 739
 			$config = $c->getConfig();
740 740
 			$factoryClass = $config->getSystemValue('ldapProviderFactory', null);
741
-			if(is_null($factoryClass)) {
741
+			if (is_null($factoryClass)) {
742 742
 				throw new \Exception('ldapProviderFactory not set');
743 743
 			}
744 744
 			/** @var \OCP\LDAP\ILDAPProviderFactory $factory */
745 745
 			$factory = new $factoryClass($this);
746 746
 			return $factory->getLDAPProvider();
747 747
 		});
748
-		$this->registerService('LockingProvider', function (Server $c) {
748
+		$this->registerService('LockingProvider', function(Server $c) {
749 749
 			$ini = $c->getIniWrapper();
750 750
 			$config = $c->getConfig();
751 751
 			$ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time')));
@@ -761,37 +761,37 @@  discard block
 block discarded – undo
761 761
 			return new NoopLockingProvider();
762 762
 		});
763 763
 
764
-		$this->registerService(\OCP\Files\Mount\IMountManager::class, function () {
764
+		$this->registerService(\OCP\Files\Mount\IMountManager::class, function() {
765 765
 			return new \OC\Files\Mount\Manager();
766 766
 		});
767 767
 		$this->registerAlias('MountManager', \OCP\Files\Mount\IMountManager::class);
768 768
 
769
-		$this->registerService(\OCP\Files\IMimeTypeDetector::class, function (Server $c) {
769
+		$this->registerService(\OCP\Files\IMimeTypeDetector::class, function(Server $c) {
770 770
 			return new \OC\Files\Type\Detection(
771 771
 				$c->getURLGenerator(),
772 772
 				\OC::$configDir,
773
-				\OC::$SERVERROOT . '/resources/config/'
773
+				\OC::$SERVERROOT.'/resources/config/'
774 774
 			);
775 775
 		});
776 776
 		$this->registerAlias('MimeTypeDetector', \OCP\Files\IMimeTypeDetector::class);
777 777
 
778
-		$this->registerService(\OCP\Files\IMimeTypeLoader::class, function (Server $c) {
778
+		$this->registerService(\OCP\Files\IMimeTypeLoader::class, function(Server $c) {
779 779
 			return new \OC\Files\Type\Loader(
780 780
 				$c->getDatabaseConnection()
781 781
 			);
782 782
 		});
783 783
 		$this->registerAlias('MimeTypeLoader', \OCP\Files\IMimeTypeLoader::class);
784 784
 
785
-		$this->registerService(\OCP\Notification\IManager::class, function (Server $c) {
785
+		$this->registerService(\OCP\Notification\IManager::class, function(Server $c) {
786 786
 			return new Manager(
787 787
 				$c->query(IValidator::class)
788 788
 			);
789 789
 		});
790 790
 		$this->registerAlias('NotificationManager', \OCP\Notification\IManager::class);
791 791
 
792
-		$this->registerService(\OC\CapabilitiesManager::class, function (Server $c) {
792
+		$this->registerService(\OC\CapabilitiesManager::class, function(Server $c) {
793 793
 			$manager = new \OC\CapabilitiesManager($c->getLogger());
794
-			$manager->registerCapability(function () use ($c) {
794
+			$manager->registerCapability(function() use ($c) {
795 795
 				return new \OC\OCS\CoreCapabilities($c->getConfig());
796 796
 			});
797 797
 			return $manager;
@@ -848,13 +848,13 @@  discard block
 block discarded – undo
848 848
 
849 849
 			);
850 850
 		});
851
-		$this->registerService(EventDispatcher::class, function () {
851
+		$this->registerService(EventDispatcher::class, function() {
852 852
 			return new EventDispatcher();
853 853
 		});
854 854
 		$this->registerAlias('EventDispatcher', EventDispatcher::class);
855 855
 		$this->registerAlias(EventDispatcherInterface::class, EventDispatcher::class);
856 856
 
857
-		$this->registerService('CryptoWrapper', function (Server $c) {
857
+		$this->registerService('CryptoWrapper', function(Server $c) {
858 858
 			// FIXME: Instantiiated here due to cyclic dependency
859 859
 			$request = new Request(
860 860
 				[
@@ -879,7 +879,7 @@  discard block
 block discarded – undo
879 879
 				$request
880 880
 			);
881 881
 		});
882
-		$this->registerService('CsrfTokenManager', function (Server $c) {
882
+		$this->registerService('CsrfTokenManager', function(Server $c) {
883 883
 			$tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom());
884 884
 
885 885
 			return new CsrfTokenManager(
@@ -887,10 +887,10 @@  discard block
 block discarded – undo
887 887
 				$c->query(SessionStorage::class)
888 888
 			);
889 889
 		});
890
-		$this->registerService(SessionStorage::class, function (Server $c) {
890
+		$this->registerService(SessionStorage::class, function(Server $c) {
891 891
 			return new SessionStorage($c->getSession());
892 892
 		});
893
-		$this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function (Server $c) {
893
+		$this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function(Server $c) {
894 894
 			return new ContentSecurityPolicyManager();
895 895
 		});
896 896
 		$this->registerAlias('ContentSecurityPolicyManager', \OCP\Security\IContentSecurityPolicyManager::class);
@@ -941,23 +941,23 @@  discard block
 block discarded – undo
941 941
 			);
942 942
 			return $manager;
943 943
 		});
944
-		$this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) {
944
+		$this->registerService(\OC\Files\AppData\Factory::class, function(Server $c) {
945 945
 			return new \OC\Files\AppData\Factory(
946 946
 				$c->getRootFolder(),
947 947
 				$c->getSystemConfig()
948 948
 			);
949 949
 		});
950 950
 
951
-		$this->registerService('LockdownManager', function (Server $c) {
951
+		$this->registerService('LockdownManager', function(Server $c) {
952 952
 			return new LockdownManager();
953 953
 		});
954 954
 
955
-		$this->registerService(ICloudIdManager::class, function (Server $c) {
955
+		$this->registerService(ICloudIdManager::class, function(Server $c) {
956 956
 			return new CloudIdManager();
957 957
 		});
958 958
 
959 959
 		/* To trick DI since we don't extend the DIContainer here */
960
-		$this->registerService(CleanPreviewsBackgroundJob::class, function (Server $c) {
960
+		$this->registerService(CleanPreviewsBackgroundJob::class, function(Server $c) {
961 961
 			return new CleanPreviewsBackgroundJob(
962 962
 				$c->getRootFolder(),
963 963
 				$c->getLogger(),
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
 	 * @deprecated since 9.2.0 use IAppData
1112 1112
 	 */
1113 1113
 	public function getAppFolder() {
1114
-		$dir = '/' . \OC_App::getCurrentApp();
1114
+		$dir = '/'.\OC_App::getCurrentApp();
1115 1115
 		$root = $this->getRootFolder();
1116 1116
 		if (!$root->nodeExists($dir)) {
1117 1117
 			$folder = $root->newFolder($dir);
Please login to merge, or discard this patch.
lib/private/Template/SCSSCacher.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -114,8 +114,8 @@
 block discarded – undo
114 114
 	}
115 115
 
116 116
 	/**
117
-	 * @param $appName
118
-	 * @param $fileName
117
+	 * @param string $appName
118
+	 * @param string $fileName
119 119
 	 * @return ISimpleFile
120 120
 	 */
121 121
 	public function getCachedCSS($appName, $fileName) {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,6 @@
 block discarded – undo
25 25
 use Leafo\ScssPhp\Exception\ParserException;
26 26
 use Leafo\ScssPhp\Formatter\Crunched;
27 27
 use Leafo\ScssPhp\Formatter\Expanded;
28
-
29 28
 use OC\Files\AppData\Factory;
30 29
 use OCP\Files\IAppData;
31 30
 use OCP\Files\NotFoundException;
Please login to merge, or discard this patch.
Indentation   +247 added lines, -247 removed lines patch added patch discarded remove patch
@@ -39,251 +39,251 @@
 block discarded – undo
39 39
 
40 40
 class SCSSCacher {
41 41
 
42
-	/** @var ILogger */
43
-	protected $logger;
44
-
45
-	/** @var IAppData */
46
-	protected $appData;
47
-
48
-	/** @var IURLGenerator */
49
-	protected $urlGenerator;
50
-
51
-	/** @var IConfig */
52
-	protected $config;
53
-
54
-	/** @var string */
55
-	protected $serverRoot;
56
-
57
-	/** @var ICache */
58
-	protected $depsCache;
59
-
60
-	/**
61
-	 * @param ILogger $logger
62
-	 * @param Factory $appDataFactory
63
-	 * @param IURLGenerator $urlGenerator
64
-	 * @param IConfig $config
65
-	 * @param \OC_Defaults $defaults
66
-	 * @param string $serverRoot
67
-	 * @param ICache $depsCache
68
-	 */
69
-	public function __construct(ILogger $logger,
70
-								Factory $appDataFactory,
71
-								IURLGenerator $urlGenerator,
72
-								IConfig $config,
73
-								\OC_Defaults $defaults,
74
-								$serverRoot,
75
-								ICache $depsCache) {
76
-		$this->logger = $logger;
77
-		$this->appData = $appDataFactory->get('css');
78
-		$this->urlGenerator = $urlGenerator;
79
-		$this->config = $config;
80
-		$this->defaults = $defaults;
81
-		$this->serverRoot = $serverRoot;
82
-		$this->depsCache = $depsCache;
83
-	}
84
-
85
-	/**
86
-	 * Process the caching process if needed
87
-	 * @param string $root Root path to the nextcloud installation
88
-	 * @param string $file
89
-	 * @param string $app The app name
90
-	 * @return boolean
91
-	 */
92
-	public function process($root, $file, $app) {
93
-		$path = explode('/', $root . '/' . $file);
94
-
95
-		$fileNameSCSS = array_pop($path);
96
-		$fileNameCSS = str_replace('.scss', '.css', $fileNameSCSS);
97
-
98
-		$path = implode('/', $path);
99
-
100
-		$webDir = substr($path, strlen($this->serverRoot)+1);
101
-
102
-		try {
103
-			$folder = $this->appData->getFolder($app);
104
-		} catch(NotFoundException $e) {
105
-			// creating css appdata folder
106
-			$folder = $this->appData->newFolder($app);
107
-		}
108
-
109
-
110
-		if(!$this->variablesChanged() && $this->isCached($fileNameCSS, $folder)) {
111
-			return true;
112
-		}
113
-		return $this->cache($path, $fileNameCSS, $fileNameSCSS, $folder, $webDir);
114
-	}
115
-
116
-	/**
117
-	 * @param $appName
118
-	 * @param $fileName
119
-	 * @return ISimpleFile
120
-	 */
121
-	public function getCachedCSS($appName, $fileName) {
122
-		$folder = $this->appData->getFolder($appName);
123
-		return $folder->getFile($fileName);
124
-	}
125
-
126
-	/**
127
-	 * Check if the file is cached or not
128
-	 * @param string $fileNameCSS
129
-	 * @param ISimpleFolder $folder
130
-	 * @return boolean
131
-	 */
132
-	private function isCached($fileNameCSS, ISimpleFolder $folder) {
133
-		try {
134
-			$cachedFile = $folder->getFile($fileNameCSS);
135
-			if ($cachedFile->getSize() > 0) {
136
-				$depFileName = $fileNameCSS . '.deps';
137
-				$deps = $this->depsCache->get($folder->getName() . '-' . $depFileName);
138
-				if ($deps === null) {
139
-					$depFile = $folder->getFile($depFileName);
140
-					$deps = $depFile->getContent();
141
-					//Set to memcache for next run
142
-					$this->depsCache->set($folder->getName() . '-' . $depFileName, $deps);
143
-				}
144
-				$deps = json_decode($deps, true);
145
-
146
-				foreach ($deps as $file=>$mtime) {
147
-					if (!file_exists($file) || filemtime($file) > $mtime) {
148
-						return false;
149
-					}
150
-				}
151
-			}
152
-			return true;
153
-		} catch(NotFoundException $e) {
154
-			return false;
155
-		}
156
-	}
157
-
158
-	/**
159
-	 * Check if the variables file has changed
160
-	 * @return bool
161
-	 */
162
-	private function variablesChanged() {
163
-		$injectedVariables = $this->getInjectedVariables();
164
-		if($this->config->getAppValue('core', 'scss.variables') !== md5($injectedVariables)) {
165
-			$this->resetCache();
166
-			$this->config->setAppValue('core', 'scss.variables', md5($injectedVariables));
167
-			return true;
168
-		}
169
-		return false;
170
-	}
171
-
172
-	/**
173
-	 * Cache the file with AppData
174
-	 * @param string $path
175
-	 * @param string $fileNameCSS
176
-	 * @param string $fileNameSCSS
177
-	 * @param ISimpleFolder $folder
178
-	 * @param string $webDir
179
-	 * @return boolean
180
-	 */
181
-	private function cache($path, $fileNameCSS, $fileNameSCSS, ISimpleFolder $folder, $webDir) {
182
-		$scss = new Compiler();
183
-		$scss->setImportPaths([
184
-			$path,
185
-			\OC::$SERVERROOT . '/core/css/',
186
-		]);
187
-		if($this->config->getSystemValue('debug')) {
188
-			// Debug mode
189
-			$scss->setFormatter(Expanded::class);
190
-			$scss->setLineNumberStyle(Compiler::LINE_COMMENTS);
191
-		} else {
192
-			// Compression
193
-			$scss->setFormatter(Crunched::class);
194
-		}
195
-
196
-		try {
197
-			$cachedfile = $folder->getFile($fileNameCSS);
198
-		} catch(NotFoundException $e) {
199
-			$cachedfile = $folder->newFile($fileNameCSS);
200
-		}
201
-
202
-		$depFileName = $fileNameCSS . '.deps';
203
-		try {
204
-			$depFile = $folder->getFile($depFileName);
205
-		} catch (NotFoundException $e) {
206
-			$depFile = $folder->newFile($depFileName);
207
-		}
208
-
209
-		// Compile
210
-		try {
211
-			$compiledScss = $scss->compile(
212
-				'@import "variables.scss";' .
213
-				$this->getInjectedVariables() .
214
-				'@import "'.$fileNameSCSS.'";');
215
-		} catch(ParserException $e) {
216
-			$this->logger->error($e, ['app' => 'core']);
217
-			return false;
218
-		}
219
-
220
-		try {
221
-			$cachedfile->putContent($this->rebaseUrls($compiledScss, $webDir));
222
-			$depFile->putContent(json_encode($scss->getParsedFiles()));
223
-			$this->logger->debug($webDir.'/'.$fileNameSCSS.' compiled and successfully cached', ['app' => 'core']);
224
-			return true;
225
-		} catch(NotPermittedException $e) {
226
-			return false;
227
-		}
228
-	}
229
-
230
-	/**
231
-	 * Reset scss cache by deleting all generated css files
232
-	 * We need to regenerate all files when variables change
233
-	 */
234
-	private function resetCache() {
235
-		$appDirectory = $this->appData->getDirectoryListing();
236
-		if(empty($appDirectory)){
237
-			return;
238
-		}
239
-		foreach ($appDirectory as $folder) {
240
-			foreach ($folder->getDirectoryListing() as $file) {
241
-				if (substr($file->getName(), -3) === "css" || substr($file->getName(), -4) === "deps") {
242
-					$file->delete();
243
-				}
244
-			}
245
-		}
246
-	}
247
-
248
-	/**
249
-	 * @return string SCSS code for variables from OC_Defaults
250
-	 */
251
-	private function getInjectedVariables() {
252
-		$variables = '';
253
-		foreach ($this->defaults->getScssVariables() as $key => $value) {
254
-			$variables .= '$' . $key . ': ' . $value . ';';
255
-		}
256
-		return $variables;
257
-	}
258
-
259
-	/**
260
-	 * Add the correct uri prefix to make uri valid again
261
-	 * @param string $css
262
-	 * @param string $webDir
263
-	 * @return string
264
-	 */
265
-	private function rebaseUrls($css, $webDir) {
266
-		$re = '/url\([\'"]([\.\w?=\/-]*)[\'"]\)/x';
267
-		// OC\Route\Router:75
268
-		if(($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) {
269
-			$subst = 'url(\'../../'.$webDir.'/$1\')';	
270
-		} else {
271
-			$subst = 'url(\'../../../'.$webDir.'/$1\')';
272
-		}
273
-		return preg_replace($re, $subst, $css);
274
-	}
275
-
276
-	/**
277
-	 * Return the cached css file uri
278
-	 * @param string $appName the app name
279
-	 * @param string $fileName
280
-	 * @return string
281
-	 */
282
-	public function getCachedSCSS($appName, $fileName) {
283
-		$tmpfileLoc = explode('/', $fileName);
284
-		$fileName = array_pop($tmpfileLoc);
285
-		$fileName = str_replace('.scss', '.css', $fileName);
286
-
287
-		return substr($this->urlGenerator->linkToRoute('core.Css.getCss', array('fileName' => $fileName, 'appName' => $appName)), strlen(\OC::$WEBROOT) + 1);
288
-	}
42
+    /** @var ILogger */
43
+    protected $logger;
44
+
45
+    /** @var IAppData */
46
+    protected $appData;
47
+
48
+    /** @var IURLGenerator */
49
+    protected $urlGenerator;
50
+
51
+    /** @var IConfig */
52
+    protected $config;
53
+
54
+    /** @var string */
55
+    protected $serverRoot;
56
+
57
+    /** @var ICache */
58
+    protected $depsCache;
59
+
60
+    /**
61
+     * @param ILogger $logger
62
+     * @param Factory $appDataFactory
63
+     * @param IURLGenerator $urlGenerator
64
+     * @param IConfig $config
65
+     * @param \OC_Defaults $defaults
66
+     * @param string $serverRoot
67
+     * @param ICache $depsCache
68
+     */
69
+    public function __construct(ILogger $logger,
70
+                                Factory $appDataFactory,
71
+                                IURLGenerator $urlGenerator,
72
+                                IConfig $config,
73
+                                \OC_Defaults $defaults,
74
+                                $serverRoot,
75
+                                ICache $depsCache) {
76
+        $this->logger = $logger;
77
+        $this->appData = $appDataFactory->get('css');
78
+        $this->urlGenerator = $urlGenerator;
79
+        $this->config = $config;
80
+        $this->defaults = $defaults;
81
+        $this->serverRoot = $serverRoot;
82
+        $this->depsCache = $depsCache;
83
+    }
84
+
85
+    /**
86
+     * Process the caching process if needed
87
+     * @param string $root Root path to the nextcloud installation
88
+     * @param string $file
89
+     * @param string $app The app name
90
+     * @return boolean
91
+     */
92
+    public function process($root, $file, $app) {
93
+        $path = explode('/', $root . '/' . $file);
94
+
95
+        $fileNameSCSS = array_pop($path);
96
+        $fileNameCSS = str_replace('.scss', '.css', $fileNameSCSS);
97
+
98
+        $path = implode('/', $path);
99
+
100
+        $webDir = substr($path, strlen($this->serverRoot)+1);
101
+
102
+        try {
103
+            $folder = $this->appData->getFolder($app);
104
+        } catch(NotFoundException $e) {
105
+            // creating css appdata folder
106
+            $folder = $this->appData->newFolder($app);
107
+        }
108
+
109
+
110
+        if(!$this->variablesChanged() && $this->isCached($fileNameCSS, $folder)) {
111
+            return true;
112
+        }
113
+        return $this->cache($path, $fileNameCSS, $fileNameSCSS, $folder, $webDir);
114
+    }
115
+
116
+    /**
117
+     * @param $appName
118
+     * @param $fileName
119
+     * @return ISimpleFile
120
+     */
121
+    public function getCachedCSS($appName, $fileName) {
122
+        $folder = $this->appData->getFolder($appName);
123
+        return $folder->getFile($fileName);
124
+    }
125
+
126
+    /**
127
+     * Check if the file is cached or not
128
+     * @param string $fileNameCSS
129
+     * @param ISimpleFolder $folder
130
+     * @return boolean
131
+     */
132
+    private function isCached($fileNameCSS, ISimpleFolder $folder) {
133
+        try {
134
+            $cachedFile = $folder->getFile($fileNameCSS);
135
+            if ($cachedFile->getSize() > 0) {
136
+                $depFileName = $fileNameCSS . '.deps';
137
+                $deps = $this->depsCache->get($folder->getName() . '-' . $depFileName);
138
+                if ($deps === null) {
139
+                    $depFile = $folder->getFile($depFileName);
140
+                    $deps = $depFile->getContent();
141
+                    //Set to memcache for next run
142
+                    $this->depsCache->set($folder->getName() . '-' . $depFileName, $deps);
143
+                }
144
+                $deps = json_decode($deps, true);
145
+
146
+                foreach ($deps as $file=>$mtime) {
147
+                    if (!file_exists($file) || filemtime($file) > $mtime) {
148
+                        return false;
149
+                    }
150
+                }
151
+            }
152
+            return true;
153
+        } catch(NotFoundException $e) {
154
+            return false;
155
+        }
156
+    }
157
+
158
+    /**
159
+     * Check if the variables file has changed
160
+     * @return bool
161
+     */
162
+    private function variablesChanged() {
163
+        $injectedVariables = $this->getInjectedVariables();
164
+        if($this->config->getAppValue('core', 'scss.variables') !== md5($injectedVariables)) {
165
+            $this->resetCache();
166
+            $this->config->setAppValue('core', 'scss.variables', md5($injectedVariables));
167
+            return true;
168
+        }
169
+        return false;
170
+    }
171
+
172
+    /**
173
+     * Cache the file with AppData
174
+     * @param string $path
175
+     * @param string $fileNameCSS
176
+     * @param string $fileNameSCSS
177
+     * @param ISimpleFolder $folder
178
+     * @param string $webDir
179
+     * @return boolean
180
+     */
181
+    private function cache($path, $fileNameCSS, $fileNameSCSS, ISimpleFolder $folder, $webDir) {
182
+        $scss = new Compiler();
183
+        $scss->setImportPaths([
184
+            $path,
185
+            \OC::$SERVERROOT . '/core/css/',
186
+        ]);
187
+        if($this->config->getSystemValue('debug')) {
188
+            // Debug mode
189
+            $scss->setFormatter(Expanded::class);
190
+            $scss->setLineNumberStyle(Compiler::LINE_COMMENTS);
191
+        } else {
192
+            // Compression
193
+            $scss->setFormatter(Crunched::class);
194
+        }
195
+
196
+        try {
197
+            $cachedfile = $folder->getFile($fileNameCSS);
198
+        } catch(NotFoundException $e) {
199
+            $cachedfile = $folder->newFile($fileNameCSS);
200
+        }
201
+
202
+        $depFileName = $fileNameCSS . '.deps';
203
+        try {
204
+            $depFile = $folder->getFile($depFileName);
205
+        } catch (NotFoundException $e) {
206
+            $depFile = $folder->newFile($depFileName);
207
+        }
208
+
209
+        // Compile
210
+        try {
211
+            $compiledScss = $scss->compile(
212
+                '@import "variables.scss";' .
213
+                $this->getInjectedVariables() .
214
+                '@import "'.$fileNameSCSS.'";');
215
+        } catch(ParserException $e) {
216
+            $this->logger->error($e, ['app' => 'core']);
217
+            return false;
218
+        }
219
+
220
+        try {
221
+            $cachedfile->putContent($this->rebaseUrls($compiledScss, $webDir));
222
+            $depFile->putContent(json_encode($scss->getParsedFiles()));
223
+            $this->logger->debug($webDir.'/'.$fileNameSCSS.' compiled and successfully cached', ['app' => 'core']);
224
+            return true;
225
+        } catch(NotPermittedException $e) {
226
+            return false;
227
+        }
228
+    }
229
+
230
+    /**
231
+     * Reset scss cache by deleting all generated css files
232
+     * We need to regenerate all files when variables change
233
+     */
234
+    private function resetCache() {
235
+        $appDirectory = $this->appData->getDirectoryListing();
236
+        if(empty($appDirectory)){
237
+            return;
238
+        }
239
+        foreach ($appDirectory as $folder) {
240
+            foreach ($folder->getDirectoryListing() as $file) {
241
+                if (substr($file->getName(), -3) === "css" || substr($file->getName(), -4) === "deps") {
242
+                    $file->delete();
243
+                }
244
+            }
245
+        }
246
+    }
247
+
248
+    /**
249
+     * @return string SCSS code for variables from OC_Defaults
250
+     */
251
+    private function getInjectedVariables() {
252
+        $variables = '';
253
+        foreach ($this->defaults->getScssVariables() as $key => $value) {
254
+            $variables .= '$' . $key . ': ' . $value . ';';
255
+        }
256
+        return $variables;
257
+    }
258
+
259
+    /**
260
+     * Add the correct uri prefix to make uri valid again
261
+     * @param string $css
262
+     * @param string $webDir
263
+     * @return string
264
+     */
265
+    private function rebaseUrls($css, $webDir) {
266
+        $re = '/url\([\'"]([\.\w?=\/-]*)[\'"]\)/x';
267
+        // OC\Route\Router:75
268
+        if(($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) {
269
+            $subst = 'url(\'../../'.$webDir.'/$1\')';	
270
+        } else {
271
+            $subst = 'url(\'../../../'.$webDir.'/$1\')';
272
+        }
273
+        return preg_replace($re, $subst, $css);
274
+    }
275
+
276
+    /**
277
+     * Return the cached css file uri
278
+     * @param string $appName the app name
279
+     * @param string $fileName
280
+     * @return string
281
+     */
282
+    public function getCachedSCSS($appName, $fileName) {
283
+        $tmpfileLoc = explode('/', $fileName);
284
+        $fileName = array_pop($tmpfileLoc);
285
+        $fileName = str_replace('.scss', '.css', $fileName);
286
+
287
+        return substr($this->urlGenerator->linkToRoute('core.Css.getCss', array('fileName' => $fileName, 'appName' => $appName)), strlen(\OC::$WEBROOT) + 1);
288
+    }
289 289
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -90,24 +90,24 @@  discard block
 block discarded – undo
90 90
 	 * @return boolean
91 91
 	 */
92 92
 	public function process($root, $file, $app) {
93
-		$path = explode('/', $root . '/' . $file);
93
+		$path = explode('/', $root.'/'.$file);
94 94
 
95 95
 		$fileNameSCSS = array_pop($path);
96 96
 		$fileNameCSS = str_replace('.scss', '.css', $fileNameSCSS);
97 97
 
98 98
 		$path = implode('/', $path);
99 99
 
100
-		$webDir = substr($path, strlen($this->serverRoot)+1);
100
+		$webDir = substr($path, strlen($this->serverRoot) + 1);
101 101
 
102 102
 		try {
103 103
 			$folder = $this->appData->getFolder($app);
104
-		} catch(NotFoundException $e) {
104
+		} catch (NotFoundException $e) {
105 105
 			// creating css appdata folder
106 106
 			$folder = $this->appData->newFolder($app);
107 107
 		}
108 108
 
109 109
 
110
-		if(!$this->variablesChanged() && $this->isCached($fileNameCSS, $folder)) {
110
+		if (!$this->variablesChanged() && $this->isCached($fileNameCSS, $folder)) {
111 111
 			return true;
112 112
 		}
113 113
 		return $this->cache($path, $fileNameCSS, $fileNameSCSS, $folder, $webDir);
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
 		try {
134 134
 			$cachedFile = $folder->getFile($fileNameCSS);
135 135
 			if ($cachedFile->getSize() > 0) {
136
-				$depFileName = $fileNameCSS . '.deps';
137
-				$deps = $this->depsCache->get($folder->getName() . '-' . $depFileName);
136
+				$depFileName = $fileNameCSS.'.deps';
137
+				$deps = $this->depsCache->get($folder->getName().'-'.$depFileName);
138 138
 				if ($deps === null) {
139 139
 					$depFile = $folder->getFile($depFileName);
140 140
 					$deps = $depFile->getContent();
141 141
 					//Set to memcache for next run
142
-					$this->depsCache->set($folder->getName() . '-' . $depFileName, $deps);
142
+					$this->depsCache->set($folder->getName().'-'.$depFileName, $deps);
143 143
 				}
144 144
 				$deps = json_decode($deps, true);
145 145
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 				}
151 151
 			}
152 152
 			return true;
153
-		} catch(NotFoundException $e) {
153
+		} catch (NotFoundException $e) {
154 154
 			return false;
155 155
 		}
156 156
 	}
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	private function variablesChanged() {
163 163
 		$injectedVariables = $this->getInjectedVariables();
164
-		if($this->config->getAppValue('core', 'scss.variables') !== md5($injectedVariables)) {
164
+		if ($this->config->getAppValue('core', 'scss.variables') !== md5($injectedVariables)) {
165 165
 			$this->resetCache();
166 166
 			$this->config->setAppValue('core', 'scss.variables', md5($injectedVariables));
167 167
 			return true;
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
 		$scss = new Compiler();
183 183
 		$scss->setImportPaths([
184 184
 			$path,
185
-			\OC::$SERVERROOT . '/core/css/',
185
+			\OC::$SERVERROOT.'/core/css/',
186 186
 		]);
187
-		if($this->config->getSystemValue('debug')) {
187
+		if ($this->config->getSystemValue('debug')) {
188 188
 			// Debug mode
189 189
 			$scss->setFormatter(Expanded::class);
190 190
 			$scss->setLineNumberStyle(Compiler::LINE_COMMENTS);
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 
196 196
 		try {
197 197
 			$cachedfile = $folder->getFile($fileNameCSS);
198
-		} catch(NotFoundException $e) {
198
+		} catch (NotFoundException $e) {
199 199
 			$cachedfile = $folder->newFile($fileNameCSS);
200 200
 		}
201 201
 
202
-		$depFileName = $fileNameCSS . '.deps';
202
+		$depFileName = $fileNameCSS.'.deps';
203 203
 		try {
204 204
 			$depFile = $folder->getFile($depFileName);
205 205
 		} catch (NotFoundException $e) {
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
 		// Compile
210 210
 		try {
211 211
 			$compiledScss = $scss->compile(
212
-				'@import "variables.scss";' .
213
-				$this->getInjectedVariables() .
212
+				'@import "variables.scss";'.
213
+				$this->getInjectedVariables().
214 214
 				'@import "'.$fileNameSCSS.'";');
215
-		} catch(ParserException $e) {
215
+		} catch (ParserException $e) {
216 216
 			$this->logger->error($e, ['app' => 'core']);
217 217
 			return false;
218 218
 		}
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 			$depFile->putContent(json_encode($scss->getParsedFiles()));
223 223
 			$this->logger->debug($webDir.'/'.$fileNameSCSS.' compiled and successfully cached', ['app' => 'core']);
224 224
 			return true;
225
-		} catch(NotPermittedException $e) {
225
+		} catch (NotPermittedException $e) {
226 226
 			return false;
227 227
 		}
228 228
 	}
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	private function resetCache() {
235 235
 		$appDirectory = $this->appData->getDirectoryListing();
236
-		if(empty($appDirectory)){
236
+		if (empty($appDirectory)) {
237 237
 			return;
238 238
 		}
239 239
 		foreach ($appDirectory as $folder) {
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	private function getInjectedVariables() {
252 252
 		$variables = '';
253 253
 		foreach ($this->defaults->getScssVariables() as $key => $value) {
254
-			$variables .= '$' . $key . ': ' . $value . ';';
254
+			$variables .= '$'.$key.': '.$value.';';
255 255
 		}
256 256
 		return $variables;
257 257
 	}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	private function rebaseUrls($css, $webDir) {
266 266
 		$re = '/url\([\'"]([\.\w?=\/-]*)[\'"]\)/x';
267 267
 		// OC\Route\Router:75
268
-		if(($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) {
268
+		if (($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) {
269 269
 			$subst = 'url(\'../../'.$webDir.'/$1\')';	
270 270
 		} else {
271 271
 			$subst = 'url(\'../../../'.$webDir.'/$1\')';
Please login to merge, or discard this patch.
apps/theming/lib/Controller/ThemingController.php 2 patches
Indentation   +291 added lines, -291 removed lines patch added patch discarded remove patch
@@ -56,312 +56,312 @@  discard block
 block discarded – undo
56 56
  * @package OCA\Theming\Controller
57 57
  */
58 58
 class ThemingController extends Controller {
59
-	/** @var ThemingDefaults */
60
-	private $themingDefaults;
61
-	/** @var Util */
62
-	private $util;
63
-	/** @var ITimeFactory */
64
-	private $timeFactory;
65
-	/** @var IL10N */
66
-	private $l10n;
67
-	/** @var IConfig */
68
-	private $config;
69
-	/** @var ITempManager */
70
-	private $tempManager;
71
-	/** @var IAppData */
72
-	private $appData;
73
-	/** @var SCSSCacher */
74
-	private $scssCacher;
59
+    /** @var ThemingDefaults */
60
+    private $themingDefaults;
61
+    /** @var Util */
62
+    private $util;
63
+    /** @var ITimeFactory */
64
+    private $timeFactory;
65
+    /** @var IL10N */
66
+    private $l10n;
67
+    /** @var IConfig */
68
+    private $config;
69
+    /** @var ITempManager */
70
+    private $tempManager;
71
+    /** @var IAppData */
72
+    private $appData;
73
+    /** @var SCSSCacher */
74
+    private $scssCacher;
75 75
 
76
-	/**
77
-	 * ThemingController constructor.
78
-	 *
79
-	 * @param string $appName
80
-	 * @param IRequest $request
81
-	 * @param IConfig $config
82
-	 * @param ThemingDefaults $themingDefaults
83
-	 * @param Util $util
84
-	 * @param ITimeFactory $timeFactory
85
-	 * @param IL10N $l
86
-	 * @param ITempManager $tempManager
87
-	 * @param IAppData $appData
88
-	 * @param SCSSCacher $scssCacher
89
-	 */
90
-	public function __construct(
91
-		$appName,
92
-		IRequest $request,
93
-		IConfig $config,
94
-		ThemingDefaults $themingDefaults,
95
-		Util $util,
96
-		ITimeFactory $timeFactory,
97
-		IL10N $l,
98
-		ITempManager $tempManager,
99
-		IAppData $appData,
100
-		SCSSCacher $scssCacher
101
-	) {
102
-		parent::__construct($appName, $request);
76
+    /**
77
+     * ThemingController constructor.
78
+     *
79
+     * @param string $appName
80
+     * @param IRequest $request
81
+     * @param IConfig $config
82
+     * @param ThemingDefaults $themingDefaults
83
+     * @param Util $util
84
+     * @param ITimeFactory $timeFactory
85
+     * @param IL10N $l
86
+     * @param ITempManager $tempManager
87
+     * @param IAppData $appData
88
+     * @param SCSSCacher $scssCacher
89
+     */
90
+    public function __construct(
91
+        $appName,
92
+        IRequest $request,
93
+        IConfig $config,
94
+        ThemingDefaults $themingDefaults,
95
+        Util $util,
96
+        ITimeFactory $timeFactory,
97
+        IL10N $l,
98
+        ITempManager $tempManager,
99
+        IAppData $appData,
100
+        SCSSCacher $scssCacher
101
+    ) {
102
+        parent::__construct($appName, $request);
103 103
 
104
-		$this->themingDefaults = $themingDefaults;
105
-		$this->util = $util;
106
-		$this->timeFactory = $timeFactory;
107
-		$this->l10n = $l;
108
-		$this->config = $config;
109
-		$this->tempManager = $tempManager;
110
-		$this->appData = $appData;
111
-		$this->scssCacher = $scssCacher;
112
-	}
104
+        $this->themingDefaults = $themingDefaults;
105
+        $this->util = $util;
106
+        $this->timeFactory = $timeFactory;
107
+        $this->l10n = $l;
108
+        $this->config = $config;
109
+        $this->tempManager = $tempManager;
110
+        $this->appData = $appData;
111
+        $this->scssCacher = $scssCacher;
112
+    }
113 113
 
114
-	/**
115
-	 * @param string $setting
116
-	 * @param string $value
117
-	 * @return DataResponse
118
-	 * @internal param string $color
119
-	 */
120
-	public function updateStylesheet($setting, $value) {
121
-		$value = trim($value);
122
-		switch ($setting) {
123
-			case 'name':
124
-				if (strlen($value) > 250) {
125
-					return new DataResponse([
126
-						'data' => [
127
-							'message' => $this->l10n->t('The given name is too long'),
128
-						],
129
-						'status' => 'error'
130
-					]);
131
-				}
132
-				break;
133
-			case 'url':
134
-				if (strlen($value) > 500) {
135
-					return new DataResponse([
136
-						'data' => [
137
-							'message' => $this->l10n->t('The given web address is too long'),
138
-						],
139
-						'status' => 'error'
140
-					]);
141
-				}
142
-				break;
143
-			case 'slogan':
144
-				if (strlen($value) > 500) {
145
-					return new DataResponse([
146
-						'data' => [
147
-							'message' => $this->l10n->t('The given slogan is too long'),
148
-						],
149
-						'status' => 'error'
150
-					]);
151
-				}
152
-				break;
153
-			case 'color':
154
-				if (!preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $value)) {
155
-					return new DataResponse([
156
-						'data' => [
157
-							'message' => $this->l10n->t('The given color is invalid'),
158
-						],
159
-						'status' => 'error'
160
-					]);
161
-				}
162
-				break;
163
-		}
114
+    /**
115
+     * @param string $setting
116
+     * @param string $value
117
+     * @return DataResponse
118
+     * @internal param string $color
119
+     */
120
+    public function updateStylesheet($setting, $value) {
121
+        $value = trim($value);
122
+        switch ($setting) {
123
+            case 'name':
124
+                if (strlen($value) > 250) {
125
+                    return new DataResponse([
126
+                        'data' => [
127
+                            'message' => $this->l10n->t('The given name is too long'),
128
+                        ],
129
+                        'status' => 'error'
130
+                    ]);
131
+                }
132
+                break;
133
+            case 'url':
134
+                if (strlen($value) > 500) {
135
+                    return new DataResponse([
136
+                        'data' => [
137
+                            'message' => $this->l10n->t('The given web address is too long'),
138
+                        ],
139
+                        'status' => 'error'
140
+                    ]);
141
+                }
142
+                break;
143
+            case 'slogan':
144
+                if (strlen($value) > 500) {
145
+                    return new DataResponse([
146
+                        'data' => [
147
+                            'message' => $this->l10n->t('The given slogan is too long'),
148
+                        ],
149
+                        'status' => 'error'
150
+                    ]);
151
+                }
152
+                break;
153
+            case 'color':
154
+                if (!preg_match('/^\#([0-9a-f]{3}|[0-9a-f]{6})$/i', $value)) {
155
+                    return new DataResponse([
156
+                        'data' => [
157
+                            'message' => $this->l10n->t('The given color is invalid'),
158
+                        ],
159
+                        'status' => 'error'
160
+                    ]);
161
+                }
162
+                break;
163
+        }
164 164
 
165
-		$this->themingDefaults->set($setting, $value);
166
-		return new DataResponse(
167
-			[
168
-				'data' =>
169
-					[
170
-						'message' => $this->l10n->t('Saved')
171
-					],
172
-				'status' => 'success'
173
-			]
174
-		);
175
-	}
165
+        $this->themingDefaults->set($setting, $value);
166
+        return new DataResponse(
167
+            [
168
+                'data' =>
169
+                    [
170
+                        'message' => $this->l10n->t('Saved')
171
+                    ],
172
+                'status' => 'success'
173
+            ]
174
+        );
175
+    }
176 176
 
177
-	/**
178
-	 * Update the logos and background image
179
-	 *
180
-	 * @return DataResponse
181
-	 */
182
-	public function updateLogo() {
183
-		$newLogo = $this->request->getUploadedFile('uploadlogo');
184
-		$newBackgroundLogo = $this->request->getUploadedFile('upload-login-background');
185
-		if (empty($newLogo) && empty($newBackgroundLogo)) {
186
-			return new DataResponse(
187
-				[
188
-					'data' => [
189
-						'message' => $this->l10n->t('No file uploaded')
190
-					]
191
-				],
192
-				Http::STATUS_UNPROCESSABLE_ENTITY
193
-			);
194
-		}
177
+    /**
178
+     * Update the logos and background image
179
+     *
180
+     * @return DataResponse
181
+     */
182
+    public function updateLogo() {
183
+        $newLogo = $this->request->getUploadedFile('uploadlogo');
184
+        $newBackgroundLogo = $this->request->getUploadedFile('upload-login-background');
185
+        if (empty($newLogo) && empty($newBackgroundLogo)) {
186
+            return new DataResponse(
187
+                [
188
+                    'data' => [
189
+                        'message' => $this->l10n->t('No file uploaded')
190
+                    ]
191
+                ],
192
+                Http::STATUS_UNPROCESSABLE_ENTITY
193
+            );
194
+        }
195 195
 
196
-		$name = '';
197
-		try {
198
-			$folder = $this->appData->getFolder('images');
199
-		} catch (NotFoundException $e) {
200
-			$folder = $this->appData->newFolder('images');
201
-		}
196
+        $name = '';
197
+        try {
198
+            $folder = $this->appData->getFolder('images');
199
+        } catch (NotFoundException $e) {
200
+            $folder = $this->appData->newFolder('images');
201
+        }
202 202
 
203
-		if (!empty($newLogo)) {
204
-			$target = $folder->newFile('logo');
205
-			$target->putContent(file_get_contents($newLogo['tmp_name'], 'r'));
206
-			$this->themingDefaults->set('logoMime', $newLogo['type']);
207
-			$name = $newLogo['name'];
208
-		}
209
-		if (!empty($newBackgroundLogo)) {
210
-			$target = $folder->newFile('background');
211
-			$image = @imagecreatefromstring(file_get_contents($newBackgroundLogo['tmp_name'], 'r'));
212
-			if ($image === false) {
213
-				return new DataResponse(
214
-					[
215
-						'data' => [
216
-							'message' => $this->l10n->t('Unsupported image type'),
217
-						],
218
-						'status' => 'failure',
219
-					],
220
-					Http::STATUS_UNPROCESSABLE_ENTITY
221
-				);
222
-			}
203
+        if (!empty($newLogo)) {
204
+            $target = $folder->newFile('logo');
205
+            $target->putContent(file_get_contents($newLogo['tmp_name'], 'r'));
206
+            $this->themingDefaults->set('logoMime', $newLogo['type']);
207
+            $name = $newLogo['name'];
208
+        }
209
+        if (!empty($newBackgroundLogo)) {
210
+            $target = $folder->newFile('background');
211
+            $image = @imagecreatefromstring(file_get_contents($newBackgroundLogo['tmp_name'], 'r'));
212
+            if ($image === false) {
213
+                return new DataResponse(
214
+                    [
215
+                        'data' => [
216
+                            'message' => $this->l10n->t('Unsupported image type'),
217
+                        ],
218
+                        'status' => 'failure',
219
+                    ],
220
+                    Http::STATUS_UNPROCESSABLE_ENTITY
221
+                );
222
+            }
223 223
 
224
-			// Optimize the image since some people may upload images that will be
225
-			// either to big or are not progressive rendering.
226
-			$tmpFile = $this->tempManager->getTemporaryFile();
227
-			if (function_exists('imagescale')) {
228
-				// FIXME: Once PHP 5.5.0 is a requirement the above check can be removed
229
-				// Workaround for https://bugs.php.net/bug.php?id=65171
230
-				$newHeight = imagesy($image) / (imagesx($image) / 1920);
231
-				$image = imagescale($image, 1920, $newHeight);
232
-			}
233
-			imageinterlace($image, 1);
234
-			imagejpeg($image, $tmpFile, 75);
235
-			imagedestroy($image);
224
+            // Optimize the image since some people may upload images that will be
225
+            // either to big or are not progressive rendering.
226
+            $tmpFile = $this->tempManager->getTemporaryFile();
227
+            if (function_exists('imagescale')) {
228
+                // FIXME: Once PHP 5.5.0 is a requirement the above check can be removed
229
+                // Workaround for https://bugs.php.net/bug.php?id=65171
230
+                $newHeight = imagesy($image) / (imagesx($image) / 1920);
231
+                $image = imagescale($image, 1920, $newHeight);
232
+            }
233
+            imageinterlace($image, 1);
234
+            imagejpeg($image, $tmpFile, 75);
235
+            imagedestroy($image);
236 236
 
237
-			$target->putContent(file_get_contents($tmpFile, 'r'));
238
-			$this->themingDefaults->set('backgroundMime', $newBackgroundLogo['type']);
239
-			$name = $newBackgroundLogo['name'];
240
-		}
237
+            $target->putContent(file_get_contents($tmpFile, 'r'));
238
+            $this->themingDefaults->set('backgroundMime', $newBackgroundLogo['type']);
239
+            $name = $newBackgroundLogo['name'];
240
+        }
241 241
 
242
-		return new DataResponse(
243
-			[
244
-				'data' =>
245
-					[
246
-						'name' => $name,
247
-						'message' => $this->l10n->t('Saved')
248
-					],
249
-				'status' => 'success'
250
-			]
251
-		);
252
-	}
242
+        return new DataResponse(
243
+            [
244
+                'data' =>
245
+                    [
246
+                        'name' => $name,
247
+                        'message' => $this->l10n->t('Saved')
248
+                    ],
249
+                'status' => 'success'
250
+            ]
251
+        );
252
+    }
253 253
 
254
-	/**
255
-	 * Revert setting to default value
256
-	 *
257
-	 * @param string $setting setting which should be reverted
258
-	 * @return DataResponse
259
-	 */
260
-	public function undo($setting) {
261
-		$value = $this->themingDefaults->undo($setting);
262
-		return new DataResponse(
263
-			[
264
-				'data' =>
265
-					[
266
-						'value' => $value,
267
-						'message' => $this->l10n->t('Saved')
268
-					],
269
-				'status' => 'success'
270
-			]
271
-		);
272
-	}
254
+    /**
255
+     * Revert setting to default value
256
+     *
257
+     * @param string $setting setting which should be reverted
258
+     * @return DataResponse
259
+     */
260
+    public function undo($setting) {
261
+        $value = $this->themingDefaults->undo($setting);
262
+        return new DataResponse(
263
+            [
264
+                'data' =>
265
+                    [
266
+                        'value' => $value,
267
+                        'message' => $this->l10n->t('Saved')
268
+                    ],
269
+                'status' => 'success'
270
+            ]
271
+        );
272
+    }
273 273
 
274
-	/**
275
-	 * @PublicPage
276
-	 * @NoCSRFRequired
277
-	 *
278
-	 * @return FileDisplayResponse|NotFoundResponse
279
-	 */
280
-	public function getLogo() {
281
-		try {
282
-			/** @var File $file */
283
-			$file = $this->appData->getFolder('images')->getFile('logo');
284
-		} catch (NotFoundException $e) {
285
-			return new NotFoundResponse();
286
-		}
274
+    /**
275
+     * @PublicPage
276
+     * @NoCSRFRequired
277
+     *
278
+     * @return FileDisplayResponse|NotFoundResponse
279
+     */
280
+    public function getLogo() {
281
+        try {
282
+            /** @var File $file */
283
+            $file = $this->appData->getFolder('images')->getFile('logo');
284
+        } catch (NotFoundException $e) {
285
+            return new NotFoundResponse();
286
+        }
287 287
 
288
-		$response = new FileDisplayResponse($file);
289
-		$response->cacheFor(3600);
290
-		$expires = new \DateTime();
291
-		$expires->setTimestamp($this->timeFactory->getTime());
292
-		$expires->add(new \DateInterval('PT24H'));
293
-		$response->addHeader('Expires', $expires->format(\DateTime::RFC2822));
294
-		$response->addHeader('Pragma', 'cache');
295
-		$response->addHeader('Content-Type', $this->config->getAppValue($this->appName, 'logoMime', ''));
296
-		return $response;
297
-	}
288
+        $response = new FileDisplayResponse($file);
289
+        $response->cacheFor(3600);
290
+        $expires = new \DateTime();
291
+        $expires->setTimestamp($this->timeFactory->getTime());
292
+        $expires->add(new \DateInterval('PT24H'));
293
+        $response->addHeader('Expires', $expires->format(\DateTime::RFC2822));
294
+        $response->addHeader('Pragma', 'cache');
295
+        $response->addHeader('Content-Type', $this->config->getAppValue($this->appName, 'logoMime', ''));
296
+        return $response;
297
+    }
298 298
 
299
-	/**
300
-	 * @PublicPage
301
-	 * @NoCSRFRequired
302
-	 *
303
-	 * @return FileDisplayResponse|NotFoundResponse
304
-	 */
305
-	public function getLoginBackground() {
306
-		try {
307
-			/** @var File $file */
308
-			$file = $this->appData->getFolder('images')->getFile('background');
309
-		} catch (NotFoundException $e) {
310
-			return new NotFoundResponse();
311
-		}
299
+    /**
300
+     * @PublicPage
301
+     * @NoCSRFRequired
302
+     *
303
+     * @return FileDisplayResponse|NotFoundResponse
304
+     */
305
+    public function getLoginBackground() {
306
+        try {
307
+            /** @var File $file */
308
+            $file = $this->appData->getFolder('images')->getFile('background');
309
+        } catch (NotFoundException $e) {
310
+            return new NotFoundResponse();
311
+        }
312 312
 
313
-		$response = new FileDisplayResponse($file);
314
-		$response->cacheFor(3600);
315
-		$expires = new \DateTime();
316
-		$expires->setTimestamp($this->timeFactory->getTime());
317
-		$expires->add(new \DateInterval('PT24H'));
318
-		$response->addHeader('Expires', $expires->format(\DateTime::RFC2822));
319
-		$response->addHeader('Pragma', 'cache');
320
-		$response->addHeader('Content-Type', $this->config->getAppValue($this->appName, 'backgroundMime', ''));
321
-		return $response;
322
-	}
313
+        $response = new FileDisplayResponse($file);
314
+        $response->cacheFor(3600);
315
+        $expires = new \DateTime();
316
+        $expires->setTimestamp($this->timeFactory->getTime());
317
+        $expires->add(new \DateInterval('PT24H'));
318
+        $response->addHeader('Expires', $expires->format(\DateTime::RFC2822));
319
+        $response->addHeader('Pragma', 'cache');
320
+        $response->addHeader('Content-Type', $this->config->getAppValue($this->appName, 'backgroundMime', ''));
321
+        return $response;
322
+    }
323 323
 
324
-	/**
325
-	 * @NoCSRFRequired
326
-	 * @PublicPage
327
-	 *
328
-	 * @return FileDisplayResponse|NotFoundResponse
329
-	 */
330
-	public function getStylesheet() {
331
-		$appPath = substr(\OC::$server->getAppManager()->getAppPath('theming'), strlen(\OC::$SERVERROOT) + 1);
332
-		/* SCSSCacher is required here
324
+    /**
325
+     * @NoCSRFRequired
326
+     * @PublicPage
327
+     *
328
+     * @return FileDisplayResponse|NotFoundResponse
329
+     */
330
+    public function getStylesheet() {
331
+        $appPath = substr(\OC::$server->getAppManager()->getAppPath('theming'), strlen(\OC::$SERVERROOT) + 1);
332
+        /* SCSSCacher is required here
333 333
 		 * We cannot rely on automatic caching done by \OC_Util::addStyle,
334 334
 		 * since we need to add the cacheBuster value to the url
335 335
 		 */
336
-		$cssCached = $this->scssCacher->process(\OC::$SERVERROOT, $appPath . '/css/theming.scss', 'theming');
337
-		if(!$cssCached) {
338
-			return new NotFoundResponse();
339
-		}
336
+        $cssCached = $this->scssCacher->process(\OC::$SERVERROOT, $appPath . '/css/theming.scss', 'theming');
337
+        if(!$cssCached) {
338
+            return new NotFoundResponse();
339
+        }
340 340
 
341
-		try {
342
-			$cssFile = $this->scssCacher->getCachedCSS('theming', 'theming.css');
343
-			$response = new FileDisplayResponse($cssFile, Http::STATUS_OK, ['Content-Type' => 'text/css']);
344
-			$response->cacheFor(86400);
345
-			$expires = new \DateTime();
346
-			$expires->setTimestamp($this->timeFactory->getTime());
347
-			$expires->add(new \DateInterval('PT24H'));
348
-			$response->addHeader('Expires', $expires->format(\DateTime::RFC1123));
349
-			$response->addHeader('Pragma', 'cache');
350
-			return $response;
351
-		} catch (NotFoundException $e) {
352
-			return new NotFoundResponse();
353
-		}
354
-	}
341
+        try {
342
+            $cssFile = $this->scssCacher->getCachedCSS('theming', 'theming.css');
343
+            $response = new FileDisplayResponse($cssFile, Http::STATUS_OK, ['Content-Type' => 'text/css']);
344
+            $response->cacheFor(86400);
345
+            $expires = new \DateTime();
346
+            $expires->setTimestamp($this->timeFactory->getTime());
347
+            $expires->add(new \DateInterval('PT24H'));
348
+            $response->addHeader('Expires', $expires->format(\DateTime::RFC1123));
349
+            $response->addHeader('Pragma', 'cache');
350
+            return $response;
351
+        } catch (NotFoundException $e) {
352
+            return new NotFoundResponse();
353
+        }
354
+    }
355 355
 
356
-	/**
357
-	 * @NoCSRFRequired
358
-	 * @PublicPage
359
-	 *
360
-	 * @return DataDownloadResponse
361
-	 */
362
-	public function getJavascript() {
363
-		$cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0');
364
-		$responseJS = '(function() {
356
+    /**
357
+     * @NoCSRFRequired
358
+     * @PublicPage
359
+     *
360
+     * @return DataDownloadResponse
361
+     */
362
+    public function getJavascript() {
363
+        $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0');
364
+        $responseJS = '(function() {
365 365
 	OCA.Theming = {
366 366
 		name: ' . json_encode($this->themingDefaults->getName()) . ',
367 367
 		url: ' . json_encode($this->themingDefaults->getBaseUrl()) . ',
@@ -371,10 +371,10 @@  discard block
 block discarded – undo
371 371
 		cacheBuster: ' . json_encode($cacheBusterValue) . '
372 372
 	};
373 373
 })();';
374
-		$response = new DataDownloadResponse($responseJS, 'javascript', 'text/javascript');
375
-		$response->addHeader('Expires', date(\DateTime::RFC2822, $this->timeFactory->getTime()));
376
-		$response->addHeader('Pragma', 'cache');
377
-		$response->cacheFor(3600);
378
-		return $response;
379
-	}
374
+        $response = new DataDownloadResponse($responseJS, 'javascript', 'text/javascript');
375
+        $response->addHeader('Expires', date(\DateTime::RFC2822, $this->timeFactory->getTime()));
376
+        $response->addHeader('Pragma', 'cache');
377
+        $response->cacheFor(3600);
378
+        return $response;
379
+    }
380 380
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
 		 * We cannot rely on automatic caching done by \OC_Util::addStyle,
334 334
 		 * since we need to add the cacheBuster value to the url
335 335
 		 */
336
-		$cssCached = $this->scssCacher->process(\OC::$SERVERROOT, $appPath . '/css/theming.scss', 'theming');
337
-		if(!$cssCached) {
336
+		$cssCached = $this->scssCacher->process(\OC::$SERVERROOT, $appPath.'/css/theming.scss', 'theming');
337
+		if (!$cssCached) {
338 338
 			return new NotFoundResponse();
339 339
 		}
340 340
 
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
 		$cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0');
364 364
 		$responseJS = '(function() {
365 365
 	OCA.Theming = {
366
-		name: ' . json_encode($this->themingDefaults->getName()) . ',
367
-		url: ' . json_encode($this->themingDefaults->getBaseUrl()) . ',
368
-		slogan: ' . json_encode($this->themingDefaults->getSlogan()) . ',
369
-		color: ' . json_encode($this->themingDefaults->getMailHeaderColor()) . ',
370
-		inverted: ' . json_encode($this->util->invertTextColor($this->themingDefaults->getMailHeaderColor())) . ',
371
-		cacheBuster: ' . json_encode($cacheBusterValue) . '
366
+		name: ' . json_encode($this->themingDefaults->getName()).',
367
+		url: ' . json_encode($this->themingDefaults->getBaseUrl()).',
368
+		slogan: ' . json_encode($this->themingDefaults->getSlogan()).',
369
+		color: ' . json_encode($this->themingDefaults->getMailHeaderColor()).',
370
+		inverted: ' . json_encode($this->util->invertTextColor($this->themingDefaults->getMailHeaderColor())).',
371
+		cacheBuster: ' . json_encode($cacheBusterValue).'
372 372
 	};
373 373
 })();';
374 374
 		$response = new DataDownloadResponse($responseJS, 'javascript', 'text/javascript');
Please login to merge, or discard this patch.
apps/theming/lib/ThemingDefaults.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,6 @@
 block discarded – undo
28 28
 use OCP\IConfig;
29 29
 use OCP\IL10N;
30 30
 use OCP\IURLGenerator;
31
-use OCP\Files\IRootFolder;
32 31
 
33 32
 class ThemingDefaults extends \OC_Defaults {
34 33
 
Please login to merge, or discard this patch.
Indentation   +213 added lines, -213 removed lines patch added patch discarded remove patch
@@ -32,242 +32,242 @@
 block discarded – undo
32 32
 
33 33
 class ThemingDefaults extends \OC_Defaults {
34 34
 
35
-	/** @var IConfig */
36
-	private $config;
37
-	/** @var IL10N */
38
-	private $l;
39
-	/** @var IURLGenerator */
40
-	private $urlGenerator;
41
-	/** @var IAppData */
42
-	private $appData;
43
-	/** @var \OC_Defaults */
44
-	private $defaults;
45
-	/** @var ICacheFactory */
46
-	private $cacheFactory;
47
-	/** @var string */
48
-	private $name;
49
-	/** @var string */
50
-	private $url;
51
-	/** @var string */
52
-	private $slogan;
53
-	/** @var string */
54
-	private $color;
35
+    /** @var IConfig */
36
+    private $config;
37
+    /** @var IL10N */
38
+    private $l;
39
+    /** @var IURLGenerator */
40
+    private $urlGenerator;
41
+    /** @var IAppData */
42
+    private $appData;
43
+    /** @var \OC_Defaults */
44
+    private $defaults;
45
+    /** @var ICacheFactory */
46
+    private $cacheFactory;
47
+    /** @var string */
48
+    private $name;
49
+    /** @var string */
50
+    private $url;
51
+    /** @var string */
52
+    private $slogan;
53
+    /** @var string */
54
+    private $color;
55 55
 
56
-	/**
57
-	 * ThemingDefaults constructor.
58
-	 *
59
-	 * @param IConfig $config
60
-	 * @param IL10N $l
61
-	 * @param IURLGenerator $urlGenerator
62
-	 * @param \OC_Defaults $defaults
63
-	 * @param IAppData $appData
64
-	 * @param ICacheFactory $cacheFactory
65
-	 * @param Util $util
66
-	 */
67
-	public function __construct(IConfig $config,
68
-								IL10N $l,
69
-								IURLGenerator $urlGenerator,
70
-								\OC_Defaults $defaults,
71
-								IAppData $appData,
72
-								ICacheFactory $cacheFactory,
73
-								Util $util
74
-	) {
75
-		$this->config = $config;
76
-		$this->l = $l;
77
-		$this->urlGenerator = $urlGenerator;
78
-		$this->defaults = $defaults;
79
-		$this->appData = $appData;
80
-		$this->cacheFactory = $cacheFactory;
81
-		$this->util = $util;
56
+    /**
57
+     * ThemingDefaults constructor.
58
+     *
59
+     * @param IConfig $config
60
+     * @param IL10N $l
61
+     * @param IURLGenerator $urlGenerator
62
+     * @param \OC_Defaults $defaults
63
+     * @param IAppData $appData
64
+     * @param ICacheFactory $cacheFactory
65
+     * @param Util $util
66
+     */
67
+    public function __construct(IConfig $config,
68
+                                IL10N $l,
69
+                                IURLGenerator $urlGenerator,
70
+                                \OC_Defaults $defaults,
71
+                                IAppData $appData,
72
+                                ICacheFactory $cacheFactory,
73
+                                Util $util
74
+    ) {
75
+        $this->config = $config;
76
+        $this->l = $l;
77
+        $this->urlGenerator = $urlGenerator;
78
+        $this->defaults = $defaults;
79
+        $this->appData = $appData;
80
+        $this->cacheFactory = $cacheFactory;
81
+        $this->util = $util;
82 82
 
83
-		$this->name = $this->defaults->getName();
84
-		$this->url = $this->defaults->getBaseUrl();
85
-		$this->slogan = $this->defaults->getSlogan();
86
-		$this->color = $this->defaults->getMailHeaderColor();
87
-	}
83
+        $this->name = $this->defaults->getName();
84
+        $this->url = $this->defaults->getBaseUrl();
85
+        $this->slogan = $this->defaults->getSlogan();
86
+        $this->color = $this->defaults->getMailHeaderColor();
87
+    }
88 88
 
89
-	public function getName() {
90
-		return strip_tags($this->config->getAppValue('theming', 'name', $this->name));
91
-	}
89
+    public function getName() {
90
+        return strip_tags($this->config->getAppValue('theming', 'name', $this->name));
91
+    }
92 92
 
93
-	public function getHTMLName() {
94
-		return $this->config->getAppValue('theming', 'name', $this->name);
95
-	}
93
+    public function getHTMLName() {
94
+        return $this->config->getAppValue('theming', 'name', $this->name);
95
+    }
96 96
 
97
-	public function getTitle() {
98
-		return $this->getName();
99
-	}
97
+    public function getTitle() {
98
+        return $this->getName();
99
+    }
100 100
 
101
-	public function getEntity() {
102
-		return $this->getName();
103
-	}
101
+    public function getEntity() {
102
+        return $this->getName();
103
+    }
104 104
 
105
-	public function getBaseUrl() {
106
-		return $this->config->getAppValue('theming', 'url', $this->url);
107
-	}
105
+    public function getBaseUrl() {
106
+        return $this->config->getAppValue('theming', 'url', $this->url);
107
+    }
108 108
 
109
-	public function getSlogan() {
110
-		return \OCP\Util::sanitizeHTML($this->config->getAppValue('theming', 'slogan', $this->slogan));
111
-	}
109
+    public function getSlogan() {
110
+        return \OCP\Util::sanitizeHTML($this->config->getAppValue('theming', 'slogan', $this->slogan));
111
+    }
112 112
 
113
-	public function getShortFooter() {
114
-		$slogan = $this->getSlogan();
115
-		$footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' .
116
-			' rel="noreferrer">' .$this->getEntity() . '</a>'.
117
-			($slogan !== '' ? ' – ' . $slogan : '');
113
+    public function getShortFooter() {
114
+        $slogan = $this->getSlogan();
115
+        $footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' .
116
+            ' rel="noreferrer">' .$this->getEntity() . '</a>'.
117
+            ($slogan !== '' ? ' – ' . $slogan : '');
118 118
 
119
-		return $footer;
120
-	}
119
+        return $footer;
120
+    }
121 121
 
122
-	/**
123
-	 * Color that is used for the header as well as for mail headers
124
-	 *
125
-	 * @return string
126
-	 */
127
-	public function getMailHeaderColor() {
128
-		return $this->config->getAppValue('theming', 'color', $this->color);
129
-	}
122
+    /**
123
+     * Color that is used for the header as well as for mail headers
124
+     *
125
+     * @return string
126
+     */
127
+    public function getMailHeaderColor() {
128
+        return $this->config->getAppValue('theming', 'color', $this->color);
129
+    }
130 130
 
131
-	/**
132
-	 * Themed logo url
133
-	 *
134
-	 * @return string
135
-	 */
136
-	public function getLogo() {
137
-		try {
138
-			$file = $this->appData->getFolder('images')->getFile('logo');
139
-		} catch (NotFoundException $e) {
140
-			$file = null;
141
-		}
142
-		$logo = $this->config->getAppValue('theming', 'logoMime', false);
143
-		if(!$logo || $file === null) {
144
-			return $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core','logo.svg'));
145
-		} else {
146
-			return $this->urlGenerator->linkToRouteAbsolute('theming.Theming.getLogo');
147
-		}
148
-	}
131
+    /**
132
+     * Themed logo url
133
+     *
134
+     * @return string
135
+     */
136
+    public function getLogo() {
137
+        try {
138
+            $file = $this->appData->getFolder('images')->getFile('logo');
139
+        } catch (NotFoundException $e) {
140
+            $file = null;
141
+        }
142
+        $logo = $this->config->getAppValue('theming', 'logoMime', false);
143
+        if(!$logo || $file === null) {
144
+            return $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core','logo.svg'));
145
+        } else {
146
+            return $this->urlGenerator->linkToRouteAbsolute('theming.Theming.getLogo');
147
+        }
148
+    }
149 149
 
150
-	/**
151
-	 * Themed background image url
152
-	 *
153
-	 * @return string
154
-	 */
155
-	public function getBackground() {
156
-		try {
157
-			$file = $this->appData->getFolder('images')->getFile('background');
158
-		} catch (NotFoundException $e) {
159
-			$file = null;
160
-		}
161
-		$backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', false);
162
-		if(!$backgroundLogo || $file === null) {
163
-			return $this->urlGenerator->imagePath('core','background.jpg');
164
-		} else {
165
-			return $this->urlGenerator->linkToRouteAbsolute('theming.Theming.getLoginBackground');
166
-		}
167
-	}
150
+    /**
151
+     * Themed background image url
152
+     *
153
+     * @return string
154
+     */
155
+    public function getBackground() {
156
+        try {
157
+            $file = $this->appData->getFolder('images')->getFile('background');
158
+        } catch (NotFoundException $e) {
159
+            $file = null;
160
+        }
161
+        $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', false);
162
+        if(!$backgroundLogo || $file === null) {
163
+            return $this->urlGenerator->imagePath('core','background.jpg');
164
+        } else {
165
+            return $this->urlGenerator->linkToRouteAbsolute('theming.Theming.getLoginBackground');
166
+        }
167
+    }
168 168
 
169 169
 
170
-	/**
171
-	 * @return array scss variables to overwrite
172
-	 */
173
-	public function getScssVariables() {
174
-		$cache = $this->cacheFactory->create('theming');
175
-		if ($value = $cache->get('getScssVariables')) {
176
-			return $value;
177
-		}
170
+    /**
171
+     * @return array scss variables to overwrite
172
+     */
173
+    public function getScssVariables() {
174
+        $cache = $this->cacheFactory->create('theming');
175
+        if ($value = $cache->get('getScssVariables')) {
176
+            return $value;
177
+        }
178 178
 
179
-		$variables = [
180
-			'theming-cachebuster' => "'" . $this->config->getAppValue('theming', 'cachebuster', '0') . "'",
181
-		];
179
+        $variables = [
180
+            'theming-cachebuster' => "'" . $this->config->getAppValue('theming', 'cachebuster', '0') . "'",
181
+        ];
182 182
 
183
-		$variables['image-logo'] = "'".$this->getLogo()."'";
184
-		$variables['image-login-background'] = "'".$this->getBackground()."'";
183
+        $variables['image-logo'] = "'".$this->getLogo()."'";
184
+        $variables['image-login-background'] = "'".$this->getBackground()."'";
185 185
 
186
-		if ($this->config->getAppValue('theming', 'color', null) !== null) {
187
-			if ($this->util->invertTextColor($this->getMailHeaderColor())) {
188
-				$colorPrimaryText = '#000000';
189
-			} else {
190
-				$colorPrimaryText = '#ffffff';
191
-			}
192
-			$variables['color-primary'] = $this->getMailHeaderColor();
193
-			$variables['color-primary-text'] = $colorPrimaryText;
194
-		}
195
-		$cache->set('getScssVariables', $variables);
196
-		return $variables;
197
-	}
186
+        if ($this->config->getAppValue('theming', 'color', null) !== null) {
187
+            if ($this->util->invertTextColor($this->getMailHeaderColor())) {
188
+                $colorPrimaryText = '#000000';
189
+            } else {
190
+                $colorPrimaryText = '#ffffff';
191
+            }
192
+            $variables['color-primary'] = $this->getMailHeaderColor();
193
+            $variables['color-primary-text'] = $colorPrimaryText;
194
+        }
195
+        $cache->set('getScssVariables', $variables);
196
+        return $variables;
197
+    }
198 198
 
199
-	/**
200
-	 * Check if Imagemagick is enabled and if SVG is supported
201
-	 * otherwise we can't render custom icons
202
-	 *
203
-	 * @return bool
204
-	 */
205
-	public function shouldReplaceIcons() {
206
-		$cache = $this->cacheFactory->create('theming');
207
-		if($value = $cache->get('shouldReplaceIcons')) {
208
-			return (bool)$value;
209
-		}
210
-		$value = false;
211
-		if(extension_loaded('imagick')) {
212
-			$checkImagick = new \Imagick();
213
-			if (count($checkImagick->queryFormats('SVG')) >= 1) {
214
-				$value = true;
215
-			}
216
-			$checkImagick->clear();
217
-		}
218
-		$cache->set('shouldReplaceIcons', $value);
219
-		return $value;
220
-	}
199
+    /**
200
+     * Check if Imagemagick is enabled and if SVG is supported
201
+     * otherwise we can't render custom icons
202
+     *
203
+     * @return bool
204
+     */
205
+    public function shouldReplaceIcons() {
206
+        $cache = $this->cacheFactory->create('theming');
207
+        if($value = $cache->get('shouldReplaceIcons')) {
208
+            return (bool)$value;
209
+        }
210
+        $value = false;
211
+        if(extension_loaded('imagick')) {
212
+            $checkImagick = new \Imagick();
213
+            if (count($checkImagick->queryFormats('SVG')) >= 1) {
214
+                $value = true;
215
+            }
216
+            $checkImagick->clear();
217
+        }
218
+        $cache->set('shouldReplaceIcons', $value);
219
+        return $value;
220
+    }
221 221
 
222
-	/**
223
-	 * Increases the cache buster key
224
-	 */
225
-	private function increaseCacheBuster() {
226
-		$cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0');
227
-		$this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1);
228
-		$this->cacheFactory->create('theming')->clear('getScssVariables');
229
-	}
222
+    /**
223
+     * Increases the cache buster key
224
+     */
225
+    private function increaseCacheBuster() {
226
+        $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0');
227
+        $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1);
228
+        $this->cacheFactory->create('theming')->clear('getScssVariables');
229
+    }
230 230
 
231
-	/**
232
-	 * Update setting in the database
233
-	 *
234
-	 * @param string $setting
235
-	 * @param string $value
236
-	 */
237
-	public function set($setting, $value) {
238
-		$this->config->setAppValue('theming', $setting, $value);
239
-		$this->increaseCacheBuster();
240
-	}
231
+    /**
232
+     * Update setting in the database
233
+     *
234
+     * @param string $setting
235
+     * @param string $value
236
+     */
237
+    public function set($setting, $value) {
238
+        $this->config->setAppValue('theming', $setting, $value);
239
+        $this->increaseCacheBuster();
240
+    }
241 241
 
242
-	/**
243
-	 * Revert settings to the default value
244
-	 *
245
-	 * @param string $setting setting which should be reverted
246
-	 * @return string default value
247
-	 */
248
-	public function undo($setting) {
249
-		$this->config->deleteAppValue('theming', $setting);
250
-		$this->increaseCacheBuster();
242
+    /**
243
+     * Revert settings to the default value
244
+     *
245
+     * @param string $setting setting which should be reverted
246
+     * @return string default value
247
+     */
248
+    public function undo($setting) {
249
+        $this->config->deleteAppValue('theming', $setting);
250
+        $this->increaseCacheBuster();
251 251
 
252
-		switch ($setting) {
253
-			case 'name':
254
-				$returnValue = $this->getEntity();
255
-				break;
256
-			case 'url':
257
-				$returnValue = $this->getBaseUrl();
258
-				break;
259
-			case 'slogan':
260
-				$returnValue = $this->getSlogan();
261
-				break;
262
-			case 'color':
263
-				$returnValue = $this->getMailHeaderColor();
264
-				break;
265
-			default:
266
-				$returnValue = '';
267
-				break;
268
-		}
252
+        switch ($setting) {
253
+            case 'name':
254
+                $returnValue = $this->getEntity();
255
+                break;
256
+            case 'url':
257
+                $returnValue = $this->getBaseUrl();
258
+                break;
259
+            case 'slogan':
260
+                $returnValue = $this->getSlogan();
261
+                break;
262
+            case 'color':
263
+                $returnValue = $this->getMailHeaderColor();
264
+                break;
265
+            default:
266
+                $returnValue = '';
267
+                break;
268
+        }
269 269
 
270
-		return $returnValue;
271
-	}
270
+        return $returnValue;
271
+    }
272 272
 
273 273
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 
113 113
 	public function getShortFooter() {
114 114
 		$slogan = $this->getSlogan();
115
-		$footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' .
116
-			' rel="noreferrer">' .$this->getEntity() . '</a>'.
117
-			($slogan !== '' ? ' – ' . $slogan : '');
115
+		$footer = '<a href="'.$this->getBaseUrl().'" target="_blank"'.
116
+			' rel="noreferrer">'.$this->getEntity().'</a>'.
117
+			($slogan !== '' ? ' – '.$slogan : '');
118 118
 
119 119
 		return $footer;
120 120
 	}
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 			$file = null;
141 141
 		}
142 142
 		$logo = $this->config->getAppValue('theming', 'logoMime', false);
143
-		if(!$logo || $file === null) {
144
-			return $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core','logo.svg'));
143
+		if (!$logo || $file === null) {
144
+			return $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'logo.svg'));
145 145
 		} else {
146 146
 			return $this->urlGenerator->linkToRouteAbsolute('theming.Theming.getLogo');
147 147
 		}
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 			$file = null;
160 160
 		}
161 161
 		$backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', false);
162
-		if(!$backgroundLogo || $file === null) {
163
-			return $this->urlGenerator->imagePath('core','background.jpg');
162
+		if (!$backgroundLogo || $file === null) {
163
+			return $this->urlGenerator->imagePath('core', 'background.jpg');
164 164
 		} else {
165 165
 			return $this->urlGenerator->linkToRouteAbsolute('theming.Theming.getLoginBackground');
166 166
 		}
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		}
178 178
 
179 179
 		$variables = [
180
-			'theming-cachebuster' => "'" . $this->config->getAppValue('theming', 'cachebuster', '0') . "'",
180
+			'theming-cachebuster' => "'".$this->config->getAppValue('theming', 'cachebuster', '0')."'",
181 181
 		];
182 182
 
183 183
 		$variables['image-logo'] = "'".$this->getLogo()."'";
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
 	 */
205 205
 	public function shouldReplaceIcons() {
206 206
 		$cache = $this->cacheFactory->create('theming');
207
-		if($value = $cache->get('shouldReplaceIcons')) {
208
-			return (bool)$value;
207
+		if ($value = $cache->get('shouldReplaceIcons')) {
208
+			return (bool) $value;
209 209
 		}
210 210
 		$value = false;
211
-		if(extension_loaded('imagick')) {
211
+		if (extension_loaded('imagick')) {
212 212
 			$checkImagick = new \Imagick();
213 213
 			if (count($checkImagick->queryFormats('SVG')) >= 1) {
214 214
 				$value = true;
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	 */
225 225
 	private function increaseCacheBuster() {
226 226
 		$cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0');
227
-		$this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1);
227
+		$this->config->setAppValue('theming', 'cachebuster', (int) $cacheBusterKey + 1);
228 228
 		$this->cacheFactory->create('theming')->clear('getScssVariables');
229 229
 	}
230 230
 
Please login to merge, or discard this patch.
lib/private/TemplateLayout.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -52,46 +52,46 @@  discard block
 block discarded – undo
52 52
 	 * @param string $renderAs
53 53
 	 * @param string $appId application id
54 54
 	 */
55
-	public function __construct( $renderAs, $appId = '' ) {
55
+	public function __construct($renderAs, $appId = '') {
56 56
 
57 57
 		// yes - should be injected ....
58 58
 		$this->config = \OC::$server->getConfig();
59 59
 
60 60
 
61 61
 		// Decide which page we show
62
-		if($renderAs == 'user') {
63
-			parent::__construct( 'core', 'layout.user' );
64
-			if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) {
62
+		if ($renderAs == 'user') {
63
+			parent::__construct('core', 'layout.user');
64
+			if (in_array(\OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) {
65 65
 				$this->assign('bodyid', 'body-settings');
66
-			}else{
66
+			} else {
67 67
 				$this->assign('bodyid', 'body-user');
68 68
 			}
69 69
 
70 70
 			// Code integrity notification
71 71
 			$integrityChecker = \OC::$server->getIntegrityCodeChecker();
72
-			if(\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) {
72
+			if (\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) {
73 73
 				\OCP\Util::addScript('core', 'integritycheck-failed-notification');
74 74
 			}
75 75
 
76 76
 			// Add navigation entry
77
-			$this->assign( 'application', '');
78
-			$this->assign( 'appid', $appId );
77
+			$this->assign('application', '');
78
+			$this->assign('appid', $appId);
79 79
 			$navigation = \OC_App::getNavigation();
80
-			$this->assign( 'navigation', $navigation);
80
+			$this->assign('navigation', $navigation);
81 81
 			$navigation = \OC_App::getHeaderNavigation();
82
-			$this->assign( 'headernavigation', $navigation);
82
+			$this->assign('headernavigation', $navigation);
83 83
 			$settingsNavigation = \OC_App::getSettingsNavigation();
84
-			$this->assign( 'settingsnavigation', $settingsNavigation);
85
-			foreach($navigation as $entry) {
84
+			$this->assign('settingsnavigation', $settingsNavigation);
85
+			foreach ($navigation as $entry) {
86 86
 				if ($entry['active']) {
87
-					$this->assign( 'application', $entry['name'] );
87
+					$this->assign('application', $entry['name']);
88 88
 					break;
89 89
 				}
90 90
 			}
91 91
 			
92
-			foreach($settingsNavigation as $entry) {
92
+			foreach ($settingsNavigation as $entry) {
93 93
 				if ($entry['active']) {
94
-					$this->assign( 'application', $entry['name'] );
94
+					$this->assign('application', $entry['name']);
95 95
 					break;
96 96
 				}
97 97
 			}
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		// Send the language to our layouts
126 126
 		$this->assign('language', \OC::$server->getL10NFactory()->findLanguage());
127 127
 
128
-		if(\OC::$server->getSystemConfig()->getValue('installed', false)) {
128
+		if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
129 129
 			if (empty(self::$versionHash)) {
130 130
 				$v = \OC_App::getAppVersions();
131 131
 				$v['core'] = implode('.', \OCP\Util::getVersion());
@@ -156,10 +156,10 @@  discard block
 block discarded – undo
156 156
 				$this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash]));
157 157
 			}
158 158
 		}
159
-		foreach($jsFiles as $info) {
159
+		foreach ($jsFiles as $info) {
160 160
 			$web = $info[1];
161 161
 			$file = $info[2];
162
-			$this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
162
+			$this->append('jsfiles', $web.'/'.$file.$this->getVersionHashSuffix());
163 163
 		}
164 164
 
165 165
 		try {
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
 		// Do not initialise scss appdata until we have a fully installed instance
172 172
 		// Do not load scss for update, errors, installation or login page
173
-		if(\OC::$server->getSystemConfig()->getValue('installed', false)
173
+		if (\OC::$server->getSystemConfig()->getValue('installed', false)
174 174
 			&& !\OCP\Util::needUpgrade()
175 175
 			&& $pathInfo !== ''
176 176
 			&& !preg_match('/^\/login/', $pathInfo)) {
@@ -185,25 +185,25 @@  discard block
 block discarded – undo
185 185
 		$this->assign('cssfiles', array());
186 186
 		$this->assign('printcssfiles', []);
187 187
 		$this->assign('versionHash', self::$versionHash);
188
-		foreach($cssFiles as $info) {
188
+		foreach ($cssFiles as $info) {
189 189
 			$web = $info[1];
190 190
 			$file = $info[2];
191 191
 
192 192
 			if (substr($file, -strlen('print.css')) === 'print.css') {
193
-				$this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
193
+				$this->append('printcssfiles', $web.'/'.$file.$this->getVersionHashSuffix());
194 194
 			} else {
195
-				$this->append( 'cssfiles', $web.'/'.$file . $this->getVersionHashSuffix()  );
195
+				$this->append('cssfiles', $web.'/'.$file.$this->getVersionHashSuffix());
196 196
 			}
197 197
 		}
198 198
 	}
199 199
 
200 200
 	protected function getVersionHashSuffix() {
201
-		if(\OC::$server->getConfig()->getSystemValue('debug', false)) {
201
+		if (\OC::$server->getConfig()->getSystemValue('debug', false)) {
202 202
 			// allows chrome workspace mapping in debug mode
203 203
 			return "";
204 204
 		}
205 205
 
206
-		return '?v=' . self::$versionHash;
206
+		return '?v='.self::$versionHash;
207 207
 	}
208 208
 
209 209
 	/**
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		// Read the selected theme from the config file
215 215
 		$theme = \OC_Util::getTheme();
216 216
 
217
-		if($compileScss) {
217
+		if ($compileScss) {
218 218
 			$SCSSCacher = \OC::$server->query(SCSSCacher::class);
219 219
 		} else {
220 220
 			$SCSSCacher = null;
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 		$locator = new \OC\Template\CSSResourceLocator(
224 224
 			\OC::$server->getLogger(),
225 225
 			$theme,
226
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
227
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
226
+			array(\OC::$SERVERROOT => \OC::$WEBROOT),
227
+			array(\OC::$SERVERROOT => \OC::$WEBROOT),
228 228
 			$SCSSCacher
229 229
 		);
230 230
 		$locator->find($styles);
@@ -242,8 +242,8 @@  discard block
 block discarded – undo
242 242
 		$locator = new \OC\Template\JSResourceLocator(
243 243
 			\OC::$server->getLogger(),
244 244
 			$theme,
245
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
246
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
245
+			array(\OC::$SERVERROOT => \OC::$WEBROOT),
246
+			array(\OC::$SERVERROOT => \OC::$WEBROOT),
247 247
 			new JSCombiner(
248 248
 				\OC::$server->getAppDataDir('js'),
249 249
 				\OC::$server->getURLGenerator(),
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	 */
264 264
 	public static function convertToRelativePath($filePath) {
265 265
 		$relativePath = explode(\OC::$SERVERROOT, $filePath);
266
-		if(count($relativePath) !== 2) {
266
+		if (count($relativePath) !== 2) {
267 267
 			throw new \Exception('$filePath is not under the \OC::$SERVERROOT');
268 268
 		}
269 269
 
Please login to merge, or discard this patch.
Indentation   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -41,226 +41,226 @@
 block discarded – undo
41 41
 
42 42
 class TemplateLayout extends \OC_Template {
43 43
 
44
-	private static $versionHash = '';
44
+    private static $versionHash = '';
45 45
 
46
-	/**
47
-	 * @var \OCP\IConfig
48
-	 */
49
-	private $config;
46
+    /**
47
+     * @var \OCP\IConfig
48
+     */
49
+    private $config;
50 50
 
51
-	/**
52
-	 * @param string $renderAs
53
-	 * @param string $appId application id
54
-	 */
55
-	public function __construct( $renderAs, $appId = '' ) {
51
+    /**
52
+     * @param string $renderAs
53
+     * @param string $appId application id
54
+     */
55
+    public function __construct( $renderAs, $appId = '' ) {
56 56
 
57
-		// yes - should be injected ....
58
-		$this->config = \OC::$server->getConfig();
57
+        // yes - should be injected ....
58
+        $this->config = \OC::$server->getConfig();
59 59
 
60 60
 
61
-		// Decide which page we show
62
-		if($renderAs == 'user') {
63
-			parent::__construct( 'core', 'layout.user' );
64
-			if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) {
65
-				$this->assign('bodyid', 'body-settings');
66
-			}else{
67
-				$this->assign('bodyid', 'body-user');
68
-			}
61
+        // Decide which page we show
62
+        if($renderAs == 'user') {
63
+            parent::__construct( 'core', 'layout.user' );
64
+            if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) {
65
+                $this->assign('bodyid', 'body-settings');
66
+            }else{
67
+                $this->assign('bodyid', 'body-user');
68
+            }
69 69
 
70
-			// Code integrity notification
71
-			$integrityChecker = \OC::$server->getIntegrityCodeChecker();
72
-			if(\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) {
73
-				\OCP\Util::addScript('core', 'integritycheck-failed-notification');
74
-			}
70
+            // Code integrity notification
71
+            $integrityChecker = \OC::$server->getIntegrityCodeChecker();
72
+            if(\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) {
73
+                \OCP\Util::addScript('core', 'integritycheck-failed-notification');
74
+            }
75 75
 
76
-			// Add navigation entry
77
-			$this->assign( 'application', '');
78
-			$this->assign( 'appid', $appId );
79
-			$navigation = \OC_App::getNavigation();
80
-			$this->assign( 'navigation', $navigation);
81
-			$navigation = \OC_App::getHeaderNavigation();
82
-			$this->assign( 'headernavigation', $navigation);
83
-			$settingsNavigation = \OC_App::getSettingsNavigation();
84
-			$this->assign( 'settingsnavigation', $settingsNavigation);
85
-			foreach($navigation as $entry) {
86
-				if ($entry['active']) {
87
-					$this->assign( 'application', $entry['name'] );
88
-					break;
89
-				}
90
-			}
76
+            // Add navigation entry
77
+            $this->assign( 'application', '');
78
+            $this->assign( 'appid', $appId );
79
+            $navigation = \OC_App::getNavigation();
80
+            $this->assign( 'navigation', $navigation);
81
+            $navigation = \OC_App::getHeaderNavigation();
82
+            $this->assign( 'headernavigation', $navigation);
83
+            $settingsNavigation = \OC_App::getSettingsNavigation();
84
+            $this->assign( 'settingsnavigation', $settingsNavigation);
85
+            foreach($navigation as $entry) {
86
+                if ($entry['active']) {
87
+                    $this->assign( 'application', $entry['name'] );
88
+                    break;
89
+                }
90
+            }
91 91
 			
92
-			foreach($settingsNavigation as $entry) {
93
-				if ($entry['active']) {
94
-					$this->assign( 'application', $entry['name'] );
95
-					break;
96
-				}
97
-			}
98
-			$userDisplayName = \OC_User::getDisplayName();
99
-			$this->assign('user_displayname', $userDisplayName);
100
-			$this->assign('user_uid', \OC_User::getUser());
92
+            foreach($settingsNavigation as $entry) {
93
+                if ($entry['active']) {
94
+                    $this->assign( 'application', $entry['name'] );
95
+                    break;
96
+                }
97
+            }
98
+            $userDisplayName = \OC_User::getDisplayName();
99
+            $this->assign('user_displayname', $userDisplayName);
100
+            $this->assign('user_uid', \OC_User::getUser());
101 101
 
102
-			if (\OC_User::getUser() === false) {
103
-				$this->assign('userAvatarSet', false);
104
-			} else {
105
-				$this->assign('userAvatarSet', \OC::$server->getAvatarManager()->getAvatar(\OC_User::getUser())->exists());
106
-				$this->assign('userAvatarVersion', \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), 'avatar', 'version', 0));
107
-			}
102
+            if (\OC_User::getUser() === false) {
103
+                $this->assign('userAvatarSet', false);
104
+            } else {
105
+                $this->assign('userAvatarSet', \OC::$server->getAvatarManager()->getAvatar(\OC_User::getUser())->exists());
106
+                $this->assign('userAvatarVersion', \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), 'avatar', 'version', 0));
107
+            }
108 108
 
109
-		} else if ($renderAs == 'error') {
110
-			parent::__construct('core', 'layout.guest', '', false);
111
-			$this->assign('bodyid', 'body-login');
112
-		} else if ($renderAs == 'guest') {
113
-			parent::__construct('core', 'layout.guest');
114
-			$this->assign('bodyid', 'body-login');
115
-		} else {
116
-			parent::__construct('core', 'layout.base');
109
+        } else if ($renderAs == 'error') {
110
+            parent::__construct('core', 'layout.guest', '', false);
111
+            $this->assign('bodyid', 'body-login');
112
+        } else if ($renderAs == 'guest') {
113
+            parent::__construct('core', 'layout.guest');
114
+            $this->assign('bodyid', 'body-login');
115
+        } else {
116
+            parent::__construct('core', 'layout.base');
117 117
 
118
-		}
119
-		// Send the language to our layouts
120
-		$this->assign('language', \OC::$server->getL10NFactory()->findLanguage());
118
+        }
119
+        // Send the language to our layouts
120
+        $this->assign('language', \OC::$server->getL10NFactory()->findLanguage());
121 121
 
122
-		if(\OC::$server->getSystemConfig()->getValue('installed', false)) {
123
-			if (empty(self::$versionHash)) {
124
-				$v = \OC_App::getAppVersions();
125
-				$v['core'] = implode('.', \OCP\Util::getVersion());
126
-				self::$versionHash = md5(implode(',', $v));
127
-			}
128
-		} else {
129
-			self::$versionHash = md5('not installed');
130
-		}
122
+        if(\OC::$server->getSystemConfig()->getValue('installed', false)) {
123
+            if (empty(self::$versionHash)) {
124
+                $v = \OC_App::getAppVersions();
125
+                $v['core'] = implode('.', \OCP\Util::getVersion());
126
+                self::$versionHash = md5(implode(',', $v));
127
+            }
128
+        } else {
129
+            self::$versionHash = md5('not installed');
130
+        }
131 131
 
132
-		// Add the js files
133
-		$jsFiles = self::findJavascriptFiles(\OC_Util::$scripts);
134
-		$this->assign('jsfiles', array());
135
-		if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
136
-			if (\OC::$server->getContentSecurityPolicyNonceManager()->browserSupportsCspV3()) {
137
-				$jsConfigHelper = new JSConfigHelper(
138
-					\OC::$server->getL10N('core'),
139
-					\OC::$server->getThemingDefaults(),
140
-					\OC::$server->getAppManager(),
141
-					\OC::$server->getSession(),
142
-					\OC::$server->getUserSession()->getUser(),
143
-					\OC::$server->getConfig(),
144
-					\OC::$server->getGroupManager(),
145
-					\OC::$server->getIniWrapper(),
146
-					\OC::$server->getURLGenerator()
147
-				);
148
-				$this->assign('inline_ocjs', $jsConfigHelper->getConfig());
149
-			} else {
150
-				$this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash]));
151
-			}
152
-		}
153
-		foreach($jsFiles as $info) {
154
-			$web = $info[1];
155
-			$file = $info[2];
156
-			$this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
157
-		}
132
+        // Add the js files
133
+        $jsFiles = self::findJavascriptFiles(\OC_Util::$scripts);
134
+        $this->assign('jsfiles', array());
135
+        if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
136
+            if (\OC::$server->getContentSecurityPolicyNonceManager()->browserSupportsCspV3()) {
137
+                $jsConfigHelper = new JSConfigHelper(
138
+                    \OC::$server->getL10N('core'),
139
+                    \OC::$server->getThemingDefaults(),
140
+                    \OC::$server->getAppManager(),
141
+                    \OC::$server->getSession(),
142
+                    \OC::$server->getUserSession()->getUser(),
143
+                    \OC::$server->getConfig(),
144
+                    \OC::$server->getGroupManager(),
145
+                    \OC::$server->getIniWrapper(),
146
+                    \OC::$server->getURLGenerator()
147
+                );
148
+                $this->assign('inline_ocjs', $jsConfigHelper->getConfig());
149
+            } else {
150
+                $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash]));
151
+            }
152
+        }
153
+        foreach($jsFiles as $info) {
154
+            $web = $info[1];
155
+            $file = $info[2];
156
+            $this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
157
+        }
158 158
 
159
-		try {
160
-			$pathInfo = \OC::$server->getRequest()->getPathInfo();
161
-		} catch (\Exception $e) {
162
-			$pathInfo = '';
163
-		}
159
+        try {
160
+            $pathInfo = \OC::$server->getRequest()->getPathInfo();
161
+        } catch (\Exception $e) {
162
+            $pathInfo = '';
163
+        }
164 164
 
165
-		// Do not initialise scss appdata until we have a fully installed instance
166
-		// Do not load scss for update, errors, installation or login page
167
-		if(\OC::$server->getSystemConfig()->getValue('installed', false)
168
-			&& !\OCP\Util::needUpgrade()
169
-			&& $pathInfo !== ''
170
-			&& !preg_match('/^\/login/', $pathInfo)) {
171
-			$cssFiles = self::findStylesheetFiles(\OC_Util::$styles);
172
-		} else {
173
-			// If we ignore the scss compiler,
174
-			// we need to load the guest css fallback
175
-			\OC_Util::addStyle('guest');
176
-			$cssFiles = self::findStylesheetFiles(\OC_Util::$styles, false);
177
-		}
165
+        // Do not initialise scss appdata until we have a fully installed instance
166
+        // Do not load scss for update, errors, installation or login page
167
+        if(\OC::$server->getSystemConfig()->getValue('installed', false)
168
+            && !\OCP\Util::needUpgrade()
169
+            && $pathInfo !== ''
170
+            && !preg_match('/^\/login/', $pathInfo)) {
171
+            $cssFiles = self::findStylesheetFiles(\OC_Util::$styles);
172
+        } else {
173
+            // If we ignore the scss compiler,
174
+            // we need to load the guest css fallback
175
+            \OC_Util::addStyle('guest');
176
+            $cssFiles = self::findStylesheetFiles(\OC_Util::$styles, false);
177
+        }
178 178
 
179
-		$this->assign('cssfiles', array());
180
-		$this->assign('printcssfiles', []);
181
-		$this->assign('versionHash', self::$versionHash);
182
-		foreach($cssFiles as $info) {
183
-			$web = $info[1];
184
-			$file = $info[2];
179
+        $this->assign('cssfiles', array());
180
+        $this->assign('printcssfiles', []);
181
+        $this->assign('versionHash', self::$versionHash);
182
+        foreach($cssFiles as $info) {
183
+            $web = $info[1];
184
+            $file = $info[2];
185 185
 
186
-			if (substr($file, -strlen('print.css')) === 'print.css') {
187
-				$this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
188
-			} else {
189
-				$this->append( 'cssfiles', $web.'/'.$file . $this->getVersionHashSuffix()  );
190
-			}
191
-		}
192
-	}
186
+            if (substr($file, -strlen('print.css')) === 'print.css') {
187
+                $this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
188
+            } else {
189
+                $this->append( 'cssfiles', $web.'/'.$file . $this->getVersionHashSuffix()  );
190
+            }
191
+        }
192
+    }
193 193
 
194
-	protected function getVersionHashSuffix() {
195
-		if(\OC::$server->getConfig()->getSystemValue('debug', false)) {
196
-			// allows chrome workspace mapping in debug mode
197
-			return "";
198
-		}
194
+    protected function getVersionHashSuffix() {
195
+        if(\OC::$server->getConfig()->getSystemValue('debug', false)) {
196
+            // allows chrome workspace mapping in debug mode
197
+            return "";
198
+        }
199 199
 
200
-		return '?v=' . self::$versionHash;
201
-	}
200
+        return '?v=' . self::$versionHash;
201
+    }
202 202
 
203
-	/**
204
-	 * @param array $styles
205
-	 * @return array
206
-	 */
207
-	static public function findStylesheetFiles($styles, $compileScss = true) {
208
-		// Read the selected theme from the config file
209
-		$theme = \OC_Util::getTheme();
203
+    /**
204
+     * @param array $styles
205
+     * @return array
206
+     */
207
+    static public function findStylesheetFiles($styles, $compileScss = true) {
208
+        // Read the selected theme from the config file
209
+        $theme = \OC_Util::getTheme();
210 210
 
211
-		if($compileScss) {
212
-			$SCSSCacher = \OC::$server->query(SCSSCacher::class);
213
-		} else {
214
-			$SCSSCacher = null;
215
-		}
211
+        if($compileScss) {
212
+            $SCSSCacher = \OC::$server->query(SCSSCacher::class);
213
+        } else {
214
+            $SCSSCacher = null;
215
+        }
216 216
 
217
-		$locator = new \OC\Template\CSSResourceLocator(
218
-			\OC::$server->getLogger(),
219
-			$theme,
220
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
221
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
222
-			$SCSSCacher
223
-		);
224
-		$locator->find($styles);
225
-		return $locator->getResources();
226
-	}
217
+        $locator = new \OC\Template\CSSResourceLocator(
218
+            \OC::$server->getLogger(),
219
+            $theme,
220
+            array( \OC::$SERVERROOT => \OC::$WEBROOT ),
221
+            array( \OC::$SERVERROOT => \OC::$WEBROOT ),
222
+            $SCSSCacher
223
+        );
224
+        $locator->find($styles);
225
+        return $locator->getResources();
226
+    }
227 227
 
228
-	/**
229
-	 * @param array $scripts
230
-	 * @return array
231
-	 */
232
-	static public function findJavascriptFiles($scripts) {
233
-		// Read the selected theme from the config file
234
-		$theme = \OC_Util::getTheme();
228
+    /**
229
+     * @param array $scripts
230
+     * @return array
231
+     */
232
+    static public function findJavascriptFiles($scripts) {
233
+        // Read the selected theme from the config file
234
+        $theme = \OC_Util::getTheme();
235 235
 
236
-		$locator = new \OC\Template\JSResourceLocator(
237
-			\OC::$server->getLogger(),
238
-			$theme,
239
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
240
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
241
-			new JSCombiner(
242
-				\OC::$server->getAppDataDir('js'),
243
-				\OC::$server->getURLGenerator(),
244
-				\OC::$server->getMemCacheFactory()->create('JS'),
245
-				\OC::$server->getSystemConfig()
246
-			)
247
-			);
248
-		$locator->find($scripts);
249
-		return $locator->getResources();
250
-	}
236
+        $locator = new \OC\Template\JSResourceLocator(
237
+            \OC::$server->getLogger(),
238
+            $theme,
239
+            array( \OC::$SERVERROOT => \OC::$WEBROOT ),
240
+            array( \OC::$SERVERROOT => \OC::$WEBROOT ),
241
+            new JSCombiner(
242
+                \OC::$server->getAppDataDir('js'),
243
+                \OC::$server->getURLGenerator(),
244
+                \OC::$server->getMemCacheFactory()->create('JS'),
245
+                \OC::$server->getSystemConfig()
246
+            )
247
+            );
248
+        $locator->find($scripts);
249
+        return $locator->getResources();
250
+    }
251 251
 
252
-	/**
253
-	 * Converts the absolute file path to a relative path from \OC::$SERVERROOT
254
-	 * @param string $filePath Absolute path
255
-	 * @return string Relative path
256
-	 * @throws \Exception If $filePath is not under \OC::$SERVERROOT
257
-	 */
258
-	public static function convertToRelativePath($filePath) {
259
-		$relativePath = explode(\OC::$SERVERROOT, $filePath);
260
-		if(count($relativePath) !== 2) {
261
-			throw new \Exception('$filePath is not under the \OC::$SERVERROOT');
262
-		}
252
+    /**
253
+     * Converts the absolute file path to a relative path from \OC::$SERVERROOT
254
+     * @param string $filePath Absolute path
255
+     * @return string Relative path
256
+     * @throws \Exception If $filePath is not under \OC::$SERVERROOT
257
+     */
258
+    public static function convertToRelativePath($filePath) {
259
+        $relativePath = explode(\OC::$SERVERROOT, $filePath);
260
+        if(count($relativePath) !== 2) {
261
+            throw new \Exception('$filePath is not under the \OC::$SERVERROOT');
262
+        }
263 263
 
264
-		return $relativePath[1];
265
-	}
264
+        return $relativePath[1];
265
+    }
266 266
 }
Please login to merge, or discard this patch.