@@ -100,40 +100,40 @@ discard block |
||
100 | 100 | * |
101 | 101 | * Returns a url to the given app and file. |
102 | 102 | */ |
103 | - public function linkTo( $app, $file, $args = array() ) { |
|
103 | + public function linkTo($app, $file, $args = array()) { |
|
104 | 104 | $frontControllerActive = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'); |
105 | 105 | |
106 | - if( $app != '' ) { |
|
106 | + if ($app != '') { |
|
107 | 107 | $app_path = \OC_App::getAppPath($app); |
108 | 108 | // Check if the app is in the app folder |
109 | - if ($app_path && file_exists($app_path . '/' . $file)) { |
|
109 | + if ($app_path && file_exists($app_path.'/'.$file)) { |
|
110 | 110 | if (substr($file, -3) == 'php') { |
111 | 111 | |
112 | - $urlLinkTo = \OC::$WEBROOT . '/index.php/apps/' . $app; |
|
112 | + $urlLinkTo = \OC::$WEBROOT.'/index.php/apps/'.$app; |
|
113 | 113 | if ($frontControllerActive) { |
114 | - $urlLinkTo = \OC::$WEBROOT . '/apps/' . $app; |
|
114 | + $urlLinkTo = \OC::$WEBROOT.'/apps/'.$app; |
|
115 | 115 | } |
116 | - $urlLinkTo .= ($file != 'index.php') ? '/' . $file : ''; |
|
116 | + $urlLinkTo .= ($file != 'index.php') ? '/'.$file : ''; |
|
117 | 117 | } else { |
118 | - $urlLinkTo = \OC_App::getAppWebPath($app) . '/' . $file; |
|
118 | + $urlLinkTo = \OC_App::getAppWebPath($app).'/'.$file; |
|
119 | 119 | } |
120 | 120 | } else { |
121 | - $urlLinkTo = \OC::$WEBROOT . '/' . $app . '/' . $file; |
|
121 | + $urlLinkTo = \OC::$WEBROOT.'/'.$app.'/'.$file; |
|
122 | 122 | } |
123 | 123 | } else { |
124 | - if (file_exists(\OC::$SERVERROOT . '/core/' . $file)) { |
|
125 | - $urlLinkTo = \OC::$WEBROOT . '/core/' . $file; |
|
124 | + if (file_exists(\OC::$SERVERROOT.'/core/'.$file)) { |
|
125 | + $urlLinkTo = \OC::$WEBROOT.'/core/'.$file; |
|
126 | 126 | } else { |
127 | 127 | if ($frontControllerActive && $file === 'index.php') { |
128 | - $urlLinkTo = \OC::$WEBROOT . '/'; |
|
128 | + $urlLinkTo = \OC::$WEBROOT.'/'; |
|
129 | 129 | } else { |
130 | - $urlLinkTo = \OC::$WEBROOT . '/' . $file; |
|
130 | + $urlLinkTo = \OC::$WEBROOT.'/'.$file; |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
135 | 135 | if ($args && $query = http_build_query($args, '', '&')) { |
136 | - $urlLinkTo .= '?' . $query; |
|
136 | + $urlLinkTo .= '?'.$query; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | return $urlLinkTo; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | public function imagePath($app, $image) { |
152 | 152 | $cache = $this->cacheFactory->create('imagePath-'.md5($this->getBaseUrl()).'-'); |
153 | 153 | $cacheKey = $app.'-'.$image; |
154 | - if($key = $cache->get($cacheKey)) { |
|
154 | + if ($key = $cache->get($cacheKey)) { |
|
155 | 155 | return $key; |
156 | 156 | } |
157 | 157 | |
@@ -159,62 +159,62 @@ discard block |
||
159 | 159 | $theme = \OC_Util::getTheme(); |
160 | 160 | |
161 | 161 | //if a theme has a png but not an svg always use the png |
162 | - $basename = substr(basename($image),0,-4); |
|
162 | + $basename = substr(basename($image), 0, -4); |
|
163 | 163 | |
164 | 164 | $appPath = \OC_App::getAppPath($app); |
165 | 165 | |
166 | 166 | // Check if the app is in the app folder |
167 | 167 | $path = ''; |
168 | 168 | $themingEnabled = $this->config->getSystemValue('installed', false) && \OCP\App::isEnabled('theming') && \OC_App::isAppLoaded('theming'); |
169 | - if($themingEnabled && $image === 'favicon.ico' && \OC::$server->getThemingDefaults()->shouldReplaceIcons()) { |
|
169 | + if ($themingEnabled && $image === 'favicon.ico' && \OC::$server->getThemingDefaults()->shouldReplaceIcons()) { |
|
170 | 170 | $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); |
171 | - if($app === '') { $app = 'core'; } |
|
172 | - $path = $this->linkToRoute('theming.Icon.getFavicon', [ 'app' => $app ]) . '?v='. $cacheBusterValue; |
|
173 | - } elseif($themingEnabled && $image === 'favicon-touch.png' && \OC::$server->getThemingDefaults()->shouldReplaceIcons()) { |
|
171 | + if ($app === '') { $app = 'core'; } |
|
172 | + $path = $this->linkToRoute('theming.Icon.getFavicon', ['app' => $app]).'?v='.$cacheBusterValue; |
|
173 | + } elseif ($themingEnabled && $image === 'favicon-touch.png' && \OC::$server->getThemingDefaults()->shouldReplaceIcons()) { |
|
174 | 174 | $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); |
175 | - if($app === '') { $app = 'core'; } |
|
176 | - $path = $this->linkToRoute('theming.Icon.getTouchIcon', [ 'app' => $app ]) . '?v='. $cacheBusterValue; |
|
177 | - } elseif($themingEnabled && $image === 'favicon-fb.png' && \OC::$server->getThemingDefaults()->shouldReplaceIcons()) { |
|
175 | + if ($app === '') { $app = 'core'; } |
|
176 | + $path = $this->linkToRoute('theming.Icon.getTouchIcon', ['app' => $app]).'?v='.$cacheBusterValue; |
|
177 | + } elseif ($themingEnabled && $image === 'favicon-fb.png' && \OC::$server->getThemingDefaults()->shouldReplaceIcons()) { |
|
178 | 178 | $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); |
179 | - if($app === '') { $app = 'core'; } |
|
180 | - $path = $this->linkToRoute('theming.Icon.getTouchIcon', [ 'app' => $app ]) . '?v='. $cacheBusterValue; |
|
181 | - } elseif (file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$image")) { |
|
182 | - $path = \OC::$WEBROOT . "/themes/$theme/apps/$app/img/$image"; |
|
183 | - } elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$basename.svg") |
|
184 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$app/img/$basename.png")) { |
|
185 | - $path = \OC::$WEBROOT . "/themes/$theme/apps/$app/img/$basename.png"; |
|
186 | - } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$image")) { |
|
187 | - $path = \OC::$WEBROOT . "/themes/$theme/$app/img/$image"; |
|
188 | - } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$basename.svg") |
|
189 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/$app/img/$basename.png"))) { |
|
190 | - $path = \OC::$WEBROOT . "/themes/$theme/$app/img/$basename.png"; |
|
191 | - } elseif (file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$image")) { |
|
192 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$image"; |
|
193 | - } elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.svg") |
|
194 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.png")) { |
|
195 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; |
|
196 | - } elseif ($appPath && file_exists($appPath . "/img/$image")) { |
|
197 | - $path = \OC_App::getAppWebPath($app) . "/img/$image"; |
|
198 | - } elseif ($appPath && !file_exists($appPath . "/img/$basename.svg") |
|
199 | - && file_exists($appPath . "/img/$basename.png")) { |
|
200 | - $path = \OC_App::getAppWebPath($app) . "/img/$basename.png"; |
|
201 | - } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/$app/img/$image")) { |
|
202 | - $path = \OC::$WEBROOT . "/$app/img/$image"; |
|
203 | - } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT . "/$app/img/$basename.svg") |
|
204 | - && file_exists(\OC::$SERVERROOT . "/$app/img/$basename.png"))) { |
|
205 | - $path = \OC::$WEBROOT . "/$app/img/$basename.png"; |
|
206 | - } elseif (file_exists(\OC::$SERVERROOT . "/core/img/$image")) { |
|
207 | - $path = \OC::$WEBROOT . "/core/img/$image"; |
|
208 | - } elseif (!file_exists(\OC::$SERVERROOT . "/core/img/$basename.svg") |
|
209 | - && file_exists(\OC::$SERVERROOT . "/core/img/$basename.png")) { |
|
210 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; |
|
179 | + if ($app === '') { $app = 'core'; } |
|
180 | + $path = $this->linkToRoute('theming.Icon.getTouchIcon', ['app' => $app]).'?v='.$cacheBusterValue; |
|
181 | + } elseif (file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$app/img/$image")) { |
|
182 | + $path = \OC::$WEBROOT."/themes/$theme/apps/$app/img/$image"; |
|
183 | + } elseif (!file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$app/img/$basename.svg") |
|
184 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$app/img/$basename.png")) { |
|
185 | + $path = \OC::$WEBROOT."/themes/$theme/apps/$app/img/$basename.png"; |
|
186 | + } elseif (!empty($app) and file_exists(\OC::$SERVERROOT."/themes/$theme/$app/img/$image")) { |
|
187 | + $path = \OC::$WEBROOT."/themes/$theme/$app/img/$image"; |
|
188 | + } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT."/themes/$theme/$app/img/$basename.svg") |
|
189 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/$app/img/$basename.png"))) { |
|
190 | + $path = \OC::$WEBROOT."/themes/$theme/$app/img/$basename.png"; |
|
191 | + } elseif (file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$image")) { |
|
192 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$image"; |
|
193 | + } elseif (!file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$basename.svg") |
|
194 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$basename.png")) { |
|
195 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$basename.png"; |
|
196 | + } elseif ($appPath && file_exists($appPath."/img/$image")) { |
|
197 | + $path = \OC_App::getAppWebPath($app)."/img/$image"; |
|
198 | + } elseif ($appPath && !file_exists($appPath."/img/$basename.svg") |
|
199 | + && file_exists($appPath."/img/$basename.png")) { |
|
200 | + $path = \OC_App::getAppWebPath($app)."/img/$basename.png"; |
|
201 | + } elseif (!empty($app) and file_exists(\OC::$SERVERROOT."/$app/img/$image")) { |
|
202 | + $path = \OC::$WEBROOT."/$app/img/$image"; |
|
203 | + } elseif (!empty($app) and (!file_exists(\OC::$SERVERROOT."/$app/img/$basename.svg") |
|
204 | + && file_exists(\OC::$SERVERROOT."/$app/img/$basename.png"))) { |
|
205 | + $path = \OC::$WEBROOT."/$app/img/$basename.png"; |
|
206 | + } elseif (file_exists(\OC::$SERVERROOT."/core/img/$image")) { |
|
207 | + $path = \OC::$WEBROOT."/core/img/$image"; |
|
208 | + } elseif (!file_exists(\OC::$SERVERROOT."/core/img/$basename.svg") |
|
209 | + && file_exists(\OC::$SERVERROOT."/core/img/$basename.png")) { |
|
210 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$basename.png"; |
|
211 | 211 | } |
212 | 212 | |
213 | - if($path !== '') { |
|
213 | + if ($path !== '') { |
|
214 | 214 | $cache->set($cacheKey, $path); |
215 | 215 | return $path; |
216 | 216 | } else { |
217 | - throw new RuntimeException('image not found: image:' . $image . ' webroot:' . \OC::$WEBROOT . ' serverroot:' . \OC::$SERVERROOT); |
|
217 | + throw new RuntimeException('image not found: image:'.$image.' webroot:'.\OC::$WEBROOT.' serverroot:'.\OC::$SERVERROOT); |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
@@ -228,14 +228,14 @@ discard block |
||
228 | 228 | $separator = $url[0] === '/' ? '' : '/'; |
229 | 229 | |
230 | 230 | if (\OC::$CLI && !defined('PHPUNIT_RUN')) { |
231 | - return rtrim($this->config->getSystemValue('overwrite.cli.url'), '/') . '/' . ltrim($url, '/'); |
|
231 | + return rtrim($this->config->getSystemValue('overwrite.cli.url'), '/').'/'.ltrim($url, '/'); |
|
232 | 232 | } |
233 | 233 | // The ownCloud web root can already be prepended. |
234 | - if(substr($url, 0, strlen(\OC::$WEBROOT)) === \OC::$WEBROOT) { |
|
234 | + if (substr($url, 0, strlen(\OC::$WEBROOT)) === \OC::$WEBROOT) { |
|
235 | 235 | $url = substr($url, strlen(\OC::$WEBROOT)); |
236 | 236 | } |
237 | 237 | |
238 | - return $this->getBaseUrl() . $separator . $url; |
|
238 | + return $this->getBaseUrl().$separator.$url; |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
@@ -251,6 +251,6 @@ discard block |
||
251 | 251 | * @return string base url of the current request |
252 | 252 | */ |
253 | 253 | public function getBaseUrl() { |
254 | - return $this->request->getServerProtocol() . '://' . $this->request->getServerHost() . \OC::$WEBROOT; |
|
254 | + return $this->request->getServerProtocol().'://'.$this->request->getServerHost().\OC::$WEBROOT; |
|
255 | 255 | } |
256 | 256 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | |
150 | 150 | |
151 | - $this->registerService(\OCP\IPreview::class, function (Server $c) { |
|
151 | + $this->registerService(\OCP\IPreview::class, function(Server $c) { |
|
152 | 152 | return new PreviewManager( |
153 | 153 | $c->getConfig(), |
154 | 154 | $c->getRootFolder(), |
@@ -159,13 +159,13 @@ discard block |
||
159 | 159 | }); |
160 | 160 | $this->registerAlias('PreviewManager', \OCP\IPreview::class); |
161 | 161 | |
162 | - $this->registerService(\OC\Preview\Watcher::class, function (Server $c) { |
|
162 | + $this->registerService(\OC\Preview\Watcher::class, function(Server $c) { |
|
163 | 163 | return new \OC\Preview\Watcher( |
164 | 164 | $c->getAppDataDir('preview') |
165 | 165 | ); |
166 | 166 | }); |
167 | 167 | |
168 | - $this->registerService('EncryptionManager', function (Server $c) { |
|
168 | + $this->registerService('EncryptionManager', function(Server $c) { |
|
169 | 169 | $view = new View(); |
170 | 170 | $util = new Encryption\Util( |
171 | 171 | $view, |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | ); |
184 | 184 | }); |
185 | 185 | |
186 | - $this->registerService('EncryptionFileHelper', function (Server $c) { |
|
186 | + $this->registerService('EncryptionFileHelper', function(Server $c) { |
|
187 | 187 | $util = new Encryption\Util( |
188 | 188 | new View(), |
189 | 189 | $c->getUserManager(), |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | ); |
198 | 198 | }); |
199 | 199 | |
200 | - $this->registerService('EncryptionKeyStorage', function (Server $c) { |
|
200 | + $this->registerService('EncryptionKeyStorage', function(Server $c) { |
|
201 | 201 | $view = new View(); |
202 | 202 | $util = new Encryption\Util( |
203 | 203 | $view, |
@@ -208,32 +208,32 @@ discard block |
||
208 | 208 | |
209 | 209 | return new Encryption\Keys\Storage($view, $util); |
210 | 210 | }); |
211 | - $this->registerService('TagMapper', function (Server $c) { |
|
211 | + $this->registerService('TagMapper', function(Server $c) { |
|
212 | 212 | return new TagMapper($c->getDatabaseConnection()); |
213 | 213 | }); |
214 | 214 | |
215 | - $this->registerService(\OCP\ITagManager::class, function (Server $c) { |
|
215 | + $this->registerService(\OCP\ITagManager::class, function(Server $c) { |
|
216 | 216 | $tagMapper = $c->query('TagMapper'); |
217 | 217 | return new TagManager($tagMapper, $c->getUserSession()); |
218 | 218 | }); |
219 | 219 | $this->registerAlias('TagManager', \OCP\ITagManager::class); |
220 | 220 | |
221 | - $this->registerService('SystemTagManagerFactory', function (Server $c) { |
|
221 | + $this->registerService('SystemTagManagerFactory', function(Server $c) { |
|
222 | 222 | $config = $c->getConfig(); |
223 | 223 | $factoryClass = $config->getSystemValue('systemtags.managerFactory', '\OC\SystemTag\ManagerFactory'); |
224 | 224 | /** @var \OC\SystemTag\ManagerFactory $factory */ |
225 | 225 | $factory = new $factoryClass($this); |
226 | 226 | return $factory; |
227 | 227 | }); |
228 | - $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) { |
|
228 | + $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function(Server $c) { |
|
229 | 229 | return $c->query('SystemTagManagerFactory')->getManager(); |
230 | 230 | }); |
231 | 231 | $this->registerAlias('SystemTagManager', \OCP\SystemTag\ISystemTagManager::class); |
232 | 232 | |
233 | - $this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function (Server $c) { |
|
233 | + $this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function(Server $c) { |
|
234 | 234 | return $c->query('SystemTagManagerFactory')->getObjectMapper(); |
235 | 235 | }); |
236 | - $this->registerService('RootFolder', function (Server $c) { |
|
236 | + $this->registerService('RootFolder', function(Server $c) { |
|
237 | 237 | $manager = \OC\Files\Filesystem::getMountManager(null); |
238 | 238 | $view = new View(); |
239 | 239 | $root = new Root( |
@@ -261,30 +261,30 @@ discard block |
||
261 | 261 | }); |
262 | 262 | $this->registerAlias('LazyRootFolder', \OCP\Files\IRootFolder::class); |
263 | 263 | |
264 | - $this->registerService(\OCP\IUserManager::class, function (Server $c) { |
|
264 | + $this->registerService(\OCP\IUserManager::class, function(Server $c) { |
|
265 | 265 | $config = $c->getConfig(); |
266 | 266 | return new \OC\User\Manager($config); |
267 | 267 | }); |
268 | 268 | $this->registerAlias('UserManager', \OCP\IUserManager::class); |
269 | 269 | |
270 | - $this->registerService(\OCP\IGroupManager::class, function (Server $c) { |
|
270 | + $this->registerService(\OCP\IGroupManager::class, function(Server $c) { |
|
271 | 271 | $groupManager = new \OC\Group\Manager($this->getUserManager(), $this->getLogger()); |
272 | - $groupManager->listen('\OC\Group', 'preCreate', function ($gid) { |
|
272 | + $groupManager->listen('\OC\Group', 'preCreate', function($gid) { |
|
273 | 273 | \OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid)); |
274 | 274 | }); |
275 | - $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) { |
|
275 | + $groupManager->listen('\OC\Group', 'postCreate', function(\OC\Group\Group $gid) { |
|
276 | 276 | \OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID())); |
277 | 277 | }); |
278 | - $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) { |
|
278 | + $groupManager->listen('\OC\Group', 'preDelete', function(\OC\Group\Group $group) { |
|
279 | 279 | \OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID())); |
280 | 280 | }); |
281 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) { |
|
281 | + $groupManager->listen('\OC\Group', 'postDelete', function(\OC\Group\Group $group) { |
|
282 | 282 | \OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID())); |
283 | 283 | }); |
284 | - $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
284 | + $groupManager->listen('\OC\Group', 'preAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
285 | 285 | \OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID())); |
286 | 286 | }); |
287 | - $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
287 | + $groupManager->listen('\OC\Group', 'postAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
288 | 288 | \OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
289 | 289 | //Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks |
290 | 290 | \OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
@@ -304,11 +304,11 @@ discard block |
||
304 | 304 | return new Store($session, $logger, $tokenProvider); |
305 | 305 | }); |
306 | 306 | $this->registerAlias(IStore::class, Store::class); |
307 | - $this->registerService('OC\Authentication\Token\DefaultTokenMapper', function (Server $c) { |
|
307 | + $this->registerService('OC\Authentication\Token\DefaultTokenMapper', function(Server $c) { |
|
308 | 308 | $dbConnection = $c->getDatabaseConnection(); |
309 | 309 | return new Authentication\Token\DefaultTokenMapper($dbConnection); |
310 | 310 | }); |
311 | - $this->registerService('OC\Authentication\Token\DefaultTokenProvider', function (Server $c) { |
|
311 | + $this->registerService('OC\Authentication\Token\DefaultTokenProvider', function(Server $c) { |
|
312 | 312 | $mapper = $c->query('OC\Authentication\Token\DefaultTokenMapper'); |
313 | 313 | $crypto = $c->getCrypto(); |
314 | 314 | $config = $c->getConfig(); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | }); |
319 | 319 | $this->registerAlias('OC\Authentication\Token\IProvider', 'OC\Authentication\Token\DefaultTokenProvider'); |
320 | 320 | |
321 | - $this->registerService(\OCP\IUserSession::class, function (Server $c) { |
|
321 | + $this->registerService(\OCP\IUserSession::class, function(Server $c) { |
|
322 | 322 | $manager = $c->getUserManager(); |
323 | 323 | $session = new \OC\Session\Memory(''); |
324 | 324 | $timeFactory = new TimeFactory(); |
@@ -331,44 +331,44 @@ discard block |
||
331 | 331 | } |
332 | 332 | |
333 | 333 | $userSession = new \OC\User\Session($manager, $session, $timeFactory, $defaultTokenProvider, $c->getConfig(), $c->getSecureRandom(), $c->getLockdownManager()); |
334 | - $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { |
|
334 | + $userSession->listen('\OC\User', 'preCreateUser', function($uid, $password) { |
|
335 | 335 | \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password)); |
336 | 336 | }); |
337 | - $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) { |
|
337 | + $userSession->listen('\OC\User', 'postCreateUser', function($user, $password) { |
|
338 | 338 | /** @var $user \OC\User\User */ |
339 | 339 | \OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password)); |
340 | 340 | }); |
341 | - $userSession->listen('\OC\User', 'preDelete', function ($user) { |
|
341 | + $userSession->listen('\OC\User', 'preDelete', function($user) { |
|
342 | 342 | /** @var $user \OC\User\User */ |
343 | 343 | \OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID())); |
344 | 344 | }); |
345 | - $userSession->listen('\OC\User', 'postDelete', function ($user) { |
|
345 | + $userSession->listen('\OC\User', 'postDelete', function($user) { |
|
346 | 346 | /** @var $user \OC\User\User */ |
347 | 347 | \OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID())); |
348 | 348 | }); |
349 | - $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) { |
|
349 | + $userSession->listen('\OC\User', 'preSetPassword', function($user, $password, $recoveryPassword) { |
|
350 | 350 | /** @var $user \OC\User\User */ |
351 | 351 | \OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
352 | 352 | }); |
353 | - $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) { |
|
353 | + $userSession->listen('\OC\User', 'postSetPassword', function($user, $password, $recoveryPassword) { |
|
354 | 354 | /** @var $user \OC\User\User */ |
355 | 355 | \OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
356 | 356 | }); |
357 | - $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) { |
|
357 | + $userSession->listen('\OC\User', 'preLogin', function($uid, $password) { |
|
358 | 358 | \OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password)); |
359 | 359 | }); |
360 | - $userSession->listen('\OC\User', 'postLogin', function ($user, $password) { |
|
360 | + $userSession->listen('\OC\User', 'postLogin', function($user, $password) { |
|
361 | 361 | /** @var $user \OC\User\User */ |
362 | 362 | \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password)); |
363 | 363 | }); |
364 | - $userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) { |
|
364 | + $userSession->listen('\OC\User', 'postRememberedLogin', function($user, $password) { |
|
365 | 365 | /** @var $user \OC\User\User */ |
366 | 366 | \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password)); |
367 | 367 | }); |
368 | - $userSession->listen('\OC\User', 'logout', function () { |
|
368 | + $userSession->listen('\OC\User', 'logout', function() { |
|
369 | 369 | \OC_Hook::emit('OC_User', 'logout', array()); |
370 | 370 | }); |
371 | - $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) { |
|
371 | + $userSession->listen('\OC\User', 'changeUser', function($user, $feature, $value, $oldValue) { |
|
372 | 372 | /** @var $user \OC\User\User */ |
373 | 373 | \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue)); |
374 | 374 | }); |
@@ -376,14 +376,14 @@ discard block |
||
376 | 376 | }); |
377 | 377 | $this->registerAlias('UserSession', \OCP\IUserSession::class); |
378 | 378 | |
379 | - $this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function (Server $c) { |
|
379 | + $this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function(Server $c) { |
|
380 | 380 | return new \OC\Authentication\TwoFactorAuth\Manager($c->getAppManager(), $c->getSession(), $c->getConfig(), $c->getActivityManager(), $c->getLogger()); |
381 | 381 | }); |
382 | 382 | |
383 | 383 | $this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class); |
384 | 384 | $this->registerAlias('NavigationManager', \OCP\INavigationManager::class); |
385 | 385 | |
386 | - $this->registerService(\OC\AllConfig::class, function (Server $c) { |
|
386 | + $this->registerService(\OC\AllConfig::class, function(Server $c) { |
|
387 | 387 | return new \OC\AllConfig( |
388 | 388 | $c->getSystemConfig() |
389 | 389 | ); |
@@ -391,17 +391,17 @@ discard block |
||
391 | 391 | $this->registerAlias('AllConfig', \OC\AllConfig::class); |
392 | 392 | $this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class); |
393 | 393 | |
394 | - $this->registerService('SystemConfig', function ($c) use ($config) { |
|
394 | + $this->registerService('SystemConfig', function($c) use ($config) { |
|
395 | 395 | return new \OC\SystemConfig($config); |
396 | 396 | }); |
397 | 397 | |
398 | - $this->registerService(\OC\AppConfig::class, function (Server $c) { |
|
398 | + $this->registerService(\OC\AppConfig::class, function(Server $c) { |
|
399 | 399 | return new \OC\AppConfig($c->getDatabaseConnection()); |
400 | 400 | }); |
401 | 401 | $this->registerAlias('AppConfig', \OC\AppConfig::class); |
402 | 402 | $this->registerAlias(\OCP\IAppConfig::class, \OC\AppConfig::class); |
403 | 403 | |
404 | - $this->registerService(\OCP\L10N\IFactory::class, function (Server $c) { |
|
404 | + $this->registerService(\OCP\L10N\IFactory::class, function(Server $c) { |
|
405 | 405 | return new \OC\L10N\Factory( |
406 | 406 | $c->getConfig(), |
407 | 407 | $c->getRequest(), |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | }); |
412 | 412 | $this->registerAlias('L10NFactory', \OCP\L10N\IFactory::class); |
413 | 413 | |
414 | - $this->registerService(\OCP\IURLGenerator::class, function (Server $c) { |
|
414 | + $this->registerService(\OCP\IURLGenerator::class, function(Server $c) { |
|
415 | 415 | $config = $c->getConfig(); |
416 | 416 | $cacheFactory = $c->getMemCacheFactory(); |
417 | 417 | $request = $c->getRequest(); |
@@ -423,18 +423,18 @@ discard block |
||
423 | 423 | }); |
424 | 424 | $this->registerAlias('URLGenerator', \OCP\IURLGenerator::class); |
425 | 425 | |
426 | - $this->registerService('AppHelper', function ($c) { |
|
426 | + $this->registerService('AppHelper', function($c) { |
|
427 | 427 | return new \OC\AppHelper(); |
428 | 428 | }); |
429 | 429 | $this->registerAlias('AppFetcher', AppFetcher::class); |
430 | 430 | $this->registerAlias('CategoryFetcher', CategoryFetcher::class); |
431 | 431 | |
432 | - $this->registerService(\OCP\ICache::class, function ($c) { |
|
432 | + $this->registerService(\OCP\ICache::class, function($c) { |
|
433 | 433 | return new Cache\File(); |
434 | 434 | }); |
435 | 435 | $this->registerAlias('UserCache', \OCP\ICache::class); |
436 | 436 | |
437 | - $this->registerService(Factory::class, function (Server $c) { |
|
437 | + $this->registerService(Factory::class, function(Server $c) { |
|
438 | 438 | |
439 | 439 | $arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(), |
440 | 440 | '\\OC\\Memcache\\ArrayCache', |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | $version = implode(',', $v); |
452 | 452 | $instanceId = \OC_Util::getInstanceId(); |
453 | 453 | $path = \OC::$SERVERROOT; |
454 | - $prefix = md5($instanceId . '-' . $version . '-' . $path . '-' . $urlGenerator->getBaseUrl()); |
|
454 | + $prefix = md5($instanceId.'-'.$version.'-'.$path.'-'.$urlGenerator->getBaseUrl()); |
|
455 | 455 | return new \OC\Memcache\Factory($prefix, $c->getLogger(), |
456 | 456 | $config->getSystemValue('memcache.local', null), |
457 | 457 | $config->getSystemValue('memcache.distributed', null), |
@@ -464,12 +464,12 @@ discard block |
||
464 | 464 | $this->registerAlias('MemCacheFactory', Factory::class); |
465 | 465 | $this->registerAlias(ICacheFactory::class, Factory::class); |
466 | 466 | |
467 | - $this->registerService('RedisFactory', function (Server $c) { |
|
467 | + $this->registerService('RedisFactory', function(Server $c) { |
|
468 | 468 | $systemConfig = $c->getSystemConfig(); |
469 | 469 | return new RedisFactory($systemConfig); |
470 | 470 | }); |
471 | 471 | |
472 | - $this->registerService(\OCP\Activity\IManager::class, function (Server $c) { |
|
472 | + $this->registerService(\OCP\Activity\IManager::class, function(Server $c) { |
|
473 | 473 | return new \OC\Activity\Manager( |
474 | 474 | $c->getRequest(), |
475 | 475 | $c->getUserSession(), |
@@ -479,14 +479,14 @@ discard block |
||
479 | 479 | }); |
480 | 480 | $this->registerAlias('ActivityManager', \OCP\Activity\IManager::class); |
481 | 481 | |
482 | - $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) { |
|
482 | + $this->registerService(\OCP\Activity\IEventMerger::class, function(Server $c) { |
|
483 | 483 | return new \OC\Activity\EventMerger( |
484 | 484 | $c->getL10N('lib') |
485 | 485 | ); |
486 | 486 | }); |
487 | 487 | $this->registerAlias(IValidator::class, Validator::class); |
488 | 488 | |
489 | - $this->registerService(\OCP\IAvatarManager::class, function (Server $c) { |
|
489 | + $this->registerService(\OCP\IAvatarManager::class, function(Server $c) { |
|
490 | 490 | return new AvatarManager( |
491 | 491 | $c->getUserManager(), |
492 | 492 | $c->getAppDataDir('avatar'), |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | }); |
498 | 498 | $this->registerAlias('AvatarManager', \OCP\IAvatarManager::class); |
499 | 499 | |
500 | - $this->registerService(\OCP\ILogger::class, function (Server $c) { |
|
500 | + $this->registerService(\OCP\ILogger::class, function(Server $c) { |
|
501 | 501 | $logType = $c->query('AllConfig')->getSystemValue('log_type', 'file'); |
502 | 502 | $logger = Log::getLogClass($logType); |
503 | 503 | call_user_func(array($logger, 'init')); |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | }); |
507 | 507 | $this->registerAlias('Logger', \OCP\ILogger::class); |
508 | 508 | |
509 | - $this->registerService(\OCP\BackgroundJob\IJobList::class, function (Server $c) { |
|
509 | + $this->registerService(\OCP\BackgroundJob\IJobList::class, function(Server $c) { |
|
510 | 510 | $config = $c->getConfig(); |
511 | 511 | return new \OC\BackgroundJob\JobList( |
512 | 512 | $c->getDatabaseConnection(), |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | }); |
517 | 517 | $this->registerAlias('JobList', \OCP\BackgroundJob\IJobList::class); |
518 | 518 | |
519 | - $this->registerService(\OCP\Route\IRouter::class, function (Server $c) { |
|
519 | + $this->registerService(\OCP\Route\IRouter::class, function(Server $c) { |
|
520 | 520 | $cacheFactory = $c->getMemCacheFactory(); |
521 | 521 | $logger = $c->getLogger(); |
522 | 522 | if ($cacheFactory->isAvailable()) { |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | }); |
529 | 529 | $this->registerAlias('Router', \OCP\Route\IRouter::class); |
530 | 530 | |
531 | - $this->registerService(\OCP\ISearch::class, function ($c) { |
|
531 | + $this->registerService(\OCP\ISearch::class, function($c) { |
|
532 | 532 | return new Search(); |
533 | 533 | }); |
534 | 534 | $this->registerAlias('Search', \OCP\ISearch::class); |
@@ -548,27 +548,27 @@ discard block |
||
548 | 548 | ); |
549 | 549 | }); |
550 | 550 | |
551 | - $this->registerService(\OCP\Security\ISecureRandom::class, function ($c) { |
|
551 | + $this->registerService(\OCP\Security\ISecureRandom::class, function($c) { |
|
552 | 552 | return new SecureRandom(); |
553 | 553 | }); |
554 | 554 | $this->registerAlias('SecureRandom', \OCP\Security\ISecureRandom::class); |
555 | 555 | |
556 | - $this->registerService(\OCP\Security\ICrypto::class, function (Server $c) { |
|
556 | + $this->registerService(\OCP\Security\ICrypto::class, function(Server $c) { |
|
557 | 557 | return new Crypto($c->getConfig(), $c->getSecureRandom()); |
558 | 558 | }); |
559 | 559 | $this->registerAlias('Crypto', \OCP\Security\ICrypto::class); |
560 | 560 | |
561 | - $this->registerService(\OCP\Security\IHasher::class, function (Server $c) { |
|
561 | + $this->registerService(\OCP\Security\IHasher::class, function(Server $c) { |
|
562 | 562 | return new Hasher($c->getConfig()); |
563 | 563 | }); |
564 | 564 | $this->registerAlias('Hasher', \OCP\Security\IHasher::class); |
565 | 565 | |
566 | - $this->registerService(\OCP\Security\ICredentialsManager::class, function (Server $c) { |
|
566 | + $this->registerService(\OCP\Security\ICredentialsManager::class, function(Server $c) { |
|
567 | 567 | return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection()); |
568 | 568 | }); |
569 | 569 | $this->registerAlias('CredentialsManager', \OCP\Security\ICredentialsManager::class); |
570 | 570 | |
571 | - $this->registerService(IDBConnection::class, function (Server $c) { |
|
571 | + $this->registerService(IDBConnection::class, function(Server $c) { |
|
572 | 572 | $systemConfig = $c->getSystemConfig(); |
573 | 573 | $factory = new \OC\DB\ConnectionFactory($systemConfig); |
574 | 574 | $type = $systemConfig->getValue('dbtype', 'sqlite'); |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | }); |
583 | 583 | $this->registerAlias('DatabaseConnection', IDBConnection::class); |
584 | 584 | |
585 | - $this->registerService('HTTPHelper', function (Server $c) { |
|
585 | + $this->registerService('HTTPHelper', function(Server $c) { |
|
586 | 586 | $config = $c->getConfig(); |
587 | 587 | return new HTTPHelper( |
588 | 588 | $config, |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | ); |
591 | 591 | }); |
592 | 592 | |
593 | - $this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) { |
|
593 | + $this->registerService(\OCP\Http\Client\IClientService::class, function(Server $c) { |
|
594 | 594 | $user = \OC_User::getUser(); |
595 | 595 | $uid = $user ? $user : null; |
596 | 596 | return new ClientService( |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | ); |
600 | 600 | }); |
601 | 601 | $this->registerAlias('HttpClientService', \OCP\Http\Client\IClientService::class); |
602 | - $this->registerService(\OCP\Diagnostics\IEventLogger::class, function (Server $c) { |
|
602 | + $this->registerService(\OCP\Diagnostics\IEventLogger::class, function(Server $c) { |
|
603 | 603 | $eventLogger = new EventLogger(); |
604 | 604 | if ($c->getSystemConfig()->getValue('debug', false)) { |
605 | 605 | // In debug mode, module is being activated by default |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | }); |
610 | 610 | $this->registerAlias('EventLogger', \OCP\Diagnostics\IEventLogger::class); |
611 | 611 | |
612 | - $this->registerService(\OCP\Diagnostics\IQueryLogger::class, function (Server $c) { |
|
612 | + $this->registerService(\OCP\Diagnostics\IQueryLogger::class, function(Server $c) { |
|
613 | 613 | $queryLogger = new QueryLogger(); |
614 | 614 | if ($c->getSystemConfig()->getValue('debug', false)) { |
615 | 615 | // In debug mode, module is being activated by default |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | }); |
620 | 620 | $this->registerAlias('QueryLogger', \OCP\Diagnostics\IQueryLogger::class); |
621 | 621 | |
622 | - $this->registerService(TempManager::class, function (Server $c) { |
|
622 | + $this->registerService(TempManager::class, function(Server $c) { |
|
623 | 623 | return new TempManager( |
624 | 624 | $c->getLogger(), |
625 | 625 | $c->getConfig() |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | $this->registerAlias('TempManager', TempManager::class); |
629 | 629 | $this->registerAlias(ITempManager::class, TempManager::class); |
630 | 630 | |
631 | - $this->registerService(AppManager::class, function (Server $c) { |
|
631 | + $this->registerService(AppManager::class, function(Server $c) { |
|
632 | 632 | return new \OC\App\AppManager( |
633 | 633 | $c->getUserSession(), |
634 | 634 | $c->getAppConfig(), |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | $this->registerAlias('AppManager', AppManager::class); |
641 | 641 | $this->registerAlias(IAppManager::class, AppManager::class); |
642 | 642 | |
643 | - $this->registerService(\OCP\IDateTimeZone::class, function (Server $c) { |
|
643 | + $this->registerService(\OCP\IDateTimeZone::class, function(Server $c) { |
|
644 | 644 | return new DateTimeZone( |
645 | 645 | $c->getConfig(), |
646 | 646 | $c->getSession() |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | }); |
649 | 649 | $this->registerAlias('DateTimeZone', \OCP\IDateTimeZone::class); |
650 | 650 | |
651 | - $this->registerService(\OCP\IDateTimeFormatter::class, function (Server $c) { |
|
651 | + $this->registerService(\OCP\IDateTimeFormatter::class, function(Server $c) { |
|
652 | 652 | $language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null); |
653 | 653 | |
654 | 654 | return new DateTimeFormatter( |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | }); |
659 | 659 | $this->registerAlias('DateTimeFormatter', \OCP\IDateTimeFormatter::class); |
660 | 660 | |
661 | - $this->registerService(\OCP\Files\Config\IUserMountCache::class, function (Server $c) { |
|
661 | + $this->registerService(\OCP\Files\Config\IUserMountCache::class, function(Server $c) { |
|
662 | 662 | $mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger()); |
663 | 663 | $listener = new UserMountCacheListener($mountCache); |
664 | 664 | $listener->listen($c->getUserManager()); |
@@ -666,10 +666,10 @@ discard block |
||
666 | 666 | }); |
667 | 667 | $this->registerAlias('UserMountCache', \OCP\Files\Config\IUserMountCache::class); |
668 | 668 | |
669 | - $this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function (Server $c) { |
|
669 | + $this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function(Server $c) { |
|
670 | 670 | $loader = \OC\Files\Filesystem::getLoader(); |
671 | 671 | $mountCache = $c->query('UserMountCache'); |
672 | - $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); |
|
672 | + $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); |
|
673 | 673 | |
674 | 674 | // builtin providers |
675 | 675 | |
@@ -682,14 +682,14 @@ discard block |
||
682 | 682 | }); |
683 | 683 | $this->registerAlias('MountConfigManager', \OCP\Files\Config\IMountProviderCollection::class); |
684 | 684 | |
685 | - $this->registerService('IniWrapper', function ($c) { |
|
685 | + $this->registerService('IniWrapper', function($c) { |
|
686 | 686 | return new IniGetWrapper(); |
687 | 687 | }); |
688 | - $this->registerService('AsyncCommandBus', function (Server $c) { |
|
688 | + $this->registerService('AsyncCommandBus', function(Server $c) { |
|
689 | 689 | $jobList = $c->getJobList(); |
690 | 690 | return new AsyncBus($jobList); |
691 | 691 | }); |
692 | - $this->registerService('TrustedDomainHelper', function ($c) { |
|
692 | + $this->registerService('TrustedDomainHelper', function($c) { |
|
693 | 693 | return new TrustedDomainHelper($this->getConfig()); |
694 | 694 | }); |
695 | 695 | $this->registerService('Throttler', function(Server $c) { |
@@ -700,10 +700,10 @@ discard block |
||
700 | 700 | $c->getConfig() |
701 | 701 | ); |
702 | 702 | }); |
703 | - $this->registerService('IntegrityCodeChecker', function (Server $c) { |
|
703 | + $this->registerService('IntegrityCodeChecker', function(Server $c) { |
|
704 | 704 | // IConfig and IAppManager requires a working database. This code |
705 | 705 | // might however be called when ownCloud is not yet setup. |
706 | - if(\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
706 | + if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
707 | 707 | $config = $c->getConfig(); |
708 | 708 | $appManager = $c->getAppManager(); |
709 | 709 | } else { |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | $c->getTempManager() |
722 | 722 | ); |
723 | 723 | }); |
724 | - $this->registerService(\OCP\IRequest::class, function ($c) { |
|
724 | + $this->registerService(\OCP\IRequest::class, function($c) { |
|
725 | 725 | if (isset($this['urlParams'])) { |
726 | 726 | $urlParams = $this['urlParams']; |
727 | 727 | } else { |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | }); |
758 | 758 | $this->registerAlias('Request', \OCP\IRequest::class); |
759 | 759 | |
760 | - $this->registerService(\OCP\Mail\IMailer::class, function (Server $c) { |
|
760 | + $this->registerService(\OCP\Mail\IMailer::class, function(Server $c) { |
|
761 | 761 | return new Mailer( |
762 | 762 | $c->getConfig(), |
763 | 763 | $c->getLogger(), |
@@ -771,14 +771,14 @@ discard block |
||
771 | 771 | $this->registerService('LDAPProvider', function(Server $c) { |
772 | 772 | $config = $c->getConfig(); |
773 | 773 | $factoryClass = $config->getSystemValue('ldapProviderFactory', null); |
774 | - if(is_null($factoryClass)) { |
|
774 | + if (is_null($factoryClass)) { |
|
775 | 775 | throw new \Exception('ldapProviderFactory not set'); |
776 | 776 | } |
777 | 777 | /** @var \OCP\LDAP\ILDAPProviderFactory $factory */ |
778 | 778 | $factory = new $factoryClass($this); |
779 | 779 | return $factory->getLDAPProvider(); |
780 | 780 | }); |
781 | - $this->registerService('LockingProvider', function (Server $c) { |
|
781 | + $this->registerService('LockingProvider', function(Server $c) { |
|
782 | 782 | $ini = $c->getIniWrapper(); |
783 | 783 | $config = $c->getConfig(); |
784 | 784 | $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); |
@@ -794,39 +794,39 @@ discard block |
||
794 | 794 | return new NoopLockingProvider(); |
795 | 795 | }); |
796 | 796 | |
797 | - $this->registerService(\OCP\Files\Mount\IMountManager::class, function () { |
|
797 | + $this->registerService(\OCP\Files\Mount\IMountManager::class, function() { |
|
798 | 798 | return new \OC\Files\Mount\Manager(); |
799 | 799 | }); |
800 | 800 | $this->registerAlias('MountManager', \OCP\Files\Mount\IMountManager::class); |
801 | 801 | |
802 | - $this->registerService(\OCP\Files\IMimeTypeDetector::class, function (Server $c) { |
|
802 | + $this->registerService(\OCP\Files\IMimeTypeDetector::class, function(Server $c) { |
|
803 | 803 | return new \OC\Files\Type\Detection( |
804 | 804 | $c->getURLGenerator(), |
805 | 805 | \OC::$configDir, |
806 | - \OC::$SERVERROOT . '/resources/config/' |
|
806 | + \OC::$SERVERROOT.'/resources/config/' |
|
807 | 807 | ); |
808 | 808 | }); |
809 | 809 | $this->registerAlias('MimeTypeDetector', \OCP\Files\IMimeTypeDetector::class); |
810 | 810 | |
811 | - $this->registerService(\OCP\Files\IMimeTypeLoader::class, function (Server $c) { |
|
811 | + $this->registerService(\OCP\Files\IMimeTypeLoader::class, function(Server $c) { |
|
812 | 812 | return new \OC\Files\Type\Loader( |
813 | 813 | $c->getDatabaseConnection() |
814 | 814 | ); |
815 | 815 | }); |
816 | 816 | $this->registerAlias('MimeTypeLoader', \OCP\Files\IMimeTypeLoader::class); |
817 | - $this->registerService(BundleFetcher::class, function () { |
|
817 | + $this->registerService(BundleFetcher::class, function() { |
|
818 | 818 | return new BundleFetcher($this->getL10N('lib')); |
819 | 819 | }); |
820 | - $this->registerService(\OCP\Notification\IManager::class, function (Server $c) { |
|
820 | + $this->registerService(\OCP\Notification\IManager::class, function(Server $c) { |
|
821 | 821 | return new Manager( |
822 | 822 | $c->query(IValidator::class) |
823 | 823 | ); |
824 | 824 | }); |
825 | 825 | $this->registerAlias('NotificationManager', \OCP\Notification\IManager::class); |
826 | 826 | |
827 | - $this->registerService(\OC\CapabilitiesManager::class, function (Server $c) { |
|
827 | + $this->registerService(\OC\CapabilitiesManager::class, function(Server $c) { |
|
828 | 828 | $manager = new \OC\CapabilitiesManager($c->getLogger()); |
829 | - $manager->registerCapability(function () use ($c) { |
|
829 | + $manager->registerCapability(function() use ($c) { |
|
830 | 830 | return new \OC\OCS\CoreCapabilities($c->getConfig()); |
831 | 831 | }); |
832 | 832 | return $manager; |
@@ -881,13 +881,13 @@ discard block |
||
881 | 881 | $cacheFactory->create('SCSS') |
882 | 882 | ); |
883 | 883 | }); |
884 | - $this->registerService(EventDispatcher::class, function () { |
|
884 | + $this->registerService(EventDispatcher::class, function() { |
|
885 | 885 | return new EventDispatcher(); |
886 | 886 | }); |
887 | 887 | $this->registerAlias('EventDispatcher', EventDispatcher::class); |
888 | 888 | $this->registerAlias(EventDispatcherInterface::class, EventDispatcher::class); |
889 | 889 | |
890 | - $this->registerService('CryptoWrapper', function (Server $c) { |
|
890 | + $this->registerService('CryptoWrapper', function(Server $c) { |
|
891 | 891 | // FIXME: Instantiiated here due to cyclic dependency |
892 | 892 | $request = new Request( |
893 | 893 | [ |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | $request |
913 | 913 | ); |
914 | 914 | }); |
915 | - $this->registerService('CsrfTokenManager', function (Server $c) { |
|
915 | + $this->registerService('CsrfTokenManager', function(Server $c) { |
|
916 | 916 | $tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom()); |
917 | 917 | |
918 | 918 | return new CsrfTokenManager( |
@@ -920,10 +920,10 @@ discard block |
||
920 | 920 | $c->query(SessionStorage::class) |
921 | 921 | ); |
922 | 922 | }); |
923 | - $this->registerService(SessionStorage::class, function (Server $c) { |
|
923 | + $this->registerService(SessionStorage::class, function(Server $c) { |
|
924 | 924 | return new SessionStorage($c->getSession()); |
925 | 925 | }); |
926 | - $this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function (Server $c) { |
|
926 | + $this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function(Server $c) { |
|
927 | 927 | return new ContentSecurityPolicyManager(); |
928 | 928 | }); |
929 | 929 | $this->registerAlias('ContentSecurityPolicyManager', \OCP\Security\IContentSecurityPolicyManager::class); |
@@ -974,29 +974,29 @@ discard block |
||
974 | 974 | ); |
975 | 975 | return $manager; |
976 | 976 | }); |
977 | - $this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) { |
|
977 | + $this->registerService(\OC\Files\AppData\Factory::class, function(Server $c) { |
|
978 | 978 | return new \OC\Files\AppData\Factory( |
979 | 979 | $c->getRootFolder(), |
980 | 980 | $c->getSystemConfig() |
981 | 981 | ); |
982 | 982 | }); |
983 | 983 | |
984 | - $this->registerService('LockdownManager', function (Server $c) { |
|
984 | + $this->registerService('LockdownManager', function(Server $c) { |
|
985 | 985 | return new LockdownManager(function() use ($c) { |
986 | 986 | return $c->getSession(); |
987 | 987 | }); |
988 | 988 | }); |
989 | 989 | |
990 | - $this->registerService(\OCP\OCS\IDiscoveryService::class, function (Server $c) { |
|
990 | + $this->registerService(\OCP\OCS\IDiscoveryService::class, function(Server $c) { |
|
991 | 991 | return new DiscoveryService($c->getMemCacheFactory(), $c->getHTTPClientService()); |
992 | 992 | }); |
993 | 993 | |
994 | - $this->registerService(ICloudIdManager::class, function (Server $c) { |
|
994 | + $this->registerService(ICloudIdManager::class, function(Server $c) { |
|
995 | 995 | return new CloudIdManager(); |
996 | 996 | }); |
997 | 997 | |
998 | 998 | /* To trick DI since we don't extend the DIContainer here */ |
999 | - $this->registerService(CleanPreviewsBackgroundJob::class, function (Server $c) { |
|
999 | + $this->registerService(CleanPreviewsBackgroundJob::class, function(Server $c) { |
|
1000 | 1000 | return new CleanPreviewsBackgroundJob( |
1001 | 1001 | $c->getRootFolder(), |
1002 | 1002 | $c->getLogger(), |
@@ -1011,7 +1011,7 @@ discard block |
||
1011 | 1011 | $this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class); |
1012 | 1012 | $this->registerAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class); |
1013 | 1013 | |
1014 | - $this->registerService(Defaults::class, function (Server $c) { |
|
1014 | + $this->registerService(Defaults::class, function(Server $c) { |
|
1015 | 1015 | return new Defaults( |
1016 | 1016 | $c->getThemingDefaults() |
1017 | 1017 | ); |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | * @deprecated since 9.2.0 use IAppData |
1164 | 1164 | */ |
1165 | 1165 | public function getAppFolder() { |
1166 | - $dir = '/' . \OC_App::getCurrentApp(); |
|
1166 | + $dir = '/'.\OC_App::getCurrentApp(); |
|
1167 | 1167 | $root = $this->getRootFolder(); |
1168 | 1168 | if (!$root->nodeExists($dir)) { |
1169 | 1169 | $folder = $root->newFolder($dir); |
@@ -89,24 +89,24 @@ discard block |
||
89 | 89 | * @return boolean |
90 | 90 | */ |
91 | 91 | public function process($root, $file, $app) { |
92 | - $path = explode('/', $root . '/' . $file); |
|
92 | + $path = explode('/', $root.'/'.$file); |
|
93 | 93 | |
94 | 94 | $fileNameSCSS = array_pop($path); |
95 | 95 | $fileNameCSS = $this->prependBaseurlPrefix(str_replace('.scss', '.css', $fileNameSCSS)); |
96 | 96 | |
97 | 97 | $path = implode('/', $path); |
98 | 98 | |
99 | - $webDir = substr($path, strlen($this->serverRoot)+1); |
|
99 | + $webDir = substr($path, strlen($this->serverRoot) + 1); |
|
100 | 100 | |
101 | 101 | try { |
102 | 102 | $folder = $this->appData->getFolder($app); |
103 | - } catch(NotFoundException $e) { |
|
103 | + } catch (NotFoundException $e) { |
|
104 | 104 | // creating css appdata folder |
105 | 105 | $folder = $this->appData->newFolder($app); |
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | - if(!$this->variablesChanged() && $this->isCached($fileNameCSS, $folder)) { |
|
109 | + if (!$this->variablesChanged() && $this->isCached($fileNameCSS, $folder)) { |
|
110 | 110 | return true; |
111 | 111 | } |
112 | 112 | return $this->cache($path, $fileNameCSS, $fileNameSCSS, $folder, $webDir); |
@@ -132,13 +132,13 @@ discard block |
||
132 | 132 | try { |
133 | 133 | $cachedFile = $folder->getFile($fileNameCSS); |
134 | 134 | if ($cachedFile->getSize() > 0) { |
135 | - $depFileName = $fileNameCSS . '.deps'; |
|
136 | - $deps = $this->depsCache->get($folder->getName() . '-' . $depFileName); |
|
135 | + $depFileName = $fileNameCSS.'.deps'; |
|
136 | + $deps = $this->depsCache->get($folder->getName().'-'.$depFileName); |
|
137 | 137 | if ($deps === null) { |
138 | 138 | $depFile = $folder->getFile($depFileName); |
139 | 139 | $deps = $depFile->getContent(); |
140 | 140 | //Set to memcache for next run |
141 | - $this->depsCache->set($folder->getName() . '-' . $depFileName, $deps); |
|
141 | + $this->depsCache->set($folder->getName().'-'.$depFileName, $deps); |
|
142 | 142 | } |
143 | 143 | $deps = json_decode($deps, true); |
144 | 144 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } |
150 | 150 | } |
151 | 151 | return true; |
152 | - } catch(NotFoundException $e) { |
|
152 | + } catch (NotFoundException $e) { |
|
153 | 153 | return false; |
154 | 154 | } |
155 | 155 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | private function variablesChanged() { |
162 | 162 | $injectedVariables = $this->getInjectedVariables(); |
163 | - if($this->config->getAppValue('core', 'scss.variables') !== md5($injectedVariables)) { |
|
163 | + if ($this->config->getAppValue('core', 'scss.variables') !== md5($injectedVariables)) { |
|
164 | 164 | $this->resetCache(); |
165 | 165 | $this->config->setAppValue('core', 'scss.variables', md5($injectedVariables)); |
166 | 166 | return true; |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | $scss = new Compiler(); |
182 | 182 | $scss->setImportPaths([ |
183 | 183 | $path, |
184 | - \OC::$SERVERROOT . '/core/css/', |
|
184 | + \OC::$SERVERROOT.'/core/css/', |
|
185 | 185 | ]); |
186 | - if($this->config->getSystemValue('debug')) { |
|
186 | + if ($this->config->getSystemValue('debug')) { |
|
187 | 187 | // Debug mode |
188 | 188 | $scss->setFormatter(Expanded::class); |
189 | 189 | $scss->setLineNumberStyle(Compiler::LINE_COMMENTS); |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | |
195 | 195 | try { |
196 | 196 | $cachedfile = $folder->getFile($fileNameCSS); |
197 | - } catch(NotFoundException $e) { |
|
197 | + } catch (NotFoundException $e) { |
|
198 | 198 | $cachedfile = $folder->newFile($fileNameCSS); |
199 | 199 | } |
200 | 200 | |
201 | - $depFileName = $fileNameCSS . '.deps'; |
|
201 | + $depFileName = $fileNameCSS.'.deps'; |
|
202 | 202 | try { |
203 | 203 | $depFile = $folder->getFile($depFileName); |
204 | 204 | } catch (NotFoundException $e) { |
@@ -208,19 +208,19 @@ discard block |
||
208 | 208 | // Compile |
209 | 209 | try { |
210 | 210 | $compiledScss = $scss->compile( |
211 | - '@import "variables.scss";' . |
|
212 | - $this->getInjectedVariables() . |
|
211 | + '@import "variables.scss";'. |
|
212 | + $this->getInjectedVariables(). |
|
213 | 213 | '@import "'.$fileNameSCSS.'";'); |
214 | - } catch(ParserException $e) { |
|
214 | + } catch (ParserException $e) { |
|
215 | 215 | $this->logger->error($e, ['app' => 'core']); |
216 | 216 | return false; |
217 | 217 | } |
218 | 218 | |
219 | 219 | // Gzip file |
220 | 220 | try { |
221 | - $gzipFile = $folder->getFile($fileNameCSS . '.gzip'); # Safari doesn't like .gz |
|
221 | + $gzipFile = $folder->getFile($fileNameCSS.'.gzip'); # Safari doesn't like .gz |
|
222 | 222 | } catch (NotFoundException $e) { |
223 | - $gzipFile = $folder->newFile($fileNameCSS . '.gzip'); # Safari doesn't like .gz |
|
223 | + $gzipFile = $folder->newFile($fileNameCSS.'.gzip'); # Safari doesn't like .gz |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | try { |
@@ -228,11 +228,11 @@ discard block |
||
228 | 228 | $cachedfile->putContent($data); |
229 | 229 | $deps = json_encode($scss->getParsedFiles()); |
230 | 230 | $depFile->putContent($deps); |
231 | - $this->depsCache->set($folder->getName() . '-' . $depFileName, $deps); |
|
231 | + $this->depsCache->set($folder->getName().'-'.$depFileName, $deps); |
|
232 | 232 | $gzipFile->putContent(gzencode($data, 9)); |
233 | 233 | $this->logger->debug($webDir.'/'.$fileNameSCSS.' compiled and successfully cached', ['app' => 'core']); |
234 | 234 | return true; |
235 | - } catch(NotPermittedException $e) { |
|
235 | + } catch (NotPermittedException $e) { |
|
236 | 236 | return false; |
237 | 237 | } |
238 | 238 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | private function resetCache() { |
245 | 245 | $appDirectory = $this->appData->getDirectoryListing(); |
246 | - if(empty($appDirectory)){ |
|
246 | + if (empty($appDirectory)) { |
|
247 | 247 | return; |
248 | 248 | } |
249 | 249 | foreach ($appDirectory as $folder) { |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | private function getInjectedVariables() { |
262 | 262 | $variables = ''; |
263 | 263 | foreach ($this->defaults->getScssVariables() as $key => $value) { |
264 | - $variables .= '$' . $key . ': ' . $value . ';'; |
|
264 | + $variables .= '$'.$key.': '.$value.';'; |
|
265 | 265 | } |
266 | 266 | return $variables; |
267 | 267 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | private function rebaseUrls($css, $webDir) { |
276 | 276 | $re = '/url\([\'"]([\.\w?=\/-]*)[\'"]\)/x'; |
277 | 277 | // OC\Route\Router:75 |
278 | - if(($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) { |
|
278 | + if (($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true')) { |
|
279 | 279 | $subst = 'url(\'../../'.$webDir.'/$1\')'; |
280 | 280 | } else { |
281 | 281 | $subst = 'url(\'../../../'.$webDir.'/$1\')'; |
@@ -303,6 +303,6 @@ discard block |
||
303 | 303 | * @return string |
304 | 304 | */ |
305 | 305 | private function prependBaseurlPrefix($cssFile) { |
306 | - return md5($this->urlGenerator->getBaseUrl()) . '-' . $cssFile; |
|
306 | + return md5($this->urlGenerator->getBaseUrl()).'-'.$cssFile; |
|
307 | 307 | } |
308 | 308 | } |