@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | try { |
140 | 140 | self::loadApp($app); |
141 | 141 | } catch (\Throwable $e) { |
142 | - \OC::$server->get(LoggerInterface::class)->emergency('Error during app loading: ' . $e->getMessage(), [ |
|
142 | + \OC::$server->get(LoggerInterface::class)->emergency('Error during app loading: '.$e->getMessage(), [ |
|
143 | 143 | 'exception' => $e, |
144 | 144 | 'app' => $app, |
145 | 145 | ]); |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | $coordinator = \OC::$server->query(Coordinator::class); |
172 | 172 | $isBootable = $coordinator->isBootable($app); |
173 | 173 | |
174 | - $hasAppPhpFile = is_file($appPath . '/appinfo/app.php'); |
|
174 | + $hasAppPhpFile = is_file($appPath.'/appinfo/app.php'); |
|
175 | 175 | |
176 | - \OC::$server->getEventLogger()->start('bootstrap:load_app_' . $app, 'Load app: ' . $app); |
|
176 | + \OC::$server->getEventLogger()->start('bootstrap:load_app_'.$app, 'Load app: '.$app); |
|
177 | 177 | if ($isBootable && $hasAppPhpFile) { |
178 | 178 | \OC::$server->getLogger()->error('/appinfo/app.php is not loaded when \OCP\AppFramework\Bootstrap\IBootstrap on the application class is used. Migrate everything from app.php to the Application class.', [ |
179 | 179 | 'app' => $app, |
@@ -190,19 +190,19 @@ discard block |
||
190 | 190 | } |
191 | 191 | if (!\OC::$server->getAppManager()->isShipped($app) && !self::isType($app, ['authentication'])) { |
192 | 192 | \OC::$server->getLogger()->logException($ex, [ |
193 | - 'message' => "App $app threw an error during app.php load and will be disabled: " . $ex->getMessage(), |
|
193 | + 'message' => "App $app threw an error during app.php load and will be disabled: ".$ex->getMessage(), |
|
194 | 194 | ]); |
195 | 195 | |
196 | 196 | // Only disable apps which are not shipped and that are not authentication apps |
197 | 197 | \OC::$server->getAppManager()->disableApp($app, true); |
198 | 198 | } else { |
199 | 199 | \OC::$server->getLogger()->logException($ex, [ |
200 | - 'message' => "App $app threw an error during app.php load: " . $ex->getMessage(), |
|
200 | + 'message' => "App $app threw an error during app.php load: ".$ex->getMessage(), |
|
201 | 201 | ]); |
202 | 202 | } |
203 | 203 | } |
204 | 204 | } |
205 | - \OC::$server->getEventLogger()->end('bootstrap:load_app_' . $app); |
|
205 | + \OC::$server->getEventLogger()->end('bootstrap:load_app_'.$app); |
|
206 | 206 | |
207 | 207 | $coordinator->bootApp($app); |
208 | 208 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * @param bool $force |
270 | 270 | */ |
271 | 271 | public static function registerAutoloading(string $app, string $path, bool $force = false) { |
272 | - $key = $app . '-' . $path; |
|
272 | + $key = $app.'-'.$path; |
|
273 | 273 | if (!$force && isset(self::$alreadyRegistered[$key])) { |
274 | 274 | return; |
275 | 275 | } |
@@ -280,17 +280,17 @@ discard block |
||
280 | 280 | $appNamespace = \OC\AppFramework\App::buildAppNamespace($app); |
281 | 281 | \OC::$server->registerNamespace($app, $appNamespace); |
282 | 282 | |
283 | - if (file_exists($path . '/composer/autoload.php')) { |
|
284 | - require_once $path . '/composer/autoload.php'; |
|
283 | + if (file_exists($path.'/composer/autoload.php')) { |
|
284 | + require_once $path.'/composer/autoload.php'; |
|
285 | 285 | } else { |
286 | - \OC::$composerAutoloader->addPsr4($appNamespace . '\\', $path . '/lib/', true); |
|
286 | + \OC::$composerAutoloader->addPsr4($appNamespace.'\\', $path.'/lib/', true); |
|
287 | 287 | // Register on legacy autoloader |
288 | 288 | \OC::$loader->addValidRoot($path); |
289 | 289 | } |
290 | 290 | |
291 | 291 | // Register Test namespace only when testing |
292 | 292 | if (defined('PHPUNIT_RUN') || defined('CLI_TEST_RUN')) { |
293 | - \OC::$composerAutoloader->addPsr4($appNamespace . '\\Tests\\', $path . '/tests/', true); |
|
293 | + \OC::$composerAutoloader->addPsr4($appNamespace.'\\Tests\\', $path.'/tests/', true); |
|
294 | 294 | } |
295 | 295 | } |
296 | 296 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | */ |
303 | 303 | private static function requireAppFile(string $app) { |
304 | 304 | // encapsulated here to avoid variable scope conflicts |
305 | - require_once $app . '/appinfo/app.php'; |
|
305 | + require_once $app.'/appinfo/app.php'; |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
@@ -395,8 +395,8 @@ discard block |
||
395 | 395 | } else { |
396 | 396 | $apps = $appManager->getEnabledAppsForUser($user); |
397 | 397 | } |
398 | - $apps = array_filter($apps, function ($app) { |
|
399 | - return $app !== 'files';//we add this manually |
|
398 | + $apps = array_filter($apps, function($app) { |
|
399 | + return $app !== 'files'; //we add this manually |
|
400 | 400 | }); |
401 | 401 | sort($apps); |
402 | 402 | array_unshift($apps, 'files'); |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | |
493 | 493 | $possibleApps = []; |
494 | 494 | foreach (OC::$APPSROOTS as $dir) { |
495 | - if (file_exists($dir['path'] . '/' . $appId)) { |
|
495 | + if (file_exists($dir['path'].'/'.$appId)) { |
|
496 | 496 | $possibleApps[] = $dir; |
497 | 497 | } |
498 | 498 | } |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | } else { |
507 | 507 | $versionToLoad = []; |
508 | 508 | foreach ($possibleApps as $possibleApp) { |
509 | - $version = self::getAppVersionByPath($possibleApp['path'] . '/' . $appId); |
|
509 | + $version = self::getAppVersionByPath($possibleApp['path'].'/'.$appId); |
|
510 | 510 | if (empty($versionToLoad) || version_compare($version, $versionToLoad['version'], '>')) { |
511 | 511 | $versionToLoad = [ |
512 | 512 | 'dir' => $possibleApp, |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | } |
537 | 537 | |
538 | 538 | if (($dir = self::findAppInDirectories($appId)) != false) { |
539 | - return $dir['path'] . '/' . $appId; |
|
539 | + return $dir['path'].'/'.$appId; |
|
540 | 540 | } |
541 | 541 | return false; |
542 | 542 | } |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | */ |
552 | 552 | public static function getAppWebPath(string $appId) { |
553 | 553 | if (($dir = self::findAppInDirectories($appId)) != false) { |
554 | - return OC::$WEBROOT . $dir['url'] . '/' . $appId; |
|
554 | + return OC::$WEBROOT.$dir['url'].'/'.$appId; |
|
555 | 555 | } |
556 | 556 | return false; |
557 | 557 | } |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | * @return string |
576 | 576 | */ |
577 | 577 | public static function getAppVersionByPath(string $path): string { |
578 | - $infoFile = $path . '/appinfo/info.xml'; |
|
578 | + $infoFile = $path.'/appinfo/info.xml'; |
|
579 | 579 | $appData = \OC::$server->getAppManager()->getAppInfo($infoFile, true); |
580 | 580 | return isset($appData['version']) ? $appData['version'] : ''; |
581 | 581 | } |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | * @param string $page |
676 | 676 | */ |
677 | 677 | public static function registerAdmin(string $app, string $page) { |
678 | - self::$adminForms[] = $app . '/' . $page . '.php'; |
|
678 | + self::$adminForms[] = $app.'/'.$page.'.php'; |
|
679 | 679 | } |
680 | 680 | |
681 | 681 | /** |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | * @param string $page |
685 | 685 | */ |
686 | 686 | public static function registerPersonal(string $app, string $page) { |
687 | - self::$personalForms[] = $app . '/' . $page . '.php'; |
|
687 | + self::$personalForms[] = $app.'/'.$page.'.php'; |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | /** |
@@ -755,14 +755,14 @@ discard block |
||
755 | 755 | |
756 | 756 | foreach (OC::$APPSROOTS as $apps_dir) { |
757 | 757 | if (!is_readable($apps_dir['path'])) { |
758 | - \OCP\Util::writeLog('core', 'unable to read app folder : ' . $apps_dir['path'], ILogger::WARN); |
|
758 | + \OCP\Util::writeLog('core', 'unable to read app folder : '.$apps_dir['path'], ILogger::WARN); |
|
759 | 759 | continue; |
760 | 760 | } |
761 | 761 | $dh = opendir($apps_dir['path']); |
762 | 762 | |
763 | 763 | if (is_resource($dh)) { |
764 | 764 | while (($file = readdir($dh)) !== false) { |
765 | - if ($file[0] != '.' and is_dir($apps_dir['path'] . '/' . $file) and is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml')) { |
|
765 | + if ($file[0] != '.' and is_dir($apps_dir['path'].'/'.$file) and is_file($apps_dir['path'].'/'.$file.'/appinfo/info.xml')) { |
|
766 | 766 | $apps[] = $file; |
767 | 767 | } |
768 | 768 | } |
@@ -806,12 +806,12 @@ discard block |
||
806 | 806 | if (array_search($app, $blacklist) === false) { |
807 | 807 | $info = OC_App::getAppInfo($app, false, $langCode); |
808 | 808 | if (!is_array($info)) { |
809 | - \OCP\Util::writeLog('core', 'Could not read app info file for app "' . $app . '"', ILogger::ERROR); |
|
809 | + \OCP\Util::writeLog('core', 'Could not read app info file for app "'.$app.'"', ILogger::ERROR); |
|
810 | 810 | continue; |
811 | 811 | } |
812 | 812 | |
813 | 813 | if (!isset($info['name'])) { |
814 | - \OCP\Util::writeLog('core', 'App id "' . $app . '" has no name in appinfo', ILogger::ERROR); |
|
814 | + \OCP\Util::writeLog('core', 'App id "'.$app.'" has no name in appinfo', ILogger::ERROR); |
|
815 | 815 | continue; |
816 | 816 | } |
817 | 817 | |
@@ -843,12 +843,12 @@ discard block |
||
843 | 843 | |
844 | 844 | $appPath = self::getAppPath($app); |
845 | 845 | if ($appPath !== false) { |
846 | - $appIcon = $appPath . '/img/' . $app . '.svg'; |
|
846 | + $appIcon = $appPath.'/img/'.$app.'.svg'; |
|
847 | 847 | if (file_exists($appIcon)) { |
848 | - $info['preview'] = $urlGenerator->imagePath($app, $app . '.svg'); |
|
848 | + $info['preview'] = $urlGenerator->imagePath($app, $app.'.svg'); |
|
849 | 849 | $info['previewAsIcon'] = true; |
850 | 850 | } else { |
851 | - $appIcon = $appPath . '/img/app.svg'; |
|
851 | + $appIcon = $appPath.'/img/app.svg'; |
|
852 | 852 | if (file_exists($appIcon)) { |
853 | 853 | $info['preview'] = $urlGenerator->imagePath($app, 'app.svg'); |
854 | 854 | $info['previewAsIcon'] = true; |
@@ -987,8 +987,8 @@ discard block |
||
987 | 987 | return false; |
988 | 988 | } |
989 | 989 | |
990 | - if (is_file($appPath . '/appinfo/database.xml')) { |
|
991 | - \OC::$server->getLogger()->error('The appinfo/database.xml file is not longer supported. Used in ' . $appId); |
|
990 | + if (is_file($appPath.'/appinfo/database.xml')) { |
|
991 | + \OC::$server->getLogger()->error('The appinfo/database.xml file is not longer supported. Used in '.$appId); |
|
992 | 992 | return false; |
993 | 993 | } |
994 | 994 | |
@@ -1026,10 +1026,10 @@ discard block |
||
1026 | 1026 | \OC::$server->getConfig()->deleteAppValue($appId, 'ocsid'); |
1027 | 1027 | } |
1028 | 1028 | foreach ($appData['remote'] as $name => $path) { |
1029 | - \OC::$server->getConfig()->setAppValue('core', 'remote_' . $name, $appId . '/' . $path); |
|
1029 | + \OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $appId.'/'.$path); |
|
1030 | 1030 | } |
1031 | 1031 | foreach ($appData['public'] as $name => $path) { |
1032 | - \OC::$server->getConfig()->setAppValue('core', 'public_' . $name, $appId . '/' . $path); |
|
1032 | + \OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $appId.'/'.$path); |
|
1033 | 1033 | } |
1034 | 1034 | |
1035 | 1035 | self::setAppTypes($appId); |
@@ -1099,17 +1099,17 @@ discard block |
||
1099 | 1099 | public static function getStorage(string $appId) { |
1100 | 1100 | if (\OC::$server->getAppManager()->isEnabledForUser($appId)) { //sanity check |
1101 | 1101 | if (\OC::$server->getUserSession()->isLoggedIn()) { |
1102 | - $view = new \OC\Files\View('/' . OC_User::getUser()); |
|
1102 | + $view = new \OC\Files\View('/'.OC_User::getUser()); |
|
1103 | 1103 | if (!$view->file_exists($appId)) { |
1104 | 1104 | $view->mkdir($appId); |
1105 | 1105 | } |
1106 | - return new \OC\Files\View('/' . OC_User::getUser() . '/' . $appId); |
|
1106 | + return new \OC\Files\View('/'.OC_User::getUser().'/'.$appId); |
|
1107 | 1107 | } else { |
1108 | - \OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', ILogger::ERROR); |
|
1108 | + \OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.', user not logged in', ILogger::ERROR); |
|
1109 | 1109 | return false; |
1110 | 1110 | } |
1111 | 1111 | } else { |
1112 | - \OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', ILogger::ERROR); |
|
1112 | + \OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.' not enabled', ILogger::ERROR); |
|
1113 | 1113 | return false; |
1114 | 1114 | } |
1115 | 1115 | } |
@@ -1146,7 +1146,7 @@ discard block |
||
1146 | 1146 | |
1147 | 1147 | if ($attributeLang === $similarLang) { |
1148 | 1148 | $similarLangFallback = $option['@value']; |
1149 | - } elseif (strpos($attributeLang, $similarLang . '_') === 0) { |
|
1149 | + } elseif (strpos($attributeLang, $similarLang.'_') === 0) { |
|
1150 | 1150 | if ($similarLangFallback === false) { |
1151 | 1151 | $similarLangFallback = $option['@value']; |
1152 | 1152 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | return $status; |
95 | 95 | } catch (Exception $e) { |
96 | 96 | // throw a new exception to prevent leaking info from the stacktrace |
97 | - throw new Exception('Failed to connect to the database: ' . $e->getMessage(), $e->getCode()); |
|
97 | + throw new Exception('Failed to connect to the database: '.$e->getMessage(), $e->getCode()); |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | // 0 is the method where we use `getCallerBacktrace` |
155 | 155 | // 1 is the target method which uses the method we want to log |
156 | 156 | if (isset($traces[1])) { |
157 | - return $traces[1]['file'] . ':' . $traces[1]['line']; |
|
157 | + return $traces[1]['file'].':'.$traces[1]['line']; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | return ''; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | if ($logFile !== '' && is_writable(dirname($logFile)) && (!file_exists($logFile) || is_writable($logFile))) { |
286 | 286 | file_put_contents( |
287 | 287 | $this->systemConfig->getValue('query_log_file', ''), |
288 | - $sql . "\n", |
|
288 | + $sql."\n", |
|
289 | 289 | FILE_APPEND |
290 | 290 | ); |
291 | 291 | } |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | $insertQb = $this->getQueryBuilder(); |
368 | 368 | $insertQb->insert($table) |
369 | 369 | ->values( |
370 | - array_map(function ($value) use ($insertQb) { |
|
370 | + array_map(function($value) use ($insertQb) { |
|
371 | 371 | return $insertQb->createNamedParameter($value, $this->getType($value)); |
372 | 372 | }, array_merge($keys, $values)) |
373 | 373 | ); |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | throw new \BadMethodCallException('Can not lock a new table until the previous lock is released.'); |
422 | 422 | } |
423 | 423 | |
424 | - $tableName = $this->tablePrefix . $tableName; |
|
424 | + $tableName = $this->tablePrefix.$tableName; |
|
425 | 425 | $this->lockedTable = $tableName; |
426 | 426 | $this->adapter->lockTable($tableName); |
427 | 427 | } |
@@ -443,11 +443,11 @@ discard block |
||
443 | 443 | * @return string |
444 | 444 | */ |
445 | 445 | public function getError() { |
446 | - $msg = $this->errorCode() . ': '; |
|
446 | + $msg = $this->errorCode().': '; |
|
447 | 447 | $errorInfo = $this->errorInfo(); |
448 | 448 | if (!empty($errorInfo)) { |
449 | - $msg .= 'SQLSTATE = '.$errorInfo[0] . ', '; |
|
450 | - $msg .= 'Driver Code = '.$errorInfo[1] . ', '; |
|
449 | + $msg .= 'SQLSTATE = '.$errorInfo[0].', '; |
|
450 | + $msg .= 'Driver Code = '.$errorInfo[1].', '; |
|
451 | 451 | $msg .= 'Driver Message = '.$errorInfo[2]; |
452 | 452 | } |
453 | 453 | return $msg; |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | * @throws Exception |
470 | 470 | */ |
471 | 471 | public function dropTable($table) { |
472 | - $table = $this->tablePrefix . trim($table); |
|
472 | + $table = $this->tablePrefix.trim($table); |
|
473 | 473 | $schema = $this->getSchemaManager(); |
474 | 474 | if ($schema->tablesExist([$table])) { |
475 | 475 | $schema->dropTable($table); |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | * @throws Exception |
486 | 486 | */ |
487 | 487 | public function tableExists($table) { |
488 | - $table = $this->tablePrefix . trim($table); |
|
488 | + $table = $this->tablePrefix.trim($table); |
|
489 | 489 | $schema = $this->getSchemaManager(); |
490 | 490 | return $schema->tablesExist([$table]); |
491 | 491 | } |
@@ -278,10 +278,10 @@ discard block |
||
278 | 278 | $this->registerParameter('isCLI', \OC::$CLI); |
279 | 279 | $this->registerParameter('serverRoot', \OC::$SERVERROOT); |
280 | 280 | |
281 | - $this->registerService(ContainerInterface::class, function (ContainerInterface $c) { |
|
281 | + $this->registerService(ContainerInterface::class, function(ContainerInterface $c) { |
|
282 | 282 | return $c; |
283 | 283 | }); |
284 | - $this->registerService(\OCP\IServerContainer::class, function (ContainerInterface $c) { |
|
284 | + $this->registerService(\OCP\IServerContainer::class, function(ContainerInterface $c) { |
|
285 | 285 | return $c; |
286 | 286 | }); |
287 | 287 | |
@@ -306,11 +306,11 @@ discard block |
||
306 | 306 | |
307 | 307 | $this->registerAlias(IActionFactory::class, ActionFactory::class); |
308 | 308 | |
309 | - $this->registerService(View::class, function (Server $c) { |
|
309 | + $this->registerService(View::class, function(Server $c) { |
|
310 | 310 | return new View(); |
311 | 311 | }, false); |
312 | 312 | |
313 | - $this->registerService(IPreview::class, function (ContainerInterface $c) { |
|
313 | + $this->registerService(IPreview::class, function(ContainerInterface $c) { |
|
314 | 314 | return new PreviewManager( |
315 | 315 | $c->get(\OCP\IConfig::class), |
316 | 316 | $c->get(IRootFolder::class), |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | /** @deprecated 19.0.0 */ |
329 | 329 | $this->registerDeprecatedAlias('PreviewManager', IPreview::class); |
330 | 330 | |
331 | - $this->registerService(\OC\Preview\Watcher::class, function (ContainerInterface $c) { |
|
331 | + $this->registerService(\OC\Preview\Watcher::class, function(ContainerInterface $c) { |
|
332 | 332 | return new \OC\Preview\Watcher( |
333 | 333 | new \OC\Preview\Storage\Root( |
334 | 334 | $c->get(IRootFolder::class), |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | ); |
338 | 338 | }); |
339 | 339 | |
340 | - $this->registerService(\OCP\Encryption\IManager::class, function (Server $c) { |
|
340 | + $this->registerService(\OCP\Encryption\IManager::class, function(Server $c) { |
|
341 | 341 | $view = new View(); |
342 | 342 | $util = new Encryption\Util( |
343 | 343 | $view, |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | /** @deprecated 21.0.0 */ |
361 | 361 | $this->registerDeprecatedAlias('EncryptionFileHelper', IFile::class); |
362 | - $this->registerService(IFile::class, function (ContainerInterface $c) { |
|
362 | + $this->registerService(IFile::class, function(ContainerInterface $c) { |
|
363 | 363 | $util = new Encryption\Util( |
364 | 364 | new View(), |
365 | 365 | $c->get(IUserManager::class), |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | |
376 | 376 | /** @deprecated 21.0.0 */ |
377 | 377 | $this->registerDeprecatedAlias('EncryptionKeyStorage', IStorage::class); |
378 | - $this->registerService(IStorage::class, function (ContainerInterface $c) { |
|
378 | + $this->registerService(IStorage::class, function(ContainerInterface $c) { |
|
379 | 379 | $view = new View(); |
380 | 380 | $util = new Encryption\Util( |
381 | 381 | $view, |
@@ -398,22 +398,22 @@ discard block |
||
398 | 398 | /** @deprecated 19.0.0 */ |
399 | 399 | $this->registerDeprecatedAlias('TagManager', \OCP\ITagManager::class); |
400 | 400 | |
401 | - $this->registerService('SystemTagManagerFactory', function (ContainerInterface $c) { |
|
401 | + $this->registerService('SystemTagManagerFactory', function(ContainerInterface $c) { |
|
402 | 402 | /** @var \OCP\IConfig $config */ |
403 | 403 | $config = $c->get(\OCP\IConfig::class); |
404 | 404 | $factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class); |
405 | 405 | return new $factoryClass($this); |
406 | 406 | }); |
407 | - $this->registerService(ISystemTagManager::class, function (ContainerInterface $c) { |
|
407 | + $this->registerService(ISystemTagManager::class, function(ContainerInterface $c) { |
|
408 | 408 | return $c->get('SystemTagManagerFactory')->getManager(); |
409 | 409 | }); |
410 | 410 | /** @deprecated 19.0.0 */ |
411 | 411 | $this->registerDeprecatedAlias('SystemTagManager', ISystemTagManager::class); |
412 | 412 | |
413 | - $this->registerService(ISystemTagObjectMapper::class, function (ContainerInterface $c) { |
|
413 | + $this->registerService(ISystemTagObjectMapper::class, function(ContainerInterface $c) { |
|
414 | 414 | return $c->get('SystemTagManagerFactory')->getObjectMapper(); |
415 | 415 | }); |
416 | - $this->registerService('RootFolder', function (ContainerInterface $c) { |
|
416 | + $this->registerService('RootFolder', function(ContainerInterface $c) { |
|
417 | 417 | $manager = \OC\Files\Filesystem::getMountManager(null); |
418 | 418 | $view = new View(); |
419 | 419 | $root = new Root( |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | |
434 | 434 | return $root; |
435 | 435 | }); |
436 | - $this->registerService(HookConnector::class, function (ContainerInterface $c) { |
|
436 | + $this->registerService(HookConnector::class, function(ContainerInterface $c) { |
|
437 | 437 | return new HookConnector( |
438 | 438 | $c->get(IRootFolder::class), |
439 | 439 | new View(), |
@@ -445,8 +445,8 @@ discard block |
||
445 | 445 | /** @deprecated 19.0.0 */ |
446 | 446 | $this->registerDeprecatedAlias('SystemTagObjectMapper', ISystemTagObjectMapper::class); |
447 | 447 | |
448 | - $this->registerService(IRootFolder::class, function (ContainerInterface $c) { |
|
449 | - return new LazyRoot(function () use ($c) { |
|
448 | + $this->registerService(IRootFolder::class, function(ContainerInterface $c) { |
|
449 | + return new LazyRoot(function() use ($c) { |
|
450 | 450 | return $c->get('RootFolder'); |
451 | 451 | }); |
452 | 452 | }); |
@@ -457,44 +457,44 @@ discard block |
||
457 | 457 | $this->registerDeprecatedAlias('UserManager', \OC\User\Manager::class); |
458 | 458 | $this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class); |
459 | 459 | |
460 | - $this->registerService(\OCP\IGroupManager::class, function (ContainerInterface $c) { |
|
460 | + $this->registerService(\OCP\IGroupManager::class, function(ContainerInterface $c) { |
|
461 | 461 | $groupManager = new \OC\Group\Manager($this->get(IUserManager::class), $c->get(SymfonyAdapter::class), $this->get(ILogger::class)); |
462 | - $groupManager->listen('\OC\Group', 'preCreate', function ($gid) { |
|
462 | + $groupManager->listen('\OC\Group', 'preCreate', function($gid) { |
|
463 | 463 | /** @var IEventDispatcher $dispatcher */ |
464 | 464 | $dispatcher = $this->get(IEventDispatcher::class); |
465 | 465 | $dispatcher->dispatchTyped(new BeforeGroupCreatedEvent($gid)); |
466 | 466 | }); |
467 | - $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $group) { |
|
467 | + $groupManager->listen('\OC\Group', 'postCreate', function(\OC\Group\Group $group) { |
|
468 | 468 | /** @var IEventDispatcher $dispatcher */ |
469 | 469 | $dispatcher = $this->get(IEventDispatcher::class); |
470 | 470 | $dispatcher->dispatchTyped(new GroupCreatedEvent($group)); |
471 | 471 | }); |
472 | - $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) { |
|
472 | + $groupManager->listen('\OC\Group', 'preDelete', function(\OC\Group\Group $group) { |
|
473 | 473 | /** @var IEventDispatcher $dispatcher */ |
474 | 474 | $dispatcher = $this->get(IEventDispatcher::class); |
475 | 475 | $dispatcher->dispatchTyped(new BeforeGroupDeletedEvent($group)); |
476 | 476 | }); |
477 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) { |
|
477 | + $groupManager->listen('\OC\Group', 'postDelete', function(\OC\Group\Group $group) { |
|
478 | 478 | /** @var IEventDispatcher $dispatcher */ |
479 | 479 | $dispatcher = $this->get(IEventDispatcher::class); |
480 | 480 | $dispatcher->dispatchTyped(new GroupDeletedEvent($group)); |
481 | 481 | }); |
482 | - $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
482 | + $groupManager->listen('\OC\Group', 'preAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
483 | 483 | /** @var IEventDispatcher $dispatcher */ |
484 | 484 | $dispatcher = $this->get(IEventDispatcher::class); |
485 | 485 | $dispatcher->dispatchTyped(new BeforeUserAddedEvent($group, $user)); |
486 | 486 | }); |
487 | - $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
487 | + $groupManager->listen('\OC\Group', 'postAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
488 | 488 | /** @var IEventDispatcher $dispatcher */ |
489 | 489 | $dispatcher = $this->get(IEventDispatcher::class); |
490 | 490 | $dispatcher->dispatchTyped(new UserAddedEvent($group, $user)); |
491 | 491 | }); |
492 | - $groupManager->listen('\OC\Group', 'preRemoveUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
492 | + $groupManager->listen('\OC\Group', 'preRemoveUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
493 | 493 | /** @var IEventDispatcher $dispatcher */ |
494 | 494 | $dispatcher = $this->get(IEventDispatcher::class); |
495 | 495 | $dispatcher->dispatchTyped(new BeforeUserRemovedEvent($group, $user)); |
496 | 496 | }); |
497 | - $groupManager->listen('\OC\Group', 'postRemoveUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
497 | + $groupManager->listen('\OC\Group', 'postRemoveUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
498 | 498 | /** @var IEventDispatcher $dispatcher */ |
499 | 499 | $dispatcher = $this->get(IEventDispatcher::class); |
500 | 500 | $dispatcher->dispatchTyped(new UserRemovedEvent($group, $user)); |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | /** @deprecated 19.0.0 */ |
505 | 505 | $this->registerDeprecatedAlias('GroupManager', \OCP\IGroupManager::class); |
506 | 506 | |
507 | - $this->registerService(Store::class, function (ContainerInterface $c) { |
|
507 | + $this->registerService(Store::class, function(ContainerInterface $c) { |
|
508 | 508 | $session = $c->get(ISession::class); |
509 | 509 | if (\OC::$server->get(SystemConfig::class)->getValue('installed', false)) { |
510 | 510 | $tokenProvider = $c->get(IProvider::class); |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | $this->registerAlias(IStore::class, Store::class); |
518 | 518 | $this->registerAlias(IProvider::class, Authentication\Token\Manager::class); |
519 | 519 | |
520 | - $this->registerService(\OC\User\Session::class, function (Server $c) { |
|
520 | + $this->registerService(\OC\User\Session::class, function(Server $c) { |
|
521 | 521 | $manager = $c->get(IUserManager::class); |
522 | 522 | $session = new \OC\Session\Memory(''); |
523 | 523 | $timeFactory = new TimeFactory(); |
@@ -543,26 +543,26 @@ discard block |
||
543 | 543 | $c->get(IEventDispatcher::class) |
544 | 544 | ); |
545 | 545 | /** @deprecated 21.0.0 use BeforeUserCreatedEvent event with the IEventDispatcher instead */ |
546 | - $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { |
|
546 | + $userSession->listen('\OC\User', 'preCreateUser', function($uid, $password) { |
|
547 | 547 | \OC_Hook::emit('OC_User', 'pre_createUser', ['run' => true, 'uid' => $uid, 'password' => $password]); |
548 | 548 | }); |
549 | 549 | /** @deprecated 21.0.0 use UserCreatedEvent event with the IEventDispatcher instead */ |
550 | - $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) { |
|
550 | + $userSession->listen('\OC\User', 'postCreateUser', function($user, $password) { |
|
551 | 551 | /** @var \OC\User\User $user */ |
552 | 552 | \OC_Hook::emit('OC_User', 'post_createUser', ['uid' => $user->getUID(), 'password' => $password]); |
553 | 553 | }); |
554 | 554 | /** @deprecated 21.0.0 use BeforeUserDeletedEvent event with the IEventDispatcher instead */ |
555 | - $userSession->listen('\OC\User', 'preDelete', function ($user) use ($legacyDispatcher) { |
|
555 | + $userSession->listen('\OC\User', 'preDelete', function($user) use ($legacyDispatcher) { |
|
556 | 556 | /** @var \OC\User\User $user */ |
557 | 557 | \OC_Hook::emit('OC_User', 'pre_deleteUser', ['run' => true, 'uid' => $user->getUID()]); |
558 | 558 | $legacyDispatcher->dispatch('OCP\IUser::preDelete', new GenericEvent($user)); |
559 | 559 | }); |
560 | 560 | /** @deprecated 21.0.0 use UserDeletedEvent event with the IEventDispatcher instead */ |
561 | - $userSession->listen('\OC\User', 'postDelete', function ($user) { |
|
561 | + $userSession->listen('\OC\User', 'postDelete', function($user) { |
|
562 | 562 | /** @var \OC\User\User $user */ |
563 | 563 | \OC_Hook::emit('OC_User', 'post_deleteUser', ['uid' => $user->getUID()]); |
564 | 564 | }); |
565 | - $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) { |
|
565 | + $userSession->listen('\OC\User', 'preSetPassword', function($user, $password, $recoveryPassword) { |
|
566 | 566 | /** @var \OC\User\User $user */ |
567 | 567 | \OC_Hook::emit('OC_User', 'pre_setPassword', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword]); |
568 | 568 | |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | $dispatcher = $this->get(IEventDispatcher::class); |
571 | 571 | $dispatcher->dispatchTyped(new BeforePasswordUpdatedEvent($user, $password, $recoveryPassword)); |
572 | 572 | }); |
573 | - $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) { |
|
573 | + $userSession->listen('\OC\User', 'postSetPassword', function($user, $password, $recoveryPassword) { |
|
574 | 574 | /** @var \OC\User\User $user */ |
575 | 575 | \OC_Hook::emit('OC_User', 'post_setPassword', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword]); |
576 | 576 | |
@@ -578,14 +578,14 @@ discard block |
||
578 | 578 | $dispatcher = $this->get(IEventDispatcher::class); |
579 | 579 | $dispatcher->dispatchTyped(new PasswordUpdatedEvent($user, $password, $recoveryPassword)); |
580 | 580 | }); |
581 | - $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) { |
|
581 | + $userSession->listen('\OC\User', 'preLogin', function($uid, $password) { |
|
582 | 582 | \OC_Hook::emit('OC_User', 'pre_login', ['run' => true, 'uid' => $uid, 'password' => $password]); |
583 | 583 | |
584 | 584 | /** @var IEventDispatcher $dispatcher */ |
585 | 585 | $dispatcher = $this->get(IEventDispatcher::class); |
586 | 586 | $dispatcher->dispatchTyped(new BeforeUserLoggedInEvent($uid, $password)); |
587 | 587 | }); |
588 | - $userSession->listen('\OC\User', 'postLogin', function ($user, $loginName, $password, $isTokenLogin) { |
|
588 | + $userSession->listen('\OC\User', 'postLogin', function($user, $loginName, $password, $isTokenLogin) { |
|
589 | 589 | /** @var \OC\User\User $user */ |
590 | 590 | \OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $user->getUID(), 'loginName' => $loginName, 'password' => $password, 'isTokenLogin' => $isTokenLogin]); |
591 | 591 | |
@@ -593,12 +593,12 @@ discard block |
||
593 | 593 | $dispatcher = $this->get(IEventDispatcher::class); |
594 | 594 | $dispatcher->dispatchTyped(new UserLoggedInEvent($user, $loginName, $password, $isTokenLogin)); |
595 | 595 | }); |
596 | - $userSession->listen('\OC\User', 'preRememberedLogin', function ($uid) { |
|
596 | + $userSession->listen('\OC\User', 'preRememberedLogin', function($uid) { |
|
597 | 597 | /** @var IEventDispatcher $dispatcher */ |
598 | 598 | $dispatcher = $this->get(IEventDispatcher::class); |
599 | 599 | $dispatcher->dispatchTyped(new BeforeUserLoggedInWithCookieEvent($uid)); |
600 | 600 | }); |
601 | - $userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) { |
|
601 | + $userSession->listen('\OC\User', 'postRememberedLogin', function($user, $password) { |
|
602 | 602 | /** @var \OC\User\User $user */ |
603 | 603 | \OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $user->getUID(), 'password' => $password]); |
604 | 604 | |
@@ -606,19 +606,19 @@ discard block |
||
606 | 606 | $dispatcher = $this->get(IEventDispatcher::class); |
607 | 607 | $dispatcher->dispatchTyped(new UserLoggedInWithCookieEvent($user, $password)); |
608 | 608 | }); |
609 | - $userSession->listen('\OC\User', 'logout', function ($user) { |
|
609 | + $userSession->listen('\OC\User', 'logout', function($user) { |
|
610 | 610 | \OC_Hook::emit('OC_User', 'logout', []); |
611 | 611 | |
612 | 612 | /** @var IEventDispatcher $dispatcher */ |
613 | 613 | $dispatcher = $this->get(IEventDispatcher::class); |
614 | 614 | $dispatcher->dispatchTyped(new BeforeUserLoggedOutEvent($user)); |
615 | 615 | }); |
616 | - $userSession->listen('\OC\User', 'postLogout', function ($user) { |
|
616 | + $userSession->listen('\OC\User', 'postLogout', function($user) { |
|
617 | 617 | /** @var IEventDispatcher $dispatcher */ |
618 | 618 | $dispatcher = $this->get(IEventDispatcher::class); |
619 | 619 | $dispatcher->dispatchTyped(new UserLoggedOutEvent($user)); |
620 | 620 | }); |
621 | - $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) { |
|
621 | + $userSession->listen('\OC\User', 'changeUser', function($user, $feature, $value, $oldValue) { |
|
622 | 622 | /** @var \OC\User\User $user */ |
623 | 623 | \OC_Hook::emit('OC_User', 'changeUser', ['run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue]); |
624 | 624 | |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | $this->registerDeprecatedAlias('AllConfig', \OC\AllConfig::class); |
643 | 643 | $this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class); |
644 | 644 | |
645 | - $this->registerService(\OC\SystemConfig::class, function ($c) use ($config) { |
|
645 | + $this->registerService(\OC\SystemConfig::class, function($c) use ($config) { |
|
646 | 646 | return new \OC\SystemConfig($config); |
647 | 647 | }); |
648 | 648 | /** @deprecated 19.0.0 */ |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | $this->registerDeprecatedAlias('AppConfig', \OC\AppConfig::class); |
653 | 653 | $this->registerAlias(IAppConfig::class, \OC\AppConfig::class); |
654 | 654 | |
655 | - $this->registerService(IFactory::class, function (Server $c) { |
|
655 | + $this->registerService(IFactory::class, function(Server $c) { |
|
656 | 656 | return new \OC\L10N\Factory( |
657 | 657 | $c->get(\OCP\IConfig::class), |
658 | 658 | $c->getRequest(), |
@@ -672,13 +672,13 @@ discard block |
||
672 | 672 | /** @deprecated 19.0.0 */ |
673 | 673 | $this->registerDeprecatedAlias('CategoryFetcher', CategoryFetcher::class); |
674 | 674 | |
675 | - $this->registerService(ICache::class, function ($c) { |
|
675 | + $this->registerService(ICache::class, function($c) { |
|
676 | 676 | return new Cache\File(); |
677 | 677 | }); |
678 | 678 | /** @deprecated 19.0.0 */ |
679 | 679 | $this->registerDeprecatedAlias('UserCache', ICache::class); |
680 | 680 | |
681 | - $this->registerService(Factory::class, function (Server $c) { |
|
681 | + $this->registerService(Factory::class, function(Server $c) { |
|
682 | 682 | $arrayCacheFactory = new \OC\Memcache\Factory('', $c->get(ILogger::class), |
683 | 683 | ArrayCache::class, |
684 | 684 | ArrayCache::class, |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | $version = implode(',', $v); |
703 | 703 | $instanceId = \OC_Util::getInstanceId(); |
704 | 704 | $path = \OC::$SERVERROOT; |
705 | - $prefix = md5($instanceId . '-' . $version . '-' . $path); |
|
705 | + $prefix = md5($instanceId.'-'.$version.'-'.$path); |
|
706 | 706 | return new \OC\Memcache\Factory($prefix, $c->get(ILogger::class), |
707 | 707 | $config->getSystemValue('memcache.local', null), |
708 | 708 | $config->getSystemValue('memcache.distributed', null), |
@@ -716,12 +716,12 @@ discard block |
||
716 | 716 | $this->registerDeprecatedAlias('MemCacheFactory', Factory::class); |
717 | 717 | $this->registerAlias(ICacheFactory::class, Factory::class); |
718 | 718 | |
719 | - $this->registerService('RedisFactory', function (Server $c) { |
|
719 | + $this->registerService('RedisFactory', function(Server $c) { |
|
720 | 720 | $systemConfig = $c->get(SystemConfig::class); |
721 | 721 | return new RedisFactory($systemConfig, $c->getEventLogger()); |
722 | 722 | }); |
723 | 723 | |
724 | - $this->registerService(\OCP\Activity\IManager::class, function (Server $c) { |
|
724 | + $this->registerService(\OCP\Activity\IManager::class, function(Server $c) { |
|
725 | 725 | $l10n = $this->get(IFactory::class)->get('lib'); |
726 | 726 | return new \OC\Activity\Manager( |
727 | 727 | $c->getRequest(), |
@@ -734,14 +734,14 @@ discard block |
||
734 | 734 | /** @deprecated 19.0.0 */ |
735 | 735 | $this->registerDeprecatedAlias('ActivityManager', \OCP\Activity\IManager::class); |
736 | 736 | |
737 | - $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) { |
|
737 | + $this->registerService(\OCP\Activity\IEventMerger::class, function(Server $c) { |
|
738 | 738 | return new \OC\Activity\EventMerger( |
739 | 739 | $c->getL10N('lib') |
740 | 740 | ); |
741 | 741 | }); |
742 | 742 | $this->registerAlias(IValidator::class, Validator::class); |
743 | 743 | |
744 | - $this->registerService(AvatarManager::class, function (Server $c) { |
|
744 | + $this->registerService(AvatarManager::class, function(Server $c) { |
|
745 | 745 | return new AvatarManager( |
746 | 746 | $c->get(IUserSession::class), |
747 | 747 | $c->get(\OC\User\Manager::class), |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | $this->registerAlias(\OCP\Support\CrashReport\IRegistry::class, \OC\Support\CrashReport\Registry::class); |
761 | 761 | $this->registerAlias(\OCP\Support\Subscription\IRegistry::class, \OC\Support\Subscription\Registry::class); |
762 | 762 | |
763 | - $this->registerService(\OC\Log::class, function (Server $c) { |
|
763 | + $this->registerService(\OC\Log::class, function(Server $c) { |
|
764 | 764 | $logType = $c->get(AllConfig::class)->getSystemValue('log_type', 'file'); |
765 | 765 | $factory = new LogFactory($c, $this->get(SystemConfig::class)); |
766 | 766 | $logger = $factory->get($logType); |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | // PSR-3 logger |
775 | 775 | $this->registerAlias(LoggerInterface::class, PsrLoggerAdapter::class); |
776 | 776 | |
777 | - $this->registerService(ILogFactory::class, function (Server $c) { |
|
777 | + $this->registerService(ILogFactory::class, function(Server $c) { |
|
778 | 778 | return new LogFactory($c, $this->get(SystemConfig::class)); |
779 | 779 | }); |
780 | 780 | |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | /** @deprecated 19.0.0 */ |
783 | 783 | $this->registerDeprecatedAlias('JobList', IJobList::class); |
784 | 784 | |
785 | - $this->registerService(Router::class, function (Server $c) { |
|
785 | + $this->registerService(Router::class, function(Server $c) { |
|
786 | 786 | $cacheFactory = $c->get(ICacheFactory::class); |
787 | 787 | $logger = $c->get(ILogger::class); |
788 | 788 | if ($cacheFactory->isLocalCacheAvailable()) { |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | /** @deprecated 19.0.0 */ |
801 | 801 | $this->registerDeprecatedAlias('Search', ISearch::class); |
802 | 802 | |
803 | - $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) { |
|
803 | + $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function($c) { |
|
804 | 804 | $cacheFactory = $c->get(ICacheFactory::class); |
805 | 805 | if ($cacheFactory->isAvailable()) { |
806 | 806 | $backend = new \OC\Security\RateLimiting\Backend\MemoryCacheBackend( |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | $this->registerDeprecatedAlias('CredentialsManager', ICredentialsManager::class); |
837 | 837 | |
838 | 838 | $this->registerAlias(IDBConnection::class, ConnectionAdapter::class); |
839 | - $this->registerService(Connection::class, function (Server $c) { |
|
839 | + $this->registerService(Connection::class, function(Server $c) { |
|
840 | 840 | $systemConfig = $c->get(SystemConfig::class); |
841 | 841 | $factory = new \OC\DB\ConnectionFactory($systemConfig); |
842 | 842 | $type = $systemConfig->getValue('dbtype', 'sqlite'); |
@@ -853,30 +853,30 @@ discard block |
||
853 | 853 | |
854 | 854 | $this->registerAlias(ICertificateManager::class, CertificateManager::class); |
855 | 855 | $this->registerAlias(IClientService::class, ClientService::class); |
856 | - $this->registerService(LocalAddressChecker::class, function (ContainerInterface $c) { |
|
856 | + $this->registerService(LocalAddressChecker::class, function(ContainerInterface $c) { |
|
857 | 857 | return new LocalAddressChecker( |
858 | 858 | $c->get(ILogger::class), |
859 | 859 | ); |
860 | 860 | }); |
861 | - $this->registerService(NegativeDnsCache::class, function (ContainerInterface $c) { |
|
861 | + $this->registerService(NegativeDnsCache::class, function(ContainerInterface $c) { |
|
862 | 862 | return new NegativeDnsCache( |
863 | 863 | $c->get(ICacheFactory::class), |
864 | 864 | ); |
865 | 865 | }); |
866 | - $this->registerService(DnsPinMiddleware::class, function (ContainerInterface $c) { |
|
866 | + $this->registerService(DnsPinMiddleware::class, function(ContainerInterface $c) { |
|
867 | 867 | return new DnsPinMiddleware( |
868 | 868 | $c->get(NegativeDnsCache::class), |
869 | 869 | $c->get(LocalAddressChecker::class) |
870 | 870 | ); |
871 | 871 | }); |
872 | 872 | $this->registerDeprecatedAlias('HttpClientService', IClientService::class); |
873 | - $this->registerService(IEventLogger::class, function (ContainerInterface $c) { |
|
873 | + $this->registerService(IEventLogger::class, function(ContainerInterface $c) { |
|
874 | 874 | return new EventLogger($c->get(SystemConfig::class), $c->get(LoggerInterface::class), $c->get(Log::class)); |
875 | 875 | }); |
876 | 876 | /** @deprecated 19.0.0 */ |
877 | 877 | $this->registerDeprecatedAlias('EventLogger', IEventLogger::class); |
878 | 878 | |
879 | - $this->registerService(IQueryLogger::class, function (ContainerInterface $c) { |
|
879 | + $this->registerService(IQueryLogger::class, function(ContainerInterface $c) { |
|
880 | 880 | $queryLogger = new QueryLogger(); |
881 | 881 | if ($c->get(SystemConfig::class)->getValue('debug', false)) { |
882 | 882 | // In debug mode, module is being activated by default |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | $this->registerDeprecatedAlias('TempManager', TempManager::class); |
892 | 892 | $this->registerAlias(ITempManager::class, TempManager::class); |
893 | 893 | |
894 | - $this->registerService(AppManager::class, function (ContainerInterface $c) { |
|
894 | + $this->registerService(AppManager::class, function(ContainerInterface $c) { |
|
895 | 895 | // TODO: use auto-wiring |
896 | 896 | return new \OC\App\AppManager( |
897 | 897 | $c->get(IUserSession::class), |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | /** @deprecated 19.0.0 */ |
912 | 912 | $this->registerDeprecatedAlias('DateTimeZone', IDateTimeZone::class); |
913 | 913 | |
914 | - $this->registerService(IDateTimeFormatter::class, function (Server $c) { |
|
914 | + $this->registerService(IDateTimeFormatter::class, function(Server $c) { |
|
915 | 915 | $language = $c->get(\OCP\IConfig::class)->getUserValue($c->get(ISession::class)->get('user_id'), 'core', 'lang', null); |
916 | 916 | |
917 | 917 | return new DateTimeFormatter( |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | /** @deprecated 19.0.0 */ |
923 | 923 | $this->registerDeprecatedAlias('DateTimeFormatter', IDateTimeFormatter::class); |
924 | 924 | |
925 | - $this->registerService(IUserMountCache::class, function (ContainerInterface $c) { |
|
925 | + $this->registerService(IUserMountCache::class, function(ContainerInterface $c) { |
|
926 | 926 | $mountCache = new UserMountCache( |
927 | 927 | $c->get(IDBConnection::class), |
928 | 928 | $c->get(IUserManager::class), |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | /** @deprecated 19.0.0 */ |
936 | 936 | $this->registerDeprecatedAlias('UserMountCache', IUserMountCache::class); |
937 | 937 | |
938 | - $this->registerService(IMountProviderCollection::class, function (ContainerInterface $c) { |
|
938 | + $this->registerService(IMountProviderCollection::class, function(ContainerInterface $c) { |
|
939 | 939 | $loader = \OC\Files\Filesystem::getLoader(); |
940 | 940 | $mountCache = $c->get(IUserMountCache::class); |
941 | 941 | $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | |
957 | 957 | /** @deprecated 20.0.0 */ |
958 | 958 | $this->registerDeprecatedAlias('IniWrapper', IniGetWrapper::class); |
959 | - $this->registerService(IBus::class, function (ContainerInterface $c) { |
|
959 | + $this->registerService(IBus::class, function(ContainerInterface $c) { |
|
960 | 960 | $busClass = $c->get(\OCP\IConfig::class)->getSystemValue('commandbus'); |
961 | 961 | if ($busClass) { |
962 | 962 | [$app, $class] = explode('::', $busClass, 2); |
@@ -977,7 +977,7 @@ discard block |
||
977 | 977 | $this->registerAlias(ITrustedDomainHelper::class, TrustedDomainHelper::class); |
978 | 978 | /** @deprecated 19.0.0 */ |
979 | 979 | $this->registerDeprecatedAlias('Throttler', Throttler::class); |
980 | - $this->registerService('IntegrityCodeChecker', function (ContainerInterface $c) { |
|
980 | + $this->registerService('IntegrityCodeChecker', function(ContainerInterface $c) { |
|
981 | 981 | // IConfig and IAppManager requires a working database. This code |
982 | 982 | // might however be called when ownCloud is not yet setup. |
983 | 983 | if (\OC::$server->get(SystemConfig::class)->getValue('installed', false)) { |
@@ -998,7 +998,7 @@ discard block |
||
998 | 998 | $c->get(IMimeTypeDetector::class) |
999 | 999 | ); |
1000 | 1000 | }); |
1001 | - $this->registerService(\OCP\IRequest::class, function (ContainerInterface $c) { |
|
1001 | + $this->registerService(\OCP\IRequest::class, function(ContainerInterface $c) { |
|
1002 | 1002 | if (isset($this['urlParams'])) { |
1003 | 1003 | $urlParams = $this['urlParams']; |
1004 | 1004 | } else { |
@@ -1035,7 +1035,7 @@ discard block |
||
1035 | 1035 | /** @deprecated 19.0.0 */ |
1036 | 1036 | $this->registerDeprecatedAlias('Request', \OCP\IRequest::class); |
1037 | 1037 | |
1038 | - $this->registerService(IMailer::class, function (Server $c) { |
|
1038 | + $this->registerService(IMailer::class, function(Server $c) { |
|
1039 | 1039 | return new Mailer( |
1040 | 1040 | $c->get(\OCP\IConfig::class), |
1041 | 1041 | $c->get(ILogger::class), |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | /** @deprecated 21.0.0 */ |
1053 | 1053 | $this->registerDeprecatedAlias('LDAPProvider', ILDAPProvider::class); |
1054 | 1054 | |
1055 | - $this->registerService(ILDAPProviderFactory::class, function (ContainerInterface $c) { |
|
1055 | + $this->registerService(ILDAPProviderFactory::class, function(ContainerInterface $c) { |
|
1056 | 1056 | $config = $c->get(\OCP\IConfig::class); |
1057 | 1057 | $factoryClass = $config->getSystemValue('ldapProviderFactory', null); |
1058 | 1058 | if (is_null($factoryClass) || !class_exists($factoryClass)) { |
@@ -1061,11 +1061,11 @@ discard block |
||
1061 | 1061 | /** @var \OCP\LDAP\ILDAPProviderFactory $factory */ |
1062 | 1062 | return new $factoryClass($this); |
1063 | 1063 | }); |
1064 | - $this->registerService(ILDAPProvider::class, function (ContainerInterface $c) { |
|
1064 | + $this->registerService(ILDAPProvider::class, function(ContainerInterface $c) { |
|
1065 | 1065 | $factory = $c->get(ILDAPProviderFactory::class); |
1066 | 1066 | return $factory->getLDAPProvider(); |
1067 | 1067 | }); |
1068 | - $this->registerService(ILockingProvider::class, function (ContainerInterface $c) { |
|
1068 | + $this->registerService(ILockingProvider::class, function(ContainerInterface $c) { |
|
1069 | 1069 | $ini = $c->get(IniGetWrapper::class); |
1070 | 1070 | $config = $c->get(\OCP\IConfig::class); |
1071 | 1071 | $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); |
@@ -1093,12 +1093,12 @@ discard block |
||
1093 | 1093 | /** @deprecated 19.0.0 */ |
1094 | 1094 | $this->registerDeprecatedAlias('MountManager', IMountManager::class); |
1095 | 1095 | |
1096 | - $this->registerService(IMimeTypeDetector::class, function (ContainerInterface $c) { |
|
1096 | + $this->registerService(IMimeTypeDetector::class, function(ContainerInterface $c) { |
|
1097 | 1097 | return new \OC\Files\Type\Detection( |
1098 | 1098 | $c->get(IURLGenerator::class), |
1099 | 1099 | $c->get(ILogger::class), |
1100 | 1100 | \OC::$configDir, |
1101 | - \OC::$SERVERROOT . '/resources/config/' |
|
1101 | + \OC::$SERVERROOT.'/resources/config/' |
|
1102 | 1102 | ); |
1103 | 1103 | }); |
1104 | 1104 | /** @deprecated 19.0.0 */ |
@@ -1107,19 +1107,19 @@ discard block |
||
1107 | 1107 | $this->registerAlias(IMimeTypeLoader::class, Loader::class); |
1108 | 1108 | /** @deprecated 19.0.0 */ |
1109 | 1109 | $this->registerDeprecatedAlias('MimeTypeLoader', IMimeTypeLoader::class); |
1110 | - $this->registerService(BundleFetcher::class, function () { |
|
1110 | + $this->registerService(BundleFetcher::class, function() { |
|
1111 | 1111 | return new BundleFetcher($this->getL10N('lib')); |
1112 | 1112 | }); |
1113 | 1113 | $this->registerAlias(\OCP\Notification\IManager::class, Manager::class); |
1114 | 1114 | /** @deprecated 19.0.0 */ |
1115 | 1115 | $this->registerDeprecatedAlias('NotificationManager', \OCP\Notification\IManager::class); |
1116 | 1116 | |
1117 | - $this->registerService(CapabilitiesManager::class, function (ContainerInterface $c) { |
|
1117 | + $this->registerService(CapabilitiesManager::class, function(ContainerInterface $c) { |
|
1118 | 1118 | $manager = new CapabilitiesManager($c->get(LoggerInterface::class)); |
1119 | - $manager->registerCapability(function () use ($c) { |
|
1119 | + $manager->registerCapability(function() use ($c) { |
|
1120 | 1120 | return new \OC\OCS\CoreCapabilities($c->get(\OCP\IConfig::class)); |
1121 | 1121 | }); |
1122 | - $manager->registerCapability(function () use ($c) { |
|
1122 | + $manager->registerCapability(function() use ($c) { |
|
1123 | 1123 | return $c->get(\OC\Security\Bruteforce\Capabilities::class); |
1124 | 1124 | }); |
1125 | 1125 | return $manager; |
@@ -1127,14 +1127,14 @@ discard block |
||
1127 | 1127 | /** @deprecated 19.0.0 */ |
1128 | 1128 | $this->registerDeprecatedAlias('CapabilitiesManager', CapabilitiesManager::class); |
1129 | 1129 | |
1130 | - $this->registerService(ICommentsManager::class, function (Server $c) { |
|
1130 | + $this->registerService(ICommentsManager::class, function(Server $c) { |
|
1131 | 1131 | $config = $c->get(\OCP\IConfig::class); |
1132 | 1132 | $factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class); |
1133 | 1133 | /** @var \OCP\Comments\ICommentsManagerFactory $factory */ |
1134 | 1134 | $factory = new $factoryClass($this); |
1135 | 1135 | $manager = $factory->getManager(); |
1136 | 1136 | |
1137 | - $manager->registerDisplayNameResolver('user', function ($id) use ($c) { |
|
1137 | + $manager->registerDisplayNameResolver('user', function($id) use ($c) { |
|
1138 | 1138 | $manager = $c->get(IUserManager::class); |
1139 | 1139 | $user = $manager->get($id); |
1140 | 1140 | if (is_null($user)) { |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | $this->registerDeprecatedAlias('CommentsManager', ICommentsManager::class); |
1153 | 1153 | |
1154 | 1154 | $this->registerAlias(\OC_Defaults::class, 'ThemingDefaults'); |
1155 | - $this->registerService('ThemingDefaults', function (Server $c) { |
|
1155 | + $this->registerService('ThemingDefaults', function(Server $c) { |
|
1156 | 1156 | /* |
1157 | 1157 | * Dark magic for autoloader. |
1158 | 1158 | * If we do a class_exists it will try to load the class which will |
@@ -1187,7 +1187,7 @@ discard block |
||
1187 | 1187 | } |
1188 | 1188 | return new \OC_Defaults(); |
1189 | 1189 | }); |
1190 | - $this->registerService(JSCombiner::class, function (Server $c) { |
|
1190 | + $this->registerService(JSCombiner::class, function(Server $c) { |
|
1191 | 1191 | return new JSCombiner( |
1192 | 1192 | $c->getAppDataDir('js'), |
1193 | 1193 | $c->get(IURLGenerator::class), |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | $this->registerDeprecatedAlias('EventDispatcher', \OC\EventDispatcher\SymfonyAdapter::class); |
1202 | 1202 | $this->registerAlias(EventDispatcherInterface::class, \OC\EventDispatcher\SymfonyAdapter::class); |
1203 | 1203 | |
1204 | - $this->registerService('CryptoWrapper', function (ContainerInterface $c) { |
|
1204 | + $this->registerService('CryptoWrapper', function(ContainerInterface $c) { |
|
1205 | 1205 | // FIXME: Instantiiated here due to cyclic dependency |
1206 | 1206 | $request = new Request( |
1207 | 1207 | [ |
@@ -1228,14 +1228,14 @@ discard block |
||
1228 | 1228 | }); |
1229 | 1229 | /** @deprecated 19.0.0 */ |
1230 | 1230 | $this->registerDeprecatedAlias('CsrfTokenManager', CsrfTokenManager::class); |
1231 | - $this->registerService(SessionStorage::class, function (ContainerInterface $c) { |
|
1231 | + $this->registerService(SessionStorage::class, function(ContainerInterface $c) { |
|
1232 | 1232 | return new SessionStorage($c->get(ISession::class)); |
1233 | 1233 | }); |
1234 | 1234 | $this->registerAlias(\OCP\Security\IContentSecurityPolicyManager::class, ContentSecurityPolicyManager::class); |
1235 | 1235 | /** @deprecated 19.0.0 */ |
1236 | 1236 | $this->registerDeprecatedAlias('ContentSecurityPolicyManager', ContentSecurityPolicyManager::class); |
1237 | 1237 | |
1238 | - $this->registerService(\OCP\Share\IManager::class, function (IServerContainer $c) { |
|
1238 | + $this->registerService(\OCP\Share\IManager::class, function(IServerContainer $c) { |
|
1239 | 1239 | $config = $c->get(\OCP\IConfig::class); |
1240 | 1240 | $factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class); |
1241 | 1241 | /** @var \OCP\Share\IProviderFactory $factory */ |
@@ -1267,7 +1267,7 @@ discard block |
||
1267 | 1267 | /** @deprecated 19.0.0 */ |
1268 | 1268 | $this->registerDeprecatedAlias('ShareManager', \OCP\Share\IManager::class); |
1269 | 1269 | |
1270 | - $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function (Server $c) { |
|
1270 | + $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function(Server $c) { |
|
1271 | 1271 | $instance = new Collaboration\Collaborators\Search($c); |
1272 | 1272 | |
1273 | 1273 | // register default plugins |
@@ -1290,33 +1290,33 @@ discard block |
||
1290 | 1290 | |
1291 | 1291 | $this->registerDeprecatedAlias('SettingsManager', \OC\Settings\Manager::class); |
1292 | 1292 | $this->registerAlias(\OCP\Settings\IManager::class, \OC\Settings\Manager::class); |
1293 | - $this->registerService(\OC\Files\AppData\Factory::class, function (ContainerInterface $c) { |
|
1293 | + $this->registerService(\OC\Files\AppData\Factory::class, function(ContainerInterface $c) { |
|
1294 | 1294 | return new \OC\Files\AppData\Factory( |
1295 | 1295 | $c->get(IRootFolder::class), |
1296 | 1296 | $c->get(SystemConfig::class) |
1297 | 1297 | ); |
1298 | 1298 | }); |
1299 | 1299 | |
1300 | - $this->registerService('LockdownManager', function (ContainerInterface $c) { |
|
1301 | - return new LockdownManager(function () use ($c) { |
|
1300 | + $this->registerService('LockdownManager', function(ContainerInterface $c) { |
|
1301 | + return new LockdownManager(function() use ($c) { |
|
1302 | 1302 | return $c->get(ISession::class); |
1303 | 1303 | }); |
1304 | 1304 | }); |
1305 | 1305 | |
1306 | - $this->registerService(\OCP\OCS\IDiscoveryService::class, function (ContainerInterface $c) { |
|
1306 | + $this->registerService(\OCP\OCS\IDiscoveryService::class, function(ContainerInterface $c) { |
|
1307 | 1307 | return new DiscoveryService( |
1308 | 1308 | $c->get(ICacheFactory::class), |
1309 | 1309 | $c->get(IClientService::class) |
1310 | 1310 | ); |
1311 | 1311 | }); |
1312 | 1312 | |
1313 | - $this->registerService(ICloudIdManager::class, function (ContainerInterface $c) { |
|
1313 | + $this->registerService(ICloudIdManager::class, function(ContainerInterface $c) { |
|
1314 | 1314 | return new CloudIdManager($c->get(\OCP\Contacts\IManager::class), $c->get(IURLGenerator::class), $c->get(IUserManager::class)); |
1315 | 1315 | }); |
1316 | 1316 | |
1317 | 1317 | $this->registerAlias(\OCP\GlobalScale\IConfig::class, \OC\GlobalScale\Config::class); |
1318 | 1318 | |
1319 | - $this->registerService(ICloudFederationProviderManager::class, function (ContainerInterface $c) { |
|
1319 | + $this->registerService(ICloudFederationProviderManager::class, function(ContainerInterface $c) { |
|
1320 | 1320 | return new CloudFederationProviderManager( |
1321 | 1321 | $c->get(IAppManager::class), |
1322 | 1322 | $c->get(IClientService::class), |
@@ -1325,7 +1325,7 @@ discard block |
||
1325 | 1325 | ); |
1326 | 1326 | }); |
1327 | 1327 | |
1328 | - $this->registerService(ICloudFederationFactory::class, function (Server $c) { |
|
1328 | + $this->registerService(ICloudFederationFactory::class, function(Server $c) { |
|
1329 | 1329 | return new CloudFederationFactory(); |
1330 | 1330 | }); |
1331 | 1331 | |
@@ -1337,7 +1337,7 @@ discard block |
||
1337 | 1337 | /** @deprecated 19.0.0 */ |
1338 | 1338 | $this->registerDeprecatedAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class); |
1339 | 1339 | |
1340 | - $this->registerService(Defaults::class, function (Server $c) { |
|
1340 | + $this->registerService(Defaults::class, function(Server $c) { |
|
1341 | 1341 | return new Defaults( |
1342 | 1342 | $c->getThemingDefaults() |
1343 | 1343 | ); |
@@ -1345,17 +1345,17 @@ discard block |
||
1345 | 1345 | /** @deprecated 19.0.0 */ |
1346 | 1346 | $this->registerDeprecatedAlias('Defaults', \OCP\Defaults::class); |
1347 | 1347 | |
1348 | - $this->registerService(\OCP\ISession::class, function (ContainerInterface $c) { |
|
1348 | + $this->registerService(\OCP\ISession::class, function(ContainerInterface $c) { |
|
1349 | 1349 | return $c->get(\OCP\IUserSession::class)->getSession(); |
1350 | 1350 | }, false); |
1351 | 1351 | |
1352 | - $this->registerService(IShareHelper::class, function (ContainerInterface $c) { |
|
1352 | + $this->registerService(IShareHelper::class, function(ContainerInterface $c) { |
|
1353 | 1353 | return new ShareHelper( |
1354 | 1354 | $c->get(\OCP\Share\IManager::class) |
1355 | 1355 | ); |
1356 | 1356 | }); |
1357 | 1357 | |
1358 | - $this->registerService(Installer::class, function (ContainerInterface $c) { |
|
1358 | + $this->registerService(Installer::class, function(ContainerInterface $c) { |
|
1359 | 1359 | return new Installer( |
1360 | 1360 | $c->get(AppFetcher::class), |
1361 | 1361 | $c->get(IClientService::class), |
@@ -1366,11 +1366,11 @@ discard block |
||
1366 | 1366 | ); |
1367 | 1367 | }); |
1368 | 1368 | |
1369 | - $this->registerService(IApiFactory::class, function (ContainerInterface $c) { |
|
1369 | + $this->registerService(IApiFactory::class, function(ContainerInterface $c) { |
|
1370 | 1370 | return new ApiFactory($c->get(IClientService::class)); |
1371 | 1371 | }); |
1372 | 1372 | |
1373 | - $this->registerService(IInstanceFactory::class, function (ContainerInterface $c) { |
|
1373 | + $this->registerService(IInstanceFactory::class, function(ContainerInterface $c) { |
|
1374 | 1374 | $memcacheFactory = $c->get(ICacheFactory::class); |
1375 | 1375 | return new InstanceFactory($memcacheFactory->createLocal('remoteinstance.'), $c->get(IClientService::class)); |
1376 | 1376 | }); |
@@ -1427,7 +1427,7 @@ discard block |
||
1427 | 1427 | $dispatcher = $this->get(SymfonyAdapter::class); |
1428 | 1428 | |
1429 | 1429 | // Delete avatar on user deletion |
1430 | - $dispatcher->addListener('OCP\IUser::preDelete', function (GenericEvent $e) { |
|
1430 | + $dispatcher->addListener('OCP\IUser::preDelete', function(GenericEvent $e) { |
|
1431 | 1431 | $logger = $this->get(ILogger::class); |
1432 | 1432 | $manager = $this->getAvatarManager(); |
1433 | 1433 | /** @var IUser $user */ |
@@ -1440,11 +1440,11 @@ discard block |
||
1440 | 1440 | // no avatar to remove |
1441 | 1441 | } catch (\Exception $e) { |
1442 | 1442 | // Ignore exceptions |
1443 | - $logger->info('Could not cleanup avatar of ' . $user->getUID()); |
|
1443 | + $logger->info('Could not cleanup avatar of '.$user->getUID()); |
|
1444 | 1444 | } |
1445 | 1445 | }); |
1446 | 1446 | |
1447 | - $dispatcher->addListener('OCP\IUser::changeUser', function (GenericEvent $e) { |
|
1447 | + $dispatcher->addListener('OCP\IUser::changeUser', function(GenericEvent $e) { |
|
1448 | 1448 | $manager = $this->getAvatarManager(); |
1449 | 1449 | /** @var IUser $user */ |
1450 | 1450 | $user = $e->getSubject(); |
@@ -2335,11 +2335,11 @@ discard block |
||
2335 | 2335 | } |
2336 | 2336 | |
2337 | 2337 | private function registerDeprecatedAlias(string $alias, string $target) { |
2338 | - $this->registerService($alias, function (ContainerInterface $container) use ($target, $alias) { |
|
2338 | + $this->registerService($alias, function(ContainerInterface $container) use ($target, $alias) { |
|
2339 | 2339 | try { |
2340 | 2340 | /** @var ILogger $logger */ |
2341 | 2341 | $logger = $container->get(ILogger::class); |
2342 | - $logger->debug('The requested alias "' . $alias . '" is deprecated. Please request "' . $target . '" directly. This alias will be removed in a future Nextcloud version.', ['app' => 'serverDI']); |
|
2342 | + $logger->debug('The requested alias "'.$alias.'" is deprecated. Please request "'.$target.'" directly. This alias will be removed in a future Nextcloud version.', ['app' => 'serverDI']); |
|
2343 | 2343 | } catch (ContainerExceptionInterface $e) { |
2344 | 2344 | // Could not get logger. Continue |
2345 | 2345 | } |
@@ -102,6 +102,6 @@ |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | public function __toString() { |
105 | - return $this->getId() . ' ' . $this->getDescription() . ' ' . $this->getDuration(); |
|
105 | + return $this->getId().' '.$this->getDescription().' '.$this->getDuration(); |
|
106 | 106 | } |
107 | 107 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | $isDebugLevel = $this->internalLogger->getLogLevel([]) === Log::DEBUG; |
68 | - $systemValue = (bool)$this->config->getValue('diagnostics.logging', false); |
|
68 | + $systemValue = (bool) $this->config->getValue('diagnostics.logging', false); |
|
69 | 69 | return $systemValue && $isDebugLevel; |
70 | 70 | } |
71 | 71 | |
@@ -123,12 +123,12 @@ discard block |
||
123 | 123 | $duration = $event->getDuration(); |
124 | 124 | $timeInMs = round($duration * 1000, 4); |
125 | 125 | |
126 | - $loggingMinimum = (int)$this->config->getValue('diagnostics.logging.threshold', 0); |
|
126 | + $loggingMinimum = (int) $this->config->getValue('diagnostics.logging.threshold', 0); |
|
127 | 127 | if ($loggingMinimum > 0 && $timeInMs < $loggingMinimum) { |
128 | 128 | return; |
129 | 129 | } |
130 | 130 | |
131 | - $message = microtime() . ' - ' . $event->getId() . ': ' . $timeInMs . ' (' . $event->getDescription() . ')'; |
|
131 | + $message = microtime().' - '.$event->getId().': '.$timeInMs.' ('.$event->getDescription().')'; |
|
132 | 132 | $this->logger->debug($message, ['app' => 'diagnostics']); |
133 | 133 | } |
134 | 134 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * the \OCP\AppFramework\Bootstrap\IBootstrap interface |
122 | 122 | */ |
123 | 123 | $appNameSpace = App::buildAppNamespace($appId); |
124 | - $applicationClassName = $appNameSpace . '\\AppInfo\\Application'; |
|
124 | + $applicationClassName = $appNameSpace.'\\AppInfo\\Application'; |
|
125 | 125 | try { |
126 | 126 | if (class_exists($applicationClassName) && in_array(IBootstrap::class, class_implements($applicationClassName), true)) { |
127 | 127 | try { |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | continue; |
133 | 133 | } |
134 | 134 | |
135 | - $this->eventLogger->start('bootstrap:register_app_' . $appId, ''); |
|
135 | + $this->eventLogger->start('bootstrap:register_app_'.$appId, ''); |
|
136 | 136 | $application->register($this->registrationContext->for($appId)); |
137 | - $this->eventLogger->end('bootstrap:register_app_' . $appId); |
|
137 | + $this->eventLogger->end('bootstrap:register_app_'.$appId); |
|
138 | 138 | } |
139 | 139 | } catch (Throwable $e) { |
140 | - $this->logger->emergency('Error during app service registration: ' . $e->getMessage(), [ |
|
140 | + $this->logger->emergency('Error during app service registration: '.$e->getMessage(), [ |
|
141 | 141 | 'exception' => $e, |
142 | 142 | 'app' => $appId, |
143 | 143 | ]); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $this->bootedApps[$appId] = true; |
169 | 169 | |
170 | 170 | $appNameSpace = App::buildAppNamespace($appId); |
171 | - $applicationClassName = $appNameSpace . '\\AppInfo\\Application'; |
|
171 | + $applicationClassName = $appNameSpace.'\\AppInfo\\Application'; |
|
172 | 172 | if (!class_exists($applicationClassName)) { |
173 | 173 | // Nothing to boot |
174 | 174 | return; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * the instance was already created for register, but any other |
181 | 181 | * (legacy) code will now do their magic via the constructor. |
182 | 182 | */ |
183 | - $this->eventLogger->start('bootstrap:boot_app_' . $appId, ''); |
|
183 | + $this->eventLogger->start('bootstrap:boot_app_'.$appId, ''); |
|
184 | 184 | try { |
185 | 185 | /** @var App $application */ |
186 | 186 | $application = $this->serverContainer->query($applicationClassName); |
@@ -190,20 +190,20 @@ discard block |
||
190 | 190 | $application->boot($context); |
191 | 191 | } |
192 | 192 | } catch (QueryException $e) { |
193 | - $this->logger->error("Could not boot $appId: " . $e->getMessage(), [ |
|
193 | + $this->logger->error("Could not boot $appId: ".$e->getMessage(), [ |
|
194 | 194 | 'exception' => $e, |
195 | 195 | ]); |
196 | 196 | } catch (Throwable $e) { |
197 | - $this->logger->emergency("Could not boot $appId: " . $e->getMessage(), [ |
|
197 | + $this->logger->emergency("Could not boot $appId: ".$e->getMessage(), [ |
|
198 | 198 | 'exception' => $e, |
199 | 199 | ]); |
200 | 200 | } |
201 | - $this->eventLogger->end('bootstrap:boot_app_' . $appId); |
|
201 | + $this->eventLogger->end('bootstrap:boot_app_'.$appId); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | public function isBootable(string $appId) { |
205 | 205 | $appNameSpace = App::buildAppNamespace($appId); |
206 | - $applicationClassName = $appNameSpace . '\\AppInfo\\Application'; |
|
206 | + $applicationClassName = $appNameSpace.'\\AppInfo\\Application'; |
|
207 | 207 | return class_exists($applicationClassName) && |
208 | 208 | in_array(IBootstrap::class, class_implements($applicationClassName), true); |
209 | 209 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $response = $this->middlewareDispatcher->afterException( |
163 | 163 | $controller, $methodName, $exception); |
164 | 164 | } catch (\Throwable $throwable) { |
165 | - $exception = new \Exception($throwable->getMessage() . ' in file \'' . $throwable->getFile() . '\' line ' . $throwable->getLine(), $throwable->getCode(), $throwable); |
|
165 | + $exception = new \Exception($throwable->getMessage().' in file \''.$throwable->getFile().'\' line '.$throwable->getLine(), $throwable->getCode(), $throwable); |
|
166 | 166 | $response = $this->middlewareDispatcher->afterException( |
167 | 167 | $controller, $methodName, $exception); |
168 | 168 | } |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | $arguments[] = $value; |
222 | 222 | } |
223 | 223 | |
224 | - $this->eventLogger->start('controller:' . get_class($controller) . '::' . $methodName, 'App framework controller execution'); |
|
224 | + $this->eventLogger->start('controller:'.get_class($controller).'::'.$methodName, 'App framework controller execution'); |
|
225 | 225 | $response = \call_user_func_array([$controller, $methodName], $arguments); |
226 | - $this->eventLogger->end('controller:' . get_class($controller) . '::' . $methodName); |
|
226 | + $this->eventLogger->end('controller:'.get_class($controller).'::'.$methodName); |
|
227 | 227 | |
228 | 228 | // format response |
229 | 229 | if ($response instanceof DataResponse || !($response instanceof Response)) { |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public static function initPaths() { |
142 | 142 | if (defined('PHPUNIT_CONFIG_DIR')) { |
143 | - self::$configDir = OC::$SERVERROOT . '/' . PHPUNIT_CONFIG_DIR . '/'; |
|
144 | - } elseif (defined('PHPUNIT_RUN') and PHPUNIT_RUN and is_dir(OC::$SERVERROOT . '/tests/config/')) { |
|
145 | - self::$configDir = OC::$SERVERROOT . '/tests/config/'; |
|
143 | + self::$configDir = OC::$SERVERROOT.'/'.PHPUNIT_CONFIG_DIR.'/'; |
|
144 | + } elseif (defined('PHPUNIT_RUN') and PHPUNIT_RUN and is_dir(OC::$SERVERROOT.'/tests/config/')) { |
|
145 | + self::$configDir = OC::$SERVERROOT.'/tests/config/'; |
|
146 | 146 | } elseif ($dir = getenv('NEXTCLOUD_CONFIG_DIR')) { |
147 | - self::$configDir = rtrim($dir, '/') . '/'; |
|
147 | + self::$configDir = rtrim($dir, '/').'/'; |
|
148 | 148 | } else { |
149 | - self::$configDir = OC::$SERVERROOT . '/config/'; |
|
149 | + self::$configDir = OC::$SERVERROOT.'/config/'; |
|
150 | 150 | } |
151 | 151 | self::$config = new \OC\Config(self::$configDir); |
152 | 152 | |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | //make sure suburi follows the same rules as scriptName |
169 | 169 | if (substr(OC::$SUBURI, -9) != 'index.php') { |
170 | 170 | if (substr(OC::$SUBURI, -1) != '/') { |
171 | - OC::$SUBURI = OC::$SUBURI . '/'; |
|
171 | + OC::$SUBURI = OC::$SUBURI.'/'; |
|
172 | 172 | } |
173 | - OC::$SUBURI = OC::$SUBURI . 'index.php'; |
|
173 | + OC::$SUBURI = OC::$SUBURI.'index.php'; |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | OC::$WEBROOT = substr($scriptName, 0, 0 - strlen(OC::$SUBURI)); |
183 | 183 | |
184 | 184 | if (OC::$WEBROOT != '' && OC::$WEBROOT[0] !== '/') { |
185 | - OC::$WEBROOT = '/' . OC::$WEBROOT; |
|
185 | + OC::$WEBROOT = '/'.OC::$WEBROOT; |
|
186 | 186 | } |
187 | 187 | } else { |
188 | 188 | // The scriptName is not ending with OC::$SUBURI |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | OC::$APPSROOTS[] = $paths; |
212 | 212 | } |
213 | 213 | } |
214 | - } elseif (file_exists(OC::$SERVERROOT . '/apps')) { |
|
215 | - OC::$APPSROOTS[] = ['path' => OC::$SERVERROOT . '/apps', 'url' => '/apps', 'writable' => true]; |
|
214 | + } elseif (file_exists(OC::$SERVERROOT.'/apps')) { |
|
215 | + OC::$APPSROOTS[] = ['path' => OC::$SERVERROOT.'/apps', 'url' => '/apps', 'writable' => true]; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | if (empty(OC::$APPSROOTS)) { |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $l = \OC::$server->getL10N('lib'); |
239 | 239 | |
240 | 240 | // Create config if it does not already exist |
241 | - $configFilePath = self::$configDir .'/config.php'; |
|
241 | + $configFilePath = self::$configDir.'/config.php'; |
|
242 | 242 | if (!file_exists($configFilePath)) { |
243 | 243 | @touch($configFilePath); |
244 | 244 | } |
@@ -254,14 +254,14 @@ discard block |
||
254 | 254 | echo $l->t('This can usually be fixed by giving the web server write access to the config directory.')."\n"; |
255 | 255 | echo "\n"; |
256 | 256 | echo $l->t('But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.')."\n"; |
257 | - echo $l->t('See %s', [ $urlGenerator->linkToDocs('admin-config') ])."\n"; |
|
257 | + echo $l->t('See %s', [$urlGenerator->linkToDocs('admin-config')])."\n"; |
|
258 | 258 | exit; |
259 | 259 | } else { |
260 | 260 | OC_Template::printErrorPage( |
261 | 261 | $l->t('Cannot write into "config" directory!'), |
262 | - $l->t('This can usually be fixed by giving the web server write access to the config directory.') . ' ' |
|
263 | - . $l->t('But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.') . ' ' |
|
264 | - . $l->t('See %s', [ $urlGenerator->linkToDocs('admin-config') ]), |
|
262 | + $l->t('This can usually be fixed by giving the web server write access to the config directory.').' ' |
|
263 | + . $l->t('But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.').' ' |
|
264 | + . $l->t('See %s', [$urlGenerator->linkToDocs('admin-config')]), |
|
265 | 265 | 503 |
266 | 266 | ); |
267 | 267 | } |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | if (OC::$CLI) { |
278 | 278 | throw new Exception('Not installed'); |
279 | 279 | } else { |
280 | - $url = OC::$WEBROOT . '/index.php'; |
|
281 | - header('Location: ' . $url); |
|
280 | + $url = OC::$WEBROOT.'/index.php'; |
|
281 | + header('Location: '.$url); |
|
282 | 282 | } |
283 | 283 | exit(); |
284 | 284 | } |
@@ -385,14 +385,14 @@ discard block |
||
385 | 385 | $incompatibleShippedApps = []; |
386 | 386 | foreach ($incompatibleApps as $appInfo) { |
387 | 387 | if ($appManager->isShipped($appInfo['id'])) { |
388 | - $incompatibleShippedApps[] = $appInfo['name'] . ' (' . $appInfo['id'] . ')'; |
|
388 | + $incompatibleShippedApps[] = $appInfo['name'].' ('.$appInfo['id'].')'; |
|
389 | 389 | } |
390 | 390 | } |
391 | 391 | |
392 | 392 | if (!empty($incompatibleShippedApps)) { |
393 | 393 | $l = \OC::$server->getL10N('core'); |
394 | 394 | $hint = $l->t('The files of the app %1$s were not replaced correctly. Make sure it is a version compatible with the server.', [implode(', ', $incompatibleShippedApps)]); |
395 | - throw new \OCP\HintException('The files of the app ' . implode(', ', $incompatibleShippedApps) . ' were not replaced correctly. Make sure it is a version compatible with the server.', $hint); |
|
395 | + throw new \OCP\HintException('The files of the app '.implode(', ', $incompatibleShippedApps).' were not replaced correctly. Make sure it is a version compatible with the server.', $hint); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | $tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion)); |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | ini_set('session.cookie_httponly', 'true'); |
417 | 417 | |
418 | 418 | // set the cookie path to the Nextcloud directory |
419 | - $cookie_path = OC::$WEBROOT ? : '/'; |
|
419 | + $cookie_path = OC::$WEBROOT ?: '/'; |
|
420 | 420 | ini_set('session.cookie_path', $cookie_path); |
421 | 421 | |
422 | 422 | // Let the session name be changed in the initSession Hook |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | // session timeout |
444 | 444 | if ($session->exists('LAST_ACTIVITY') && (time() - $session->get('LAST_ACTIVITY') > $sessionLifeTime)) { |
445 | 445 | if (isset($_COOKIE[session_name()])) { |
446 | - setcookie(session_name(), '', -1, self::$WEBROOT ? : '/'); |
|
446 | + setcookie(session_name(), '', -1, self::$WEBROOT ?: '/'); |
|
447 | 447 | } |
448 | 448 | \OC::$server->getUserSession()->logout(); |
449 | 449 | } |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | foreach ($policies as $policy) { |
487 | 487 | header( |
488 | 488 | sprintf( |
489 | - 'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;' . $secureCookie . 'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s', |
|
489 | + 'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;'.$secureCookie.'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s', |
|
490 | 490 | $cookiePrefix, |
491 | 491 | $policy, |
492 | 492 | $cookieParams['path'], |
@@ -560,12 +560,12 @@ discard block |
||
560 | 560 | |
561 | 561 | // register autoloader |
562 | 562 | $loaderStart = microtime(true); |
563 | - require_once __DIR__ . '/autoloader.php'; |
|
563 | + require_once __DIR__.'/autoloader.php'; |
|
564 | 564 | self::$loader = new \OC\Autoloader([ |
565 | - OC::$SERVERROOT . '/lib/private/legacy', |
|
565 | + OC::$SERVERROOT.'/lib/private/legacy', |
|
566 | 566 | ]); |
567 | 567 | if (defined('PHPUNIT_RUN')) { |
568 | - self::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); |
|
568 | + self::$loader->addValidRoot(OC::$SERVERROOT.'/tests'); |
|
569 | 569 | } |
570 | 570 | spl_autoload_register([self::$loader, 'load']); |
571 | 571 | $loaderEnd = microtime(true); |
@@ -573,12 +573,12 @@ discard block |
||
573 | 573 | self::$CLI = (php_sapi_name() == 'cli'); |
574 | 574 | |
575 | 575 | // Add default composer PSR-4 autoloader |
576 | - self::$composerAutoloader = require_once OC::$SERVERROOT . '/lib/composer/autoload.php'; |
|
576 | + self::$composerAutoloader = require_once OC::$SERVERROOT.'/lib/composer/autoload.php'; |
|
577 | 577 | |
578 | 578 | try { |
579 | 579 | self::initPaths(); |
580 | 580 | // setup 3rdparty autoloader |
581 | - $vendorAutoLoad = OC::$SERVERROOT. '/3rdparty/autoload.php'; |
|
581 | + $vendorAutoLoad = OC::$SERVERROOT.'/3rdparty/autoload.php'; |
|
582 | 582 | if (!file_exists($vendorAutoLoad)) { |
583 | 583 | throw new \RuntimeException('Composer autoloader not found, unable to continue. Check the folder "3rdparty". Running "git submodule update --init" will initialize the git submodule that handles the subfolder "3rdparty".'); |
584 | 584 | } |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | $eventLogger = \OC::$server->getEventLogger(); |
601 | 601 | $eventLogger->log('autoloader', 'Autoloader', $loaderStart, $loaderEnd); |
602 | 602 | $eventLogger->start('request', 'Full request after autoloading'); |
603 | - register_shutdown_function(function () use ($eventLogger) { |
|
603 | + register_shutdown_function(function() use ($eventLogger) { |
|
604 | 604 | $eventLogger->end('request'); |
605 | 605 | }); |
606 | 606 | $eventLogger->start('boot', 'Initialize'); |
@@ -679,11 +679,11 @@ discard block |
||
679 | 679 | // Convert l10n string into regular string for usage in database |
680 | 680 | $staticErrors = []; |
681 | 681 | foreach ($errors as $error) { |
682 | - echo $error['error'] . "\n"; |
|
683 | - echo $error['hint'] . "\n\n"; |
|
682 | + echo $error['error']."\n"; |
|
683 | + echo $error['hint']."\n\n"; |
|
684 | 684 | $staticErrors[] = [ |
685 | - 'error' => (string)$error['error'], |
|
686 | - 'hint' => (string)$error['hint'], |
|
685 | + 'error' => (string) $error['error'], |
|
686 | + 'hint' => (string) $error['hint'], |
|
687 | 687 | ]; |
688 | 688 | } |
689 | 689 | |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | } |
700 | 700 | //try to set the session lifetime |
701 | 701 | $sessionLifeTime = self::getSessionLifeTime(); |
702 | - @ini_set('gc_maxlifetime', (string)$sessionLifeTime); |
|
702 | + @ini_set('gc_maxlifetime', (string) $sessionLifeTime); |
|
703 | 703 | |
704 | 704 | // User and Groups |
705 | 705 | if (!$systemConfig->getValue("installed", false)) { |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | |
813 | 813 | // NOTE: This will be replaced to use OCP |
814 | 814 | $userSession = self::$server->getUserSession(); |
815 | - $userSession->listen('\OC\User', 'postLogin', function () use ($userSession) { |
|
815 | + $userSession->listen('\OC\User', 'postLogin', function() use ($userSession) { |
|
816 | 816 | if (!defined('PHPUNIT_RUN') && $userSession->isLoggedIn()) { |
817 | 817 | // reset brute force delay for this IP address and username |
818 | 818 | $uid = \OC::$server->getUserSession()->getUser()->getUID(); |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | private static function registerAppRestrictionsHooks() { |
865 | 865 | /** @var \OC\Group\Manager $groupManager */ |
866 | 866 | $groupManager = self::$server->query(\OCP\IGroupManager::class); |
867 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OCP\IGroup $group) { |
|
867 | + $groupManager->listen('\OC\Group', 'postDelete', function(\OCP\IGroup $group) { |
|
868 | 868 | $appManager = self::$server->getAppManager(); |
869 | 869 | $apps = $appManager->getEnabledAppsForGroup($group); |
870 | 870 | foreach ($apps as $appId) { |
@@ -974,11 +974,11 @@ discard block |
||
974 | 974 | // emergency app disabling |
975 | 975 | if ($requestPath === '/disableapp' |
976 | 976 | && $request->getMethod() === 'POST' |
977 | - && ((array)$request->getParam('appid')) !== '' |
|
977 | + && ((array) $request->getParam('appid')) !== '' |
|
978 | 978 | ) { |
979 | 979 | \OC_JSON::callCheck(); |
980 | 980 | \OC_JSON::checkAdminUser(); |
981 | - $appIds = (array)$request->getParam('appid'); |
|
981 | + $appIds = (array) $request->getParam('appid'); |
|
982 | 982 | foreach ($appIds as $appId) { |
983 | 983 | $appId = \OC_App::cleanAppId($appId); |
984 | 984 | \OC::$server->getAppManager()->disableApp($appId); |
@@ -1039,10 +1039,10 @@ discard block |
||
1039 | 1039 | OC_App::loadApps(); |
1040 | 1040 | OC_User::setupBackends(); |
1041 | 1041 | OC_Util::setupFS(); |
1042 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToDefaultPageUrl()); |
|
1042 | + header('Location: '.\OC::$server->getURLGenerator()->linkToDefaultPageUrl()); |
|
1043 | 1043 | } else { |
1044 | 1044 | // Not handled and not logged in |
1045 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToRouteAbsolute('core.login.showLoginForm')); |
|
1045 | + header('Location: '.\OC::$server->getURLGenerator()->linkToRouteAbsolute('core.login.showLoginForm')); |
|
1046 | 1046 | } |
1047 | 1047 | } |
1048 | 1048 |