@@ -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 | } |
@@ -138,15 +138,15 @@ discard block |
||
138 | 138 | public static function loadApp($app) { |
139 | 139 | self::$loadedApps[] = $app; |
140 | 140 | $appPath = self::getAppPath($app); |
141 | - if($appPath === false) { |
|
141 | + if ($appPath === false) { |
|
142 | 142 | return; |
143 | 143 | } |
144 | 144 | |
145 | 145 | // in case someone calls loadApp() directly |
146 | 146 | self::registerAutoloading($app, $appPath); |
147 | 147 | |
148 | - if (is_file($appPath . '/appinfo/app.php')) { |
|
149 | - \OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app); |
|
148 | + if (is_file($appPath.'/appinfo/app.php')) { |
|
149 | + \OC::$server->getEventLogger()->start('load_app_'.$app, 'Load app: '.$app); |
|
150 | 150 | self::requireAppFile($app); |
151 | 151 | if (self::isType($app, array('authentication'))) { |
152 | 152 | // since authentication apps affect the "is app enabled for group" check, |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | // enabled for groups |
156 | 156 | self::$enabledAppsCache = array(); |
157 | 157 | } |
158 | - \OC::$server->getEventLogger()->end('load_app_' . $app); |
|
158 | + \OC::$server->getEventLogger()->end('load_app_'.$app); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | $info = self::getAppInfo($app); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $plugins = isset($info['collaboration']['plugins']['plugin']['@value']) ? |
180 | 180 | [$info['collaboration']['plugins']['plugin']] : $info['collaboration']['plugins']['plugin']; |
181 | 181 | foreach ($plugins as $plugin) { |
182 | - if($plugin['@attributes']['type'] === 'collaborator-search') { |
|
182 | + if ($plugin['@attributes']['type'] === 'collaborator-search') { |
|
183 | 183 | $pluginInfo = [ |
184 | 184 | 'shareType' => $plugin['@attributes']['share-type'], |
185 | 185 | 'class' => $plugin['@value'], |
@@ -196,17 +196,17 @@ discard block |
||
196 | 196 | * @param string $path |
197 | 197 | */ |
198 | 198 | public static function registerAutoloading($app, $path) { |
199 | - $key = $app . '-' . $path; |
|
200 | - if(isset(self::$alreadyRegistered[$key])) { |
|
199 | + $key = $app.'-'.$path; |
|
200 | + if (isset(self::$alreadyRegistered[$key])) { |
|
201 | 201 | return; |
202 | 202 | } |
203 | 203 | self::$alreadyRegistered[$key] = true; |
204 | 204 | // Register on PSR-4 composer autoloader |
205 | 205 | $appNamespace = \OC\AppFramework\App::buildAppNamespace($app); |
206 | 206 | \OC::$server->registerNamespace($app, $appNamespace); |
207 | - \OC::$composerAutoloader->addPsr4($appNamespace . '\\', $path . '/lib/', true); |
|
207 | + \OC::$composerAutoloader->addPsr4($appNamespace.'\\', $path.'/lib/', true); |
|
208 | 208 | if (defined('PHPUNIT_RUN') || defined('CLI_TEST_RUN')) { |
209 | - \OC::$composerAutoloader->addPsr4($appNamespace . '\\Tests\\', $path . '/tests/', true); |
|
209 | + \OC::$composerAutoloader->addPsr4($appNamespace.'\\Tests\\', $path.'/tests/', true); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | // Register on legacy autoloader |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | private static function requireAppFile($app) { |
222 | 222 | try { |
223 | 223 | // encapsulated here to avoid variable scope conflicts |
224 | - require_once $app . '/appinfo/app.php'; |
|
224 | + require_once $app.'/appinfo/app.php'; |
|
225 | 225 | } catch (Error $ex) { |
226 | 226 | \OC::$server->getLogger()->logException($ex); |
227 | 227 | $blacklist = \OC::$server->getAppManager()->getAlwaysEnabledApps(); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | */ |
276 | 276 | public static function setAppTypes($app) { |
277 | 277 | $appData = self::getAppInfo($app); |
278 | - if(!is_array($appData)) { |
|
278 | + if (!is_array($appData)) { |
|
279 | 279 | return; |
280 | 280 | } |
281 | 281 | |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | } else { |
328 | 328 | $apps = $appManager->getEnabledAppsForUser($user); |
329 | 329 | } |
330 | - $apps = array_filter($apps, function ($app) { |
|
331 | - return $app !== 'files';//we add this manually |
|
330 | + $apps = array_filter($apps, function($app) { |
|
331 | + return $app !== 'files'; //we add this manually |
|
332 | 332 | }); |
333 | 333 | sort($apps); |
334 | 334 | array_unshift($apps, 'files'); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | ); |
372 | 372 | $isDownloaded = $installer->isDownloaded($appId); |
373 | 373 | |
374 | - if(!$isDownloaded) { |
|
374 | + if (!$isDownloaded) { |
|
375 | 375 | $installer->downloadApp($appId); |
376 | 376 | } |
377 | 377 | |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | */ |
491 | 491 | public static function findAppInDirectories($appId) { |
492 | 492 | $sanitizedAppId = self::cleanAppId($appId); |
493 | - if($sanitizedAppId !== $appId) { |
|
493 | + if ($sanitizedAppId !== $appId) { |
|
494 | 494 | return false; |
495 | 495 | } |
496 | 496 | static $app_dir = array(); |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | |
502 | 502 | $possibleApps = array(); |
503 | 503 | foreach (OC::$APPSROOTS as $dir) { |
504 | - if (file_exists($dir['path'] . '/' . $appId)) { |
|
504 | + if (file_exists($dir['path'].'/'.$appId)) { |
|
505 | 505 | $possibleApps[] = $dir; |
506 | 506 | } |
507 | 507 | } |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | } |
543 | 543 | |
544 | 544 | if (($dir = self::findAppInDirectories($appId)) != false) { |
545 | - return $dir['path'] . '/' . $appId; |
|
545 | + return $dir['path'].'/'.$appId; |
|
546 | 546 | } |
547 | 547 | return false; |
548 | 548 | } |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | */ |
557 | 557 | public static function getAppWebPath($appId) { |
558 | 558 | if (($dir = self::findAppInDirectories($appId)) != false) { |
559 | - return OC::$WEBROOT . $dir['url'] . '/' . $appId; |
|
559 | + return OC::$WEBROOT.$dir['url'].'/'.$appId; |
|
560 | 560 | } |
561 | 561 | return false; |
562 | 562 | } |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | * @return string |
570 | 570 | */ |
571 | 571 | public static function getAppVersion($appId, $useCache = true) { |
572 | - if($useCache && isset(self::$appVersion[$appId])) { |
|
572 | + if ($useCache && isset(self::$appVersion[$appId])) { |
|
573 | 573 | return self::$appVersion[$appId]; |
574 | 574 | } |
575 | 575 | |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | * @return string |
586 | 586 | */ |
587 | 587 | public static function getAppVersionByPath($path) { |
588 | - $infoFile = $path . '/appinfo/info.xml'; |
|
588 | + $infoFile = $path.'/appinfo/info.xml'; |
|
589 | 589 | $appData = self::getAppInfo($infoFile, true); |
590 | 590 | return isset($appData['version']) ? $appData['version'] : ''; |
591 | 591 | } |
@@ -608,10 +608,10 @@ discard block |
||
608 | 608 | return self::$appInfo[$appId]; |
609 | 609 | } |
610 | 610 | $appPath = self::getAppPath($appId); |
611 | - if($appPath === false) { |
|
611 | + if ($appPath === false) { |
|
612 | 612 | return null; |
613 | 613 | } |
614 | - $file = $appPath . '/appinfo/info.xml'; |
|
614 | + $file = $appPath.'/appinfo/info.xml'; |
|
615 | 615 | } |
616 | 616 | |
617 | 617 | $parser = new InfoParser(\OC::$server->getMemCacheFactory()->createLocal('core.appinfo')); |
@@ -620,9 +620,9 @@ discard block |
||
620 | 620 | if (is_array($data)) { |
621 | 621 | $data = OC_App::parseAppInfo($data, $lang); |
622 | 622 | } |
623 | - if(isset($data['ocsid'])) { |
|
623 | + if (isset($data['ocsid'])) { |
|
624 | 624 | $storedId = \OC::$server->getConfig()->getAppValue($appId, 'ocsid'); |
625 | - if($storedId !== '' && $storedId !== $data['ocsid']) { |
|
625 | + if ($storedId !== '' && $storedId !== $data['ocsid']) { |
|
626 | 626 | $data['ocsid'] = $storedId; |
627 | 627 | } |
628 | 628 | } |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | * @param string $page |
715 | 715 | */ |
716 | 716 | public static function registerAdmin($app, $page) { |
717 | - self::$adminForms[] = $app . '/' . $page . '.php'; |
|
717 | + self::$adminForms[] = $app.'/'.$page.'.php'; |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | /** |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | * @param string $page |
724 | 724 | */ |
725 | 725 | public static function registerPersonal($app, $page) { |
726 | - self::$personalForms[] = $app . '/' . $page . '.php'; |
|
726 | + self::$personalForms[] = $app.'/'.$page.'.php'; |
|
727 | 727 | } |
728 | 728 | |
729 | 729 | /** |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | |
753 | 753 | foreach (OC::$APPSROOTS as $apps_dir) { |
754 | 754 | if (!is_readable($apps_dir['path'])) { |
755 | - \OCP\Util::writeLog('core', 'unable to read app folder : ' . $apps_dir['path'], \OCP\Util::WARN); |
|
755 | + \OCP\Util::writeLog('core', 'unable to read app folder : '.$apps_dir['path'], \OCP\Util::WARN); |
|
756 | 756 | continue; |
757 | 757 | } |
758 | 758 | $dh = opendir($apps_dir['path']); |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | if (is_resource($dh)) { |
761 | 761 | while (($file = readdir($dh)) !== false) { |
762 | 762 | |
763 | - if ($file[0] != '.' and is_dir($apps_dir['path'] . '/' . $file) and is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml')) { |
|
763 | + if ($file[0] != '.' and is_dir($apps_dir['path'].'/'.$file) and is_file($apps_dir['path'].'/'.$file.'/appinfo/info.xml')) { |
|
764 | 764 | |
765 | 765 | $apps[] = $file; |
766 | 766 | } |
@@ -791,12 +791,12 @@ discard block |
||
791 | 791 | |
792 | 792 | $info = OC_App::getAppInfo($app, false, $langCode); |
793 | 793 | if (!is_array($info)) { |
794 | - \OCP\Util::writeLog('core', 'Could not read app info file for app "' . $app . '"', \OCP\Util::ERROR); |
|
794 | + \OCP\Util::writeLog('core', 'Could not read app info file for app "'.$app.'"', \OCP\Util::ERROR); |
|
795 | 795 | continue; |
796 | 796 | } |
797 | 797 | |
798 | 798 | if (!isset($info['name'])) { |
799 | - \OCP\Util::writeLog('core', 'App id "' . $app . '" has no name in appinfo', \OCP\Util::ERROR); |
|
799 | + \OCP\Util::writeLog('core', 'App id "'.$app.'" has no name in appinfo', \OCP\Util::ERROR); |
|
800 | 800 | continue; |
801 | 801 | } |
802 | 802 | |
@@ -823,13 +823,13 @@ discard block |
||
823 | 823 | } |
824 | 824 | |
825 | 825 | $appPath = self::getAppPath($app); |
826 | - if($appPath !== false) { |
|
827 | - $appIcon = $appPath . '/img/' . $app . '.svg'; |
|
826 | + if ($appPath !== false) { |
|
827 | + $appIcon = $appPath.'/img/'.$app.'.svg'; |
|
828 | 828 | if (file_exists($appIcon)) { |
829 | - $info['preview'] = $urlGenerator->imagePath($app, $app . '.svg'); |
|
829 | + $info['preview'] = $urlGenerator->imagePath($app, $app.'.svg'); |
|
830 | 830 | $info['previewAsIcon'] = true; |
831 | 831 | } else { |
832 | - $appIcon = $appPath . '/img/app.svg'; |
|
832 | + $appIcon = $appPath.'/img/app.svg'; |
|
833 | 833 | if (file_exists($appIcon)) { |
834 | 834 | $info['preview'] = $urlGenerator->imagePath($app, 'app.svg'); |
835 | 835 | $info['previewAsIcon'] = true; |
@@ -863,9 +863,9 @@ discard block |
||
863 | 863 | * @return string|false |
864 | 864 | */ |
865 | 865 | public static function getInternalAppIdByOcs($ocsID) { |
866 | - if(is_numeric($ocsID)) { |
|
866 | + if (is_numeric($ocsID)) { |
|
867 | 867 | $idArray = \OC::$server->getAppConfig()->getValues(false, 'ocsid'); |
868 | - if(array_search($ocsID, $idArray)) { |
|
868 | + if (array_search($ocsID, $idArray)) { |
|
869 | 869 | return array_search($ocsID, $idArray); |
870 | 870 | } |
871 | 871 | } |
@@ -969,7 +969,7 @@ discard block |
||
969 | 969 | public static function getAppVersions() { |
970 | 970 | static $versions; |
971 | 971 | |
972 | - if(!$versions) { |
|
972 | + if (!$versions) { |
|
973 | 973 | $appConfig = \OC::$server->getAppConfig(); |
974 | 974 | $versions = $appConfig->getValues(false, 'installed_version'); |
975 | 975 | } |
@@ -991,7 +991,7 @@ discard block |
||
991 | 991 | if ($app !== false) { |
992 | 992 | // check if the app is compatible with this version of ownCloud |
993 | 993 | $info = self::getAppInfo($app); |
994 | - if(!is_array($info)) { |
|
994 | + if (!is_array($info)) { |
|
995 | 995 | throw new \Exception( |
996 | 996 | $l->t('App "%s" cannot be installed because appinfo file cannot be read.', |
997 | 997 | [$info['name']] |
@@ -1016,7 +1016,7 @@ discard block |
||
1016 | 1016 | $config->setAppValue($app, 'ocsid', $appData['id']); |
1017 | 1017 | } |
1018 | 1018 | |
1019 | - if(isset($info['settings']) && is_array($info['settings'])) { |
|
1019 | + if (isset($info['settings']) && is_array($info['settings'])) { |
|
1020 | 1020 | $appPath = self::getAppPath($app); |
1021 | 1021 | self::registerAutoloading($app, $appPath); |
1022 | 1022 | \OC::$server->getSettingsManager()->setupSettings($info['settings']); |
@@ -1024,7 +1024,7 @@ discard block |
||
1024 | 1024 | |
1025 | 1025 | \OC_Hook::emit('OC_App', 'post_enable', array('app' => $app)); |
1026 | 1026 | } else { |
1027 | - if(empty($appName) ) { |
|
1027 | + if (empty($appName)) { |
|
1028 | 1028 | throw new \Exception($l->t("No app name specified")); |
1029 | 1029 | } else { |
1030 | 1030 | throw new \Exception($l->t("App '%s' could not be installed!", $appName)); |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | */ |
1043 | 1043 | public static function updateApp($appId) { |
1044 | 1044 | $appPath = self::getAppPath($appId); |
1045 | - if($appPath === false) { |
|
1045 | + if ($appPath === false) { |
|
1046 | 1046 | return false; |
1047 | 1047 | } |
1048 | 1048 | self::registerAutoloading($appId, $appPath); |
@@ -1050,8 +1050,8 @@ discard block |
||
1050 | 1050 | $appData = self::getAppInfo($appId); |
1051 | 1051 | self::executeRepairSteps($appId, $appData['repair-steps']['pre-migration']); |
1052 | 1052 | |
1053 | - if (file_exists($appPath . '/appinfo/database.xml')) { |
|
1054 | - OC_DB::updateDbFromStructure($appPath . '/appinfo/database.xml'); |
|
1053 | + if (file_exists($appPath.'/appinfo/database.xml')) { |
|
1054 | + OC_DB::updateDbFromStructure($appPath.'/appinfo/database.xml'); |
|
1055 | 1055 | } else { |
1056 | 1056 | $ms = new MigrationService($appId, \OC::$server->getDatabaseConnection()); |
1057 | 1057 | $ms->migrate(); |
@@ -1062,26 +1062,26 @@ discard block |
||
1062 | 1062 | unset(self::$appVersion[$appId]); |
1063 | 1063 | |
1064 | 1064 | // run upgrade code |
1065 | - if (file_exists($appPath . '/appinfo/update.php')) { |
|
1065 | + if (file_exists($appPath.'/appinfo/update.php')) { |
|
1066 | 1066 | self::loadApp($appId); |
1067 | - include $appPath . '/appinfo/update.php'; |
|
1067 | + include $appPath.'/appinfo/update.php'; |
|
1068 | 1068 | } |
1069 | 1069 | self::setupBackgroundJobs($appData['background-jobs']); |
1070 | - if(isset($appData['settings']) && is_array($appData['settings'])) { |
|
1070 | + if (isset($appData['settings']) && is_array($appData['settings'])) { |
|
1071 | 1071 | \OC::$server->getSettingsManager()->setupSettings($appData['settings']); |
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | //set remote/public handlers |
1075 | 1075 | if (array_key_exists('ocsid', $appData)) { |
1076 | 1076 | \OC::$server->getConfig()->setAppValue($appId, 'ocsid', $appData['ocsid']); |
1077 | - } elseif(\OC::$server->getConfig()->getAppValue($appId, 'ocsid', null) !== null) { |
|
1077 | + } elseif (\OC::$server->getConfig()->getAppValue($appId, 'ocsid', null) !== null) { |
|
1078 | 1078 | \OC::$server->getConfig()->deleteAppValue($appId, 'ocsid'); |
1079 | 1079 | } |
1080 | 1080 | foreach ($appData['remote'] as $name => $path) { |
1081 | - \OC::$server->getConfig()->setAppValue('core', 'remote_' . $name, $appId . '/' . $path); |
|
1081 | + \OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $appId.'/'.$path); |
|
1082 | 1082 | } |
1083 | 1083 | foreach ($appData['public'] as $name => $path) { |
1084 | - \OC::$server->getConfig()->setAppValue('core', 'public_' . $name, $appId . '/' . $path); |
|
1084 | + \OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $appId.'/'.$path); |
|
1085 | 1085 | } |
1086 | 1086 | |
1087 | 1087 | self::setAppTypes($appId); |
@@ -1151,17 +1151,17 @@ discard block |
||
1151 | 1151 | public static function getStorage($appId) { |
1152 | 1152 | if (OC_App::isEnabled($appId)) { //sanity check |
1153 | 1153 | if (\OC::$server->getUserSession()->isLoggedIn()) { |
1154 | - $view = new \OC\Files\View('/' . OC_User::getUser()); |
|
1154 | + $view = new \OC\Files\View('/'.OC_User::getUser()); |
|
1155 | 1155 | if (!$view->file_exists($appId)) { |
1156 | 1156 | $view->mkdir($appId); |
1157 | 1157 | } |
1158 | - return new \OC\Files\View('/' . OC_User::getUser() . '/' . $appId); |
|
1158 | + return new \OC\Files\View('/'.OC_User::getUser().'/'.$appId); |
|
1159 | 1159 | } else { |
1160 | - \OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', \OCP\Util::ERROR); |
|
1160 | + \OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.', user not logged in', \OCP\Util::ERROR); |
|
1161 | 1161 | return false; |
1162 | 1162 | } |
1163 | 1163 | } else { |
1164 | - \OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', \OCP\Util::ERROR); |
|
1164 | + \OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.' not enabled', \OCP\Util::ERROR); |
|
1165 | 1165 | return false; |
1166 | 1166 | } |
1167 | 1167 | } |
@@ -1193,9 +1193,9 @@ discard block |
||
1193 | 1193 | |
1194 | 1194 | if ($attributeLang === $similarLang) { |
1195 | 1195 | $similarLangFallback = $option['@value']; |
1196 | - } else if (strpos($attributeLang, $similarLang . '_') === 0) { |
|
1196 | + } else if (strpos($attributeLang, $similarLang.'_') === 0) { |
|
1197 | 1197 | if ($similarLangFallback === false) { |
1198 | - $similarLangFallback = $option['@value']; |
|
1198 | + $similarLangFallback = $option['@value']; |
|
1199 | 1199 | } |
1200 | 1200 | } |
1201 | 1201 | } else { |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | $data['description'] = trim(self::findBestL10NOption($data['description'], $lang)); |
1231 | 1231 | } else if (isset($data['description']) && is_string($data['description'])) { |
1232 | 1232 | $data['description'] = trim($data['description']); |
1233 | - } else { |
|
1233 | + } else { |
|
1234 | 1234 | $data['description'] = ''; |
1235 | 1235 | } |
1236 | 1236 |