@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | /** |
| 4 | 4 | * @copyright Copyright (c) 2016, ownCloud, Inc. |
| 5 | 5 | * @copyright Copyright (c) 2016, Lukas Reschke <[email protected]> |
@@ -111,9 +111,9 @@ discard block |
||
| 111 | 111 | $apps = self::getEnabledApps(); |
| 112 | 112 | |
| 113 | 113 | // Add each apps' folder as allowed class path |
| 114 | - foreach($apps as $app) { |
|
| 114 | + foreach ($apps as $app) { |
|
| 115 | 115 | $path = self::getAppPath($app); |
| 116 | - if($path !== false) { |
|
| 116 | + if ($path !== false) { |
|
| 117 | 117 | self::registerAutoloading($app, $path); |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -139,15 +139,15 @@ discard block |
||
| 139 | 139 | public static function loadApp(string $app) { |
| 140 | 140 | self::$loadedApps[] = $app; |
| 141 | 141 | $appPath = self::getAppPath($app); |
| 142 | - if($appPath === false) { |
|
| 142 | + if ($appPath === false) { |
|
| 143 | 143 | return; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | // in case someone calls loadApp() directly |
| 147 | 147 | self::registerAutoloading($app, $appPath); |
| 148 | 148 | |
| 149 | - if (is_file($appPath . '/appinfo/app.php')) { |
|
| 150 | - \OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app); |
|
| 149 | + if (is_file($appPath.'/appinfo/app.php')) { |
|
| 150 | + \OC::$server->getEventLogger()->start('load_app_'.$app, 'Load app: '.$app); |
|
| 151 | 151 | try { |
| 152 | 152 | self::requireAppFile($app); |
| 153 | 153 | } catch (Error $ex) { |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | // enabled for groups |
| 165 | 165 | self::$enabledAppsCache = []; |
| 166 | 166 | } |
| 167 | - \OC::$server->getEventLogger()->end('load_app_' . $app); |
|
| 167 | + \OC::$server->getEventLogger()->end('load_app_'.$app); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | $info = self::getAppInfo($app); |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | $plugins = isset($info['collaboration']['plugins']['plugin']['@value']) ? |
| 211 | 211 | [$info['collaboration']['plugins']['plugin']] : $info['collaboration']['plugins']['plugin']; |
| 212 | 212 | foreach ($plugins as $plugin) { |
| 213 | - if($plugin['@attributes']['type'] === 'collaborator-search') { |
|
| 213 | + if ($plugin['@attributes']['type'] === 'collaborator-search') { |
|
| 214 | 214 | $pluginInfo = [ |
| 215 | 215 | 'shareType' => $plugin['@attributes']['share-type'], |
| 216 | 216 | 'class' => $plugin['@value'], |
@@ -229,8 +229,8 @@ discard block |
||
| 229 | 229 | * @param string $path |
| 230 | 230 | */ |
| 231 | 231 | public static function registerAutoloading(string $app, string $path) { |
| 232 | - $key = $app . '-' . $path; |
|
| 233 | - if(isset(self::$alreadyRegistered[$key])) { |
|
| 232 | + $key = $app.'-'.$path; |
|
| 233 | + if (isset(self::$alreadyRegistered[$key])) { |
|
| 234 | 234 | return; |
| 235 | 235 | } |
| 236 | 236 | |
@@ -240,17 +240,17 @@ discard block |
||
| 240 | 240 | $appNamespace = \OC\AppFramework\App::buildAppNamespace($app); |
| 241 | 241 | \OC::$server->registerNamespace($app, $appNamespace); |
| 242 | 242 | |
| 243 | - if (file_exists($path . '/composer/autoload.php')) { |
|
| 244 | - require_once $path . '/composer/autoload.php'; |
|
| 243 | + if (file_exists($path.'/composer/autoload.php')) { |
|
| 244 | + require_once $path.'/composer/autoload.php'; |
|
| 245 | 245 | } else { |
| 246 | - \OC::$composerAutoloader->addPsr4($appNamespace . '\\', $path . '/lib/', true); |
|
| 246 | + \OC::$composerAutoloader->addPsr4($appNamespace.'\\', $path.'/lib/', true); |
|
| 247 | 247 | // Register on legacy autoloader |
| 248 | 248 | \OC::$loader->addValidRoot($path); |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // Register Test namespace only when testing |
| 252 | 252 | if (defined('PHPUNIT_RUN') || defined('CLI_TEST_RUN')) { |
| 253 | - \OC::$composerAutoloader->addPsr4($appNamespace . '\\Tests\\', $path . '/tests/', true); |
|
| 253 | + \OC::$composerAutoloader->addPsr4($appNamespace.'\\Tests\\', $path.'/tests/', true); |
|
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | private static function requireAppFile(string $app) { |
| 264 | 264 | // encapsulated here to avoid variable scope conflicts |
| 265 | - require_once $app . '/appinfo/app.php'; |
|
| 265 | + require_once $app.'/appinfo/app.php'; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | public static function setAppTypes(string $app) { |
| 308 | 308 | $appManager = \OC::$server->getAppManager(); |
| 309 | 309 | $appData = $appManager->getAppInfo($app); |
| 310 | - if(!is_array($appData)) { |
|
| 310 | + if (!is_array($appData)) { |
|
| 311 | 311 | return; |
| 312 | 312 | } |
| 313 | 313 | |
@@ -360,8 +360,8 @@ discard block |
||
| 360 | 360 | } else { |
| 361 | 361 | $apps = $appManager->getEnabledAppsForUser($user); |
| 362 | 362 | } |
| 363 | - $apps = array_filter($apps, function ($app) { |
|
| 364 | - return $app !== 'files';//we add this manually |
|
| 363 | + $apps = array_filter($apps, function($app) { |
|
| 364 | + return $app !== 'files'; //we add this manually |
|
| 365 | 365 | }); |
| 366 | 366 | sort($apps); |
| 367 | 367 | array_unshift($apps, 'files'); |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | $installer = \OC::$server->query(Installer::class); |
| 400 | 400 | $isDownloaded = $installer->isDownloaded($appId); |
| 401 | 401 | |
| 402 | - if(!$isDownloaded) { |
|
| 402 | + if (!$isDownloaded) { |
|
| 403 | 403 | $installer->downloadApp($appId); |
| 404 | 404 | } |
| 405 | 405 | |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | */ |
| 475 | 475 | public static function findAppInDirectories(string $appId) { |
| 476 | 476 | $sanitizedAppId = self::cleanAppId($appId); |
| 477 | - if($sanitizedAppId !== $appId) { |
|
| 477 | + if ($sanitizedAppId !== $appId) { |
|
| 478 | 478 | return false; |
| 479 | 479 | } |
| 480 | 480 | static $app_dir = []; |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | |
| 486 | 486 | $possibleApps = []; |
| 487 | 487 | foreach (OC::$APPSROOTS as $dir) { |
| 488 | - if (file_exists($dir['path'] . '/' . $appId)) { |
|
| 488 | + if (file_exists($dir['path'].'/'.$appId)) { |
|
| 489 | 489 | $possibleApps[] = $dir; |
| 490 | 490 | } |
| 491 | 491 | } |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | if (($dir = self::findAppInDirectories($appId)) != false) { |
| 529 | - return $dir['path'] . '/' . $appId; |
|
| 529 | + return $dir['path'].'/'.$appId; |
|
| 530 | 530 | } |
| 531 | 531 | return false; |
| 532 | 532 | } |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | */ |
| 541 | 541 | public static function getAppWebPath(string $appId) { |
| 542 | 542 | if (($dir = self::findAppInDirectories($appId)) != false) { |
| 543 | - return OC::$WEBROOT . $dir['url'] . '/' . $appId; |
|
| 543 | + return OC::$WEBROOT.$dir['url'].'/'.$appId; |
|
| 544 | 544 | } |
| 545 | 545 | return false; |
| 546 | 546 | } |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | * @return string |
| 565 | 565 | */ |
| 566 | 566 | public static function getAppVersionByPath(string $path): string { |
| 567 | - $infoFile = $path . '/appinfo/info.xml'; |
|
| 567 | + $infoFile = $path.'/appinfo/info.xml'; |
|
| 568 | 568 | $appData = \OC::$server->getAppManager()->getAppInfo($infoFile, true); |
| 569 | 569 | return isset($appData['version']) ? $appData['version'] : ''; |
| 570 | 570 | } |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | * @param string $page |
| 665 | 665 | */ |
| 666 | 666 | public static function registerAdmin(string $app, string $page) { |
| 667 | - self::$adminForms[] = $app . '/' . $page . '.php'; |
|
| 667 | + self::$adminForms[] = $app.'/'.$page.'.php'; |
|
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | /** |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | * @param string $page |
| 674 | 674 | */ |
| 675 | 675 | public static function registerPersonal(string $app, string $page) { |
| 676 | - self::$personalForms[] = $app . '/' . $page . '.php'; |
|
| 676 | + self::$personalForms[] = $app.'/'.$page.'.php'; |
|
| 677 | 677 | } |
| 678 | 678 | |
| 679 | 679 | /** |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | |
| 703 | 703 | foreach (OC::$APPSROOTS as $apps_dir) { |
| 704 | 704 | if (!is_readable($apps_dir['path'])) { |
| 705 | - \OCP\Util::writeLog('core', 'unable to read app folder : ' . $apps_dir['path'], \OCP\Util::WARN); |
|
| 705 | + \OCP\Util::writeLog('core', 'unable to read app folder : '.$apps_dir['path'], \OCP\Util::WARN); |
|
| 706 | 706 | continue; |
| 707 | 707 | } |
| 708 | 708 | $dh = opendir($apps_dir['path']); |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | if (is_resource($dh)) { |
| 711 | 711 | while (($file = readdir($dh)) !== false) { |
| 712 | 712 | |
| 713 | - if ($file[0] != '.' and is_dir($apps_dir['path'] . '/' . $file) and is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml')) { |
|
| 713 | + if ($file[0] != '.' and is_dir($apps_dir['path'].'/'.$file) and is_file($apps_dir['path'].'/'.$file.'/appinfo/info.xml')) { |
|
| 714 | 714 | |
| 715 | 715 | $apps[] = $file; |
| 716 | 716 | } |
@@ -743,12 +743,12 @@ discard block |
||
| 743 | 743 | |
| 744 | 744 | $info = OC_App::getAppInfo($app, false, $langCode); |
| 745 | 745 | if (!is_array($info)) { |
| 746 | - \OCP\Util::writeLog('core', 'Could not read app info file for app "' . $app . '"', \OCP\Util::ERROR); |
|
| 746 | + \OCP\Util::writeLog('core', 'Could not read app info file for app "'.$app.'"', \OCP\Util::ERROR); |
|
| 747 | 747 | continue; |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | if (!isset($info['name'])) { |
| 751 | - \OCP\Util::writeLog('core', 'App id "' . $app . '" has no name in appinfo', \OCP\Util::ERROR); |
|
| 751 | + \OCP\Util::writeLog('core', 'App id "'.$app.'" has no name in appinfo', \OCP\Util::ERROR); |
|
| 752 | 752 | continue; |
| 753 | 753 | } |
| 754 | 754 | |
@@ -775,13 +775,13 @@ discard block |
||
| 775 | 775 | } |
| 776 | 776 | |
| 777 | 777 | $appPath = self::getAppPath($app); |
| 778 | - if($appPath !== false) { |
|
| 779 | - $appIcon = $appPath . '/img/' . $app . '.svg'; |
|
| 778 | + if ($appPath !== false) { |
|
| 779 | + $appIcon = $appPath.'/img/'.$app.'.svg'; |
|
| 780 | 780 | if (file_exists($appIcon)) { |
| 781 | - $info['preview'] = $urlGenerator->imagePath($app, $app . '.svg'); |
|
| 781 | + $info['preview'] = $urlGenerator->imagePath($app, $app.'.svg'); |
|
| 782 | 782 | $info['previewAsIcon'] = true; |
| 783 | 783 | } else { |
| 784 | - $appIcon = $appPath . '/img/app.svg'; |
|
| 784 | + $appIcon = $appPath.'/img/app.svg'; |
|
| 785 | 785 | if (file_exists($appIcon)) { |
| 786 | 786 | $info['preview'] = $urlGenerator->imagePath($app, 'app.svg'); |
| 787 | 787 | $info['previewAsIcon'] = true; |
@@ -902,7 +902,7 @@ discard block |
||
| 902 | 902 | public static function getAppVersions() { |
| 903 | 903 | static $versions; |
| 904 | 904 | |
| 905 | - if(!$versions) { |
|
| 905 | + if (!$versions) { |
|
| 906 | 906 | $appConfig = \OC::$server->getAppConfig(); |
| 907 | 907 | $versions = $appConfig->getValues(false, 'installed_version'); |
| 908 | 908 | } |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | */ |
| 918 | 918 | public static function updateApp(string $appId): bool { |
| 919 | 919 | $appPath = self::getAppPath($appId); |
| 920 | - if($appPath === false) { |
|
| 920 | + if ($appPath === false) { |
|
| 921 | 921 | return false; |
| 922 | 922 | } |
| 923 | 923 | self::registerAutoloading($appId, $appPath); |
@@ -925,8 +925,8 @@ discard block |
||
| 925 | 925 | $appData = self::getAppInfo($appId); |
| 926 | 926 | self::executeRepairSteps($appId, $appData['repair-steps']['pre-migration']); |
| 927 | 927 | |
| 928 | - if (file_exists($appPath . '/appinfo/database.xml')) { |
|
| 929 | - OC_DB::updateDbFromStructure($appPath . '/appinfo/database.xml'); |
|
| 928 | + if (file_exists($appPath.'/appinfo/database.xml')) { |
|
| 929 | + OC_DB::updateDbFromStructure($appPath.'/appinfo/database.xml'); |
|
| 930 | 930 | } else { |
| 931 | 931 | $ms = new MigrationService($appId, \OC::$server->getDatabaseConnection()); |
| 932 | 932 | $ms->migrate(); |
@@ -938,23 +938,23 @@ discard block |
||
| 938 | 938 | \OC::$server->getAppManager()->getAppVersion($appId, false); |
| 939 | 939 | |
| 940 | 940 | // run upgrade code |
| 941 | - if (file_exists($appPath . '/appinfo/update.php')) { |
|
| 941 | + if (file_exists($appPath.'/appinfo/update.php')) { |
|
| 942 | 942 | self::loadApp($appId); |
| 943 | - include $appPath . '/appinfo/update.php'; |
|
| 943 | + include $appPath.'/appinfo/update.php'; |
|
| 944 | 944 | } |
| 945 | 945 | self::setupBackgroundJobs($appData['background-jobs']); |
| 946 | 946 | |
| 947 | 947 | //set remote/public handlers |
| 948 | 948 | if (array_key_exists('ocsid', $appData)) { |
| 949 | 949 | \OC::$server->getConfig()->setAppValue($appId, 'ocsid', $appData['ocsid']); |
| 950 | - } elseif(\OC::$server->getConfig()->getAppValue($appId, 'ocsid', null) !== null) { |
|
| 950 | + } elseif (\OC::$server->getConfig()->getAppValue($appId, 'ocsid', null) !== null) { |
|
| 951 | 951 | \OC::$server->getConfig()->deleteAppValue($appId, 'ocsid'); |
| 952 | 952 | } |
| 953 | 953 | foreach ($appData['remote'] as $name => $path) { |
| 954 | - \OC::$server->getConfig()->setAppValue('core', 'remote_' . $name, $appId . '/' . $path); |
|
| 954 | + \OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $appId.'/'.$path); |
|
| 955 | 955 | } |
| 956 | 956 | foreach ($appData['public'] as $name => $path) { |
| 957 | - \OC::$server->getConfig()->setAppValue('core', 'public_' . $name, $appId . '/' . $path); |
|
| 957 | + \OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $appId.'/'.$path); |
|
| 958 | 958 | } |
| 959 | 959 | |
| 960 | 960 | self::setAppTypes($appId); |
@@ -1024,17 +1024,17 @@ discard block |
||
| 1024 | 1024 | public static function getStorage(string $appId) { |
| 1025 | 1025 | if (\OC::$server->getAppManager()->isEnabledForUser($appId)) { //sanity check |
| 1026 | 1026 | if (\OC::$server->getUserSession()->isLoggedIn()) { |
| 1027 | - $view = new \OC\Files\View('/' . OC_User::getUser()); |
|
| 1027 | + $view = new \OC\Files\View('/'.OC_User::getUser()); |
|
| 1028 | 1028 | if (!$view->file_exists($appId)) { |
| 1029 | 1029 | $view->mkdir($appId); |
| 1030 | 1030 | } |
| 1031 | - return new \OC\Files\View('/' . OC_User::getUser() . '/' . $appId); |
|
| 1031 | + return new \OC\Files\View('/'.OC_User::getUser().'/'.$appId); |
|
| 1032 | 1032 | } else { |
| 1033 | - \OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', \OCP\Util::ERROR); |
|
| 1033 | + \OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.', user not logged in', \OCP\Util::ERROR); |
|
| 1034 | 1034 | return false; |
| 1035 | 1035 | } |
| 1036 | 1036 | } else { |
| 1037 | - \OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', \OCP\Util::ERROR); |
|
| 1037 | + \OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.' not enabled', \OCP\Util::ERROR); |
|
| 1038 | 1038 | return false; |
| 1039 | 1039 | } |
| 1040 | 1040 | } |
@@ -1066,9 +1066,9 @@ discard block |
||
| 1066 | 1066 | |
| 1067 | 1067 | if ($attributeLang === $similarLang) { |
| 1068 | 1068 | $similarLangFallback = $option['@value']; |
| 1069 | - } else if (strpos($attributeLang, $similarLang . '_') === 0) { |
|
| 1069 | + } else if (strpos($attributeLang, $similarLang.'_') === 0) { |
|
| 1070 | 1070 | if ($similarLangFallback === false) { |
| 1071 | - $similarLangFallback = $option['@value']; |
|
| 1071 | + $similarLangFallback = $option['@value']; |
|
| 1072 | 1072 | } |
| 1073 | 1073 | } |
| 1074 | 1074 | } else { |
@@ -1103,7 +1103,7 @@ discard block |
||
| 1103 | 1103 | $data['description'] = trim(self::findBestL10NOption($data['description'], $lang)); |
| 1104 | 1104 | } else if (isset($data['description']) && is_string($data['description'])) { |
| 1105 | 1105 | $data['description'] = trim($data['description']); |
| 1106 | - } else { |
|
| 1106 | + } else { |
|
| 1107 | 1107 | $data['description'] = ''; |
| 1108 | 1108 | } |
| 1109 | 1109 | |