@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | $apps = self::getEnabledApps(); |
114 | 114 | |
115 | 115 | // Add each apps' folder as allowed class path |
116 | - foreach($apps as $app) { |
|
116 | + foreach ($apps as $app) { |
|
117 | 117 | $path = self::getAppPath($app); |
118 | - if($path !== false) { |
|
118 | + if ($path !== false) { |
|
119 | 119 | self::registerAutoloading($app, $path); |
120 | 120 | } |
121 | 121 | } |
@@ -141,15 +141,15 @@ discard block |
||
141 | 141 | public static function loadApp(string $app) { |
142 | 142 | self::$loadedApps[] = $app; |
143 | 143 | $appPath = self::getAppPath($app); |
144 | - if($appPath === false) { |
|
144 | + if ($appPath === false) { |
|
145 | 145 | return; |
146 | 146 | } |
147 | 147 | |
148 | 148 | // in case someone calls loadApp() directly |
149 | 149 | self::registerAutoloading($app, $appPath); |
150 | 150 | |
151 | - if (is_file($appPath . '/appinfo/app.php')) { |
|
152 | - \OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app); |
|
151 | + if (is_file($appPath.'/appinfo/app.php')) { |
|
152 | + \OC::$server->getEventLogger()->start('load_app_'.$app, 'Load app: '.$app); |
|
153 | 153 | try { |
154 | 154 | self::requireAppFile($app); |
155 | 155 | } catch (Throwable $ex) { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | self::$autoDisabledApps[] = $app; |
161 | 161 | } |
162 | 162 | } |
163 | - \OC::$server->getEventLogger()->end('load_app_' . $app); |
|
163 | + \OC::$server->getEventLogger()->end('load_app_'.$app); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | $info = self::getAppInfo($app); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $plugins = isset($info['collaboration']['plugins']['plugin']['@value']) ? |
207 | 207 | [$info['collaboration']['plugins']['plugin']] : $info['collaboration']['plugins']['plugin']; |
208 | 208 | foreach ($plugins as $plugin) { |
209 | - if($plugin['@attributes']['type'] === 'collaborator-search') { |
|
209 | + if ($plugin['@attributes']['type'] === 'collaborator-search') { |
|
210 | 210 | $pluginInfo = [ |
211 | 211 | 'shareType' => $plugin['@attributes']['share-type'], |
212 | 212 | 'class' => $plugin['@value'], |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | * @param string $path |
226 | 226 | */ |
227 | 227 | public static function registerAutoloading(string $app, string $path) { |
228 | - $key = $app . '-' . $path; |
|
229 | - if(isset(self::$alreadyRegistered[$key])) { |
|
228 | + $key = $app.'-'.$path; |
|
229 | + if (isset(self::$alreadyRegistered[$key])) { |
|
230 | 230 | return; |
231 | 231 | } |
232 | 232 | |
@@ -236,17 +236,17 @@ discard block |
||
236 | 236 | $appNamespace = \OC\AppFramework\App::buildAppNamespace($app); |
237 | 237 | \OC::$server->registerNamespace($app, $appNamespace); |
238 | 238 | |
239 | - if (file_exists($path . '/composer/autoload.php')) { |
|
240 | - require_once $path . '/composer/autoload.php'; |
|
239 | + if (file_exists($path.'/composer/autoload.php')) { |
|
240 | + require_once $path.'/composer/autoload.php'; |
|
241 | 241 | } else { |
242 | - \OC::$composerAutoloader->addPsr4($appNamespace . '\\', $path . '/lib/', true); |
|
242 | + \OC::$composerAutoloader->addPsr4($appNamespace.'\\', $path.'/lib/', true); |
|
243 | 243 | // Register on legacy autoloader |
244 | 244 | \OC::$loader->addValidRoot($path); |
245 | 245 | } |
246 | 246 | |
247 | 247 | // Register Test namespace only when testing |
248 | 248 | if (defined('PHPUNIT_RUN') || defined('CLI_TEST_RUN')) { |
249 | - \OC::$composerAutoloader->addPsr4($appNamespace . '\\Tests\\', $path . '/tests/', true); |
|
249 | + \OC::$composerAutoloader->addPsr4($appNamespace.'\\Tests\\', $path.'/tests/', true); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | */ |
259 | 259 | private static function requireAppFile(string $app) { |
260 | 260 | // encapsulated here to avoid variable scope conflicts |
261 | - require_once $app . '/appinfo/app.php'; |
|
261 | + require_once $app.'/appinfo/app.php'; |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | public static function setAppTypes(string $app) { |
304 | 304 | $appManager = \OC::$server->getAppManager(); |
305 | 305 | $appData = $appManager->getAppInfo($app); |
306 | - if(!is_array($appData)) { |
|
306 | + if (!is_array($appData)) { |
|
307 | 307 | return; |
308 | 308 | } |
309 | 309 | |
@@ -351,8 +351,8 @@ discard block |
||
351 | 351 | } else { |
352 | 352 | $apps = $appManager->getEnabledAppsForUser($user); |
353 | 353 | } |
354 | - $apps = array_filter($apps, function ($app) { |
|
355 | - return $app !== 'files';//we add this manually |
|
354 | + $apps = array_filter($apps, function($app) { |
|
355 | + return $app !== 'files'; //we add this manually |
|
356 | 356 | }); |
357 | 357 | sort($apps); |
358 | 358 | array_unshift($apps, 'files'); |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | $installer = \OC::$server->query(Installer::class); |
391 | 391 | $isDownloaded = $installer->isDownloaded($appId); |
392 | 392 | |
393 | - if(!$isDownloaded) { |
|
393 | + if (!$isDownloaded) { |
|
394 | 394 | $installer->downloadApp($appId); |
395 | 395 | } |
396 | 396 | |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | */ |
442 | 442 | public static function findAppInDirectories(string $appId) { |
443 | 443 | $sanitizedAppId = self::cleanAppId($appId); |
444 | - if($sanitizedAppId !== $appId) { |
|
444 | + if ($sanitizedAppId !== $appId) { |
|
445 | 445 | return false; |
446 | 446 | } |
447 | 447 | static $app_dir = []; |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | |
453 | 453 | $possibleApps = []; |
454 | 454 | foreach (OC::$APPSROOTS as $dir) { |
455 | - if (file_exists($dir['path'] . '/' . $appId)) { |
|
455 | + if (file_exists($dir['path'].'/'.$appId)) { |
|
456 | 456 | $possibleApps[] = $dir; |
457 | 457 | } |
458 | 458 | } |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | } else { |
467 | 467 | $versionToLoad = []; |
468 | 468 | foreach ($possibleApps as $possibleApp) { |
469 | - $version = self::getAppVersionByPath($possibleApp['path'] . '/' . $appId); |
|
469 | + $version = self::getAppVersionByPath($possibleApp['path'].'/'.$appId); |
|
470 | 470 | if (empty($versionToLoad) || version_compare($version, $versionToLoad['version'], '>')) { |
471 | 471 | $versionToLoad = array( |
472 | 472 | 'dir' => $possibleApp, |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | } |
494 | 494 | |
495 | 495 | if (($dir = self::findAppInDirectories($appId)) != false) { |
496 | - return $dir['path'] . '/' . $appId; |
|
496 | + return $dir['path'].'/'.$appId; |
|
497 | 497 | } |
498 | 498 | return false; |
499 | 499 | } |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | */ |
508 | 508 | public static function getAppWebPath(string $appId) { |
509 | 509 | if (($dir = self::findAppInDirectories($appId)) != false) { |
510 | - return OC::$WEBROOT . $dir['url'] . '/' . $appId; |
|
510 | + return OC::$WEBROOT.$dir['url'].'/'.$appId; |
|
511 | 511 | } |
512 | 512 | return false; |
513 | 513 | } |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | * @return string |
532 | 532 | */ |
533 | 533 | public static function getAppVersionByPath(string $path): string { |
534 | - $infoFile = $path . '/appinfo/info.xml'; |
|
534 | + $infoFile = $path.'/appinfo/info.xml'; |
|
535 | 535 | $appData = \OC::$server->getAppManager()->getAppInfo($infoFile, true); |
536 | 536 | return isset($appData['version']) ? $appData['version'] : ''; |
537 | 537 | } |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | * @param string $page |
632 | 632 | */ |
633 | 633 | public static function registerAdmin(string $app, string $page) { |
634 | - self::$adminForms[] = $app . '/' . $page . '.php'; |
|
634 | + self::$adminForms[] = $app.'/'.$page.'.php'; |
|
635 | 635 | } |
636 | 636 | |
637 | 637 | /** |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | * @param string $page |
641 | 641 | */ |
642 | 642 | public static function registerPersonal(string $app, string $page) { |
643 | - self::$personalForms[] = $app . '/' . $page . '.php'; |
|
643 | + self::$personalForms[] = $app.'/'.$page.'.php'; |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | /** |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | |
670 | 670 | foreach (OC::$APPSROOTS as $apps_dir) { |
671 | 671 | if (!is_readable($apps_dir['path'])) { |
672 | - \OCP\Util::writeLog('core', 'unable to read app folder : ' . $apps_dir['path'], ILogger::WARN); |
|
672 | + \OCP\Util::writeLog('core', 'unable to read app folder : '.$apps_dir['path'], ILogger::WARN); |
|
673 | 673 | continue; |
674 | 674 | } |
675 | 675 | $dh = opendir($apps_dir['path']); |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | if (is_resource($dh)) { |
678 | 678 | while (($file = readdir($dh)) !== false) { |
679 | 679 | |
680 | - if ($file[0] != '.' and is_dir($apps_dir['path'] . '/' . $file) and is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml')) { |
|
680 | + if ($file[0] != '.' and is_dir($apps_dir['path'].'/'.$file) and is_file($apps_dir['path'].'/'.$file.'/appinfo/info.xml')) { |
|
681 | 681 | |
682 | 682 | $apps[] = $file; |
683 | 683 | } |
@@ -710,12 +710,12 @@ discard block |
||
710 | 710 | |
711 | 711 | $info = OC_App::getAppInfo($app, false, $langCode); |
712 | 712 | if (!is_array($info)) { |
713 | - \OCP\Util::writeLog('core', 'Could not read app info file for app "' . $app . '"', ILogger::ERROR); |
|
713 | + \OCP\Util::writeLog('core', 'Could not read app info file for app "'.$app.'"', ILogger::ERROR); |
|
714 | 714 | continue; |
715 | 715 | } |
716 | 716 | |
717 | 717 | if (!isset($info['name'])) { |
718 | - \OCP\Util::writeLog('core', 'App id "' . $app . '" has no name in appinfo', ILogger::ERROR); |
|
718 | + \OCP\Util::writeLog('core', 'App id "'.$app.'" has no name in appinfo', ILogger::ERROR); |
|
719 | 719 | continue; |
720 | 720 | } |
721 | 721 | |
@@ -742,13 +742,13 @@ discard block |
||
742 | 742 | } |
743 | 743 | |
744 | 744 | $appPath = self::getAppPath($app); |
745 | - if($appPath !== false) { |
|
746 | - $appIcon = $appPath . '/img/' . $app . '.svg'; |
|
745 | + if ($appPath !== false) { |
|
746 | + $appIcon = $appPath.'/img/'.$app.'.svg'; |
|
747 | 747 | if (file_exists($appIcon)) { |
748 | - $info['preview'] = $urlGenerator->imagePath($app, $app . '.svg'); |
|
748 | + $info['preview'] = $urlGenerator->imagePath($app, $app.'.svg'); |
|
749 | 749 | $info['previewAsIcon'] = true; |
750 | 750 | } else { |
751 | - $appIcon = $appPath . '/img/app.svg'; |
|
751 | + $appIcon = $appPath.'/img/app.svg'; |
|
752 | 752 | if (file_exists($appIcon)) { |
753 | 753 | $info['preview'] = $urlGenerator->imagePath($app, 'app.svg'); |
754 | 754 | $info['previewAsIcon'] = true; |
@@ -869,7 +869,7 @@ discard block |
||
869 | 869 | public static function getAppVersions() { |
870 | 870 | static $versions; |
871 | 871 | |
872 | - if(!$versions) { |
|
872 | + if (!$versions) { |
|
873 | 873 | $appConfig = \OC::$server->getAppConfig(); |
874 | 874 | $versions = $appConfig->getValues(false, 'installed_version'); |
875 | 875 | } |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | */ |
885 | 885 | public static function updateApp(string $appId): bool { |
886 | 886 | $appPath = self::getAppPath($appId); |
887 | - if($appPath === false) { |
|
887 | + if ($appPath === false) { |
|
888 | 888 | return false; |
889 | 889 | } |
890 | 890 | self::registerAutoloading($appId, $appPath); |
@@ -893,8 +893,8 @@ discard block |
||
893 | 893 | $appData = self::getAppInfo($appId); |
894 | 894 | self::executeRepairSteps($appId, $appData['repair-steps']['pre-migration']); |
895 | 895 | |
896 | - if (file_exists($appPath . '/appinfo/database.xml')) { |
|
897 | - OC_DB::updateDbFromStructure($appPath . '/appinfo/database.xml'); |
|
896 | + if (file_exists($appPath.'/appinfo/database.xml')) { |
|
897 | + OC_DB::updateDbFromStructure($appPath.'/appinfo/database.xml'); |
|
898 | 898 | } else { |
899 | 899 | $ms = new MigrationService($appId, \OC::$server->getDatabaseConnection()); |
900 | 900 | $ms->migrate(); |
@@ -907,23 +907,23 @@ discard block |
||
907 | 907 | \OC::$server->getAppManager()->getAppVersion($appId, false); |
908 | 908 | |
909 | 909 | // run upgrade code |
910 | - if (file_exists($appPath . '/appinfo/update.php')) { |
|
910 | + if (file_exists($appPath.'/appinfo/update.php')) { |
|
911 | 911 | self::loadApp($appId); |
912 | - include $appPath . '/appinfo/update.php'; |
|
912 | + include $appPath.'/appinfo/update.php'; |
|
913 | 913 | } |
914 | 914 | self::setupBackgroundJobs($appData['background-jobs']); |
915 | 915 | |
916 | 916 | //set remote/public handlers |
917 | 917 | if (array_key_exists('ocsid', $appData)) { |
918 | 918 | \OC::$server->getConfig()->setAppValue($appId, 'ocsid', $appData['ocsid']); |
919 | - } elseif(\OC::$server->getConfig()->getAppValue($appId, 'ocsid', null) !== null) { |
|
919 | + } elseif (\OC::$server->getConfig()->getAppValue($appId, 'ocsid', null) !== null) { |
|
920 | 920 | \OC::$server->getConfig()->deleteAppValue($appId, 'ocsid'); |
921 | 921 | } |
922 | 922 | foreach ($appData['remote'] as $name => $path) { |
923 | - \OC::$server->getConfig()->setAppValue('core', 'remote_' . $name, $appId . '/' . $path); |
|
923 | + \OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $appId.'/'.$path); |
|
924 | 924 | } |
925 | 925 | foreach ($appData['public'] as $name => $path) { |
926 | - \OC::$server->getConfig()->setAppValue('core', 'public_' . $name, $appId . '/' . $path); |
|
926 | + \OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $appId.'/'.$path); |
|
927 | 927 | } |
928 | 928 | |
929 | 929 | self::setAppTypes($appId); |
@@ -993,17 +993,17 @@ discard block |
||
993 | 993 | public static function getStorage(string $appId) { |
994 | 994 | if (\OC::$server->getAppManager()->isEnabledForUser($appId)) { //sanity check |
995 | 995 | if (\OC::$server->getUserSession()->isLoggedIn()) { |
996 | - $view = new \OC\Files\View('/' . OC_User::getUser()); |
|
996 | + $view = new \OC\Files\View('/'.OC_User::getUser()); |
|
997 | 997 | if (!$view->file_exists($appId)) { |
998 | 998 | $view->mkdir($appId); |
999 | 999 | } |
1000 | - return new \OC\Files\View('/' . OC_User::getUser() . '/' . $appId); |
|
1000 | + return new \OC\Files\View('/'.OC_User::getUser().'/'.$appId); |
|
1001 | 1001 | } else { |
1002 | - \OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', ILogger::ERROR); |
|
1002 | + \OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.', user not logged in', ILogger::ERROR); |
|
1003 | 1003 | return false; |
1004 | 1004 | } |
1005 | 1005 | } else { |
1006 | - \OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', ILogger::ERROR); |
|
1006 | + \OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.' not enabled', ILogger::ERROR); |
|
1007 | 1007 | return false; |
1008 | 1008 | } |
1009 | 1009 | } |
@@ -1040,9 +1040,9 @@ discard block |
||
1040 | 1040 | |
1041 | 1041 | if ($attributeLang === $similarLang) { |
1042 | 1042 | $similarLangFallback = $option['@value']; |
1043 | - } else if (strpos($attributeLang, $similarLang . '_') === 0) { |
|
1043 | + } else if (strpos($attributeLang, $similarLang.'_') === 0) { |
|
1044 | 1044 | if ($similarLangFallback === false) { |
1045 | - $similarLangFallback = $option['@value']; |
|
1045 | + $similarLangFallback = $option['@value']; |
|
1046 | 1046 | } |
1047 | 1047 | } |
1048 | 1048 | } else { |
@@ -1077,7 +1077,7 @@ discard block |
||
1077 | 1077 | $data['description'] = trim(self::findBestL10NOption($data['description'], $lang)); |
1078 | 1078 | } else if (isset($data['description']) && is_string($data['description'])) { |
1079 | 1079 | $data['description'] = trim($data['description']); |
1080 | - } else { |
|
1080 | + } else { |
|
1081 | 1081 | $data['description'] = ''; |
1082 | 1082 | } |
1083 | 1083 |