@@ -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 (Error $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 |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | $this->logAllEvents(); |
102 | 102 | |
103 | 103 | $logLevel = $this->config->getSystemValue('loglevel', ILogger::WARN); |
104 | - $this->emit('\OC\Updater', 'setDebugLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]); |
|
104 | + $this->emit('\OC\Updater', 'setDebugLogLevel', [$logLevel, $this->logLevelNames[$logLevel]]); |
|
105 | 105 | $this->config->setSystemValue('loglevel', ILogger::DEBUG); |
106 | 106 | |
107 | 107 | $wasMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false); |
108 | 108 | |
109 | - if(!$wasMaintenanceModeEnabled) { |
|
109 | + if (!$wasMaintenanceModeEnabled) { |
|
110 | 110 | $this->config->setSystemValue('maintenance', true); |
111 | 111 | $this->emit('\OC\Updater', 'maintenanceEnabled'); |
112 | 112 | } |
@@ -119,31 +119,31 @@ discard block |
||
119 | 119 | $this->waitForCronToFinish(); |
120 | 120 | } |
121 | 121 | |
122 | - $this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, array('app' => 'core')); |
|
122 | + $this->log->debug('starting upgrade from '.$installedVersion.' to '.$currentVersion, array('app' => 'core')); |
|
123 | 123 | |
124 | 124 | $success = true; |
125 | 125 | try { |
126 | 126 | $this->doUpgrade($currentVersion, $installedVersion); |
127 | 127 | } catch (HintException $exception) { |
128 | 128 | $this->log->logException($exception, ['app' => 'core']); |
129 | - $this->emit('\OC\Updater', 'failure', array($exception->getMessage() . ': ' .$exception->getHint())); |
|
129 | + $this->emit('\OC\Updater', 'failure', array($exception->getMessage().': '.$exception->getHint())); |
|
130 | 130 | $success = false; |
131 | 131 | } catch (\Exception $exception) { |
132 | 132 | $this->log->logException($exception, ['app' => 'core']); |
133 | - $this->emit('\OC\Updater', 'failure', array(get_class($exception) . ': ' .$exception->getMessage())); |
|
133 | + $this->emit('\OC\Updater', 'failure', array(get_class($exception).': '.$exception->getMessage())); |
|
134 | 134 | $success = false; |
135 | 135 | } |
136 | 136 | |
137 | 137 | $this->emit('\OC\Updater', 'updateEnd', array($success)); |
138 | 138 | |
139 | - if(!$wasMaintenanceModeEnabled && $success) { |
|
139 | + if (!$wasMaintenanceModeEnabled && $success) { |
|
140 | 140 | $this->config->setSystemValue('maintenance', false); |
141 | 141 | $this->emit('\OC\Updater', 'maintenanceDisabled'); |
142 | 142 | } else { |
143 | 143 | $this->emit('\OC\Updater', 'maintenanceActive'); |
144 | 144 | } |
145 | 145 | |
146 | - $this->emit('\OC\Updater', 'resetLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]); |
|
146 | + $this->emit('\OC\Updater', 'resetLogLevel', [$logLevel, $this->logLevelNames[$logLevel]]); |
|
147 | 147 | $this->config->setSystemValue('loglevel', $logLevel); |
148 | 148 | $this->config->setSystemValue('installed', true); |
149 | 149 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | private function getAllowedPreviousVersions() { |
159 | 159 | // this should really be a JSON file |
160 | - require \OC::$SERVERROOT . '/version.php'; |
|
160 | + require \OC::$SERVERROOT.'/version.php'; |
|
161 | 161 | /** @var array $OC_VersionCanBeUpgradedFrom */ |
162 | 162 | return $OC_VersionCanBeUpgradedFrom; |
163 | 163 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | */ |
170 | 170 | private function getVendor() { |
171 | 171 | // this should really be a JSON file |
172 | - require \OC::$SERVERROOT . '/version.php'; |
|
172 | + require \OC::$SERVERROOT.'/version.php'; |
|
173 | 173 | /** @var string $vendor */ |
174 | 174 | return (string) $vendor; |
175 | 175 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function isUpgradePossible($oldVersion, $newVersion, array $allowedPreviousVersions) { |
185 | 185 | $version = explode('.', $oldVersion); |
186 | - $majorMinor = $version[0] . '.' . $version[1]; |
|
186 | + $majorMinor = $version[0].'.'.$version[1]; |
|
187 | 187 | |
188 | 188 | $currentVendor = $this->config->getAppValue('core', 'vendor', ''); |
189 | 189 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | // create empty file in data dir, so we can later find |
231 | 231 | // out that this is indeed an ownCloud data directory |
232 | 232 | // (in case it didn't exist before) |
233 | - file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', ''); |
|
233 | + file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/.ocdata', ''); |
|
234 | 234 | |
235 | 235 | // pre-upgrade repairs |
236 | 236 | $repair = new Repair(Repair::getBeforeUpgradeRepairSteps(), \OC::$server->getEventDispatcher()); |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | foreach ($errors as $appId => $exception) { |
263 | 263 | /** @var \Exception $exception */ |
264 | 264 | $this->log->logException($exception, ['app' => $appId]); |
265 | - $this->emit('\OC\Updater', 'failure', [$appId . ': ' . $exception->getMessage()]); |
|
265 | + $this->emit('\OC\Updater', 'failure', [$appId.': '.$exception->getMessage()]); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | // post-upgrade repairs |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $this->config->setAppValue('core', 'lastupdatedat', 0); |
274 | 274 | |
275 | 275 | // Check for code integrity if not disabled |
276 | - if(\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) { |
|
276 | + if (\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) { |
|
277 | 277 | $this->emit('\OC\Updater', 'startCheckCodeIntegrity'); |
278 | 278 | $this->checker->runInstanceVerification(); |
279 | 279 | $this->emit('\OC\Updater', 'finishedCheckCodeIntegrity'); |
@@ -314,12 +314,12 @@ discard block |
||
314 | 314 | * @link https://github.com/owncloud/core/issues/10980 |
315 | 315 | * @see \OC_App::updateApp |
316 | 316 | */ |
317 | - if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/preupdate.php')) { |
|
317 | + if (file_exists(\OC_App::getAppPath($appId).'/appinfo/preupdate.php')) { |
|
318 | 318 | $this->includePreUpdate($appId); |
319 | 319 | } |
320 | - if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/database.xml')) { |
|
320 | + if (file_exists(\OC_App::getAppPath($appId).'/appinfo/database.xml')) { |
|
321 | 321 | $this->emit('\OC\Updater', 'appSimulateUpdate', array($appId)); |
322 | - \OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId) . '/appinfo/database.xml'); |
|
322 | + \OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId).'/appinfo/database.xml'); |
|
323 | 323 | } |
324 | 324 | } |
325 | 325 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @param string $appId |
333 | 333 | */ |
334 | 334 | private function includePreUpdate($appId) { |
335 | - include \OC_App::getAppPath($appId) . '/appinfo/preupdate.php'; |
|
335 | + include \OC_App::getAppPath($appId).'/appinfo/preupdate.php'; |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | foreach ($apps as $appId) { |
351 | 351 | $priorityType = false; |
352 | 352 | foreach ($priorityTypes as $type) { |
353 | - if(!isset($stacks[$type])) { |
|
353 | + if (!isset($stacks[$type])) { |
|
354 | 354 | $stacks[$type] = array(); |
355 | 355 | } |
356 | 356 | if (\OC_App::isType($appId, [$type])) { |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | \OC_App::updateApp($appId); |
371 | 371 | $this->emit('\OC\Updater', 'appUpgrade', [$appId, \OC_App::getAppVersion($appId)]); |
372 | 372 | } |
373 | - if($type !== $pseudoOtherType) { |
|
373 | + if ($type !== $pseudoOtherType) { |
|
374 | 374 | // load authentication, filesystem and logging apps after |
375 | 375 | // upgrading them. Other apps my need to rely on modifying |
376 | 376 | // user and/or filesystem aspects. |
@@ -398,9 +398,9 @@ discard block |
||
398 | 398 | foreach ($apps as $app) { |
399 | 399 | // check if the app is compatible with this version of ownCloud |
400 | 400 | $info = OC_App::getAppInfo($app); |
401 | - if($info === null || !OC_App::isAppCompatible($version, $info)) { |
|
401 | + if ($info === null || !OC_App::isAppCompatible($version, $info)) { |
|
402 | 402 | if ($appManager->isShipped($app)) { |
403 | - throw new \UnexpectedValueException('The files of the app "' . $app . '" were not correctly replaced before running the update'); |
|
403 | + throw new \UnexpectedValueException('The files of the app "'.$app.'" were not correctly replaced before running the update'); |
|
404 | 404 | } |
405 | 405 | \OC::$server->getAppManager()->disableApp($app); |
406 | 406 | $this->emit('\OC\Updater', 'incompatibleAppDisabled', array($app)); |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | * @throws \Exception |
440 | 440 | */ |
441 | 441 | private function upgradeAppStoreApps(array $disabledApps, $reenable = false) { |
442 | - foreach($disabledApps as $app) { |
|
442 | + foreach ($disabledApps as $app) { |
|
443 | 443 | try { |
444 | 444 | $this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]); |
445 | 445 | if ($this->installer->isUpdateAvailable($app)) { |
@@ -463,22 +463,22 @@ discard block |
||
463 | 463 | */ |
464 | 464 | private function emitRepairEvents() { |
465 | 465 | $dispatcher = \OC::$server->getEventDispatcher(); |
466 | - $dispatcher->addListener('\OC\Repair::warning', function ($event) { |
|
466 | + $dispatcher->addListener('\OC\Repair::warning', function($event) { |
|
467 | 467 | if ($event instanceof GenericEvent) { |
468 | 468 | $this->emit('\OC\Updater', 'repairWarning', $event->getArguments()); |
469 | 469 | } |
470 | 470 | }); |
471 | - $dispatcher->addListener('\OC\Repair::error', function ($event) { |
|
471 | + $dispatcher->addListener('\OC\Repair::error', function($event) { |
|
472 | 472 | if ($event instanceof GenericEvent) { |
473 | 473 | $this->emit('\OC\Updater', 'repairError', $event->getArguments()); |
474 | 474 | } |
475 | 475 | }); |
476 | - $dispatcher->addListener('\OC\Repair::info', function ($event) { |
|
476 | + $dispatcher->addListener('\OC\Repair::info', function($event) { |
|
477 | 477 | if ($event instanceof GenericEvent) { |
478 | 478 | $this->emit('\OC\Updater', 'repairInfo', $event->getArguments()); |
479 | 479 | } |
480 | 480 | }); |
481 | - $dispatcher->addListener('\OC\Repair::step', function ($event) { |
|
481 | + $dispatcher->addListener('\OC\Repair::step', function($event) { |
|
482 | 482 | if ($event instanceof GenericEvent) { |
483 | 483 | $this->emit('\OC\Updater', 'repairStep', $event->getArguments()); |
484 | 484 | } |
@@ -493,13 +493,13 @@ discard block |
||
493 | 493 | if (!$event instanceof GenericEvent) { |
494 | 494 | return; |
495 | 495 | } |
496 | - $log->info('\OC\DB\Migrator::executeSql: ' . $event->getSubject() . ' (' . $event->getArgument(0) . ' of ' . $event->getArgument(1) . ')', ['app' => 'updater']); |
|
496 | + $log->info('\OC\DB\Migrator::executeSql: '.$event->getSubject().' ('.$event->getArgument(0).' of '.$event->getArgument(1).')', ['app' => 'updater']); |
|
497 | 497 | }); |
498 | 498 | $dispatcher->addListener('\OC\DB\Migrator::checkTable', function($event) use ($log) { |
499 | 499 | if (!$event instanceof GenericEvent) { |
500 | 500 | return; |
501 | 501 | } |
502 | - $log->info('\OC\DB\Migrator::checkTable: ' . $event->getSubject() . ' (' . $event->getArgument(0) . ' of ' . $event->getArgument(1) . ')', ['app' => 'updater']); |
|
502 | + $log->info('\OC\DB\Migrator::checkTable: '.$event->getSubject().' ('.$event->getArgument(0).' of '.$event->getArgument(1).')', ['app' => 'updater']); |
|
503 | 503 | }); |
504 | 504 | |
505 | 505 | $repairListener = function($event) use ($log) { |
@@ -508,30 +508,30 @@ discard block |
||
508 | 508 | } |
509 | 509 | switch ($event->getSubject()) { |
510 | 510 | case '\OC\Repair::startProgress': |
511 | - $log->info('\OC\Repair::startProgress: Starting ... ' . $event->getArgument(1) . ' (' . $event->getArgument(0) . ')', ['app' => 'updater']); |
|
511 | + $log->info('\OC\Repair::startProgress: Starting ... '.$event->getArgument(1).' ('.$event->getArgument(0).')', ['app' => 'updater']); |
|
512 | 512 | break; |
513 | 513 | case '\OC\Repair::advance': |
514 | 514 | $desc = $event->getArgument(1); |
515 | 515 | if (empty($desc)) { |
516 | 516 | $desc = ''; |
517 | 517 | } |
518 | - $log->info('\OC\Repair::advance: ' . $desc . ' (' . $event->getArgument(0) . ')', ['app' => 'updater']); |
|
518 | + $log->info('\OC\Repair::advance: '.$desc.' ('.$event->getArgument(0).')', ['app' => 'updater']); |
|
519 | 519 | |
520 | 520 | break; |
521 | 521 | case '\OC\Repair::finishProgress': |
522 | 522 | $log->info('\OC\Repair::finishProgress', ['app' => 'updater']); |
523 | 523 | break; |
524 | 524 | case '\OC\Repair::step': |
525 | - $log->info('\OC\Repair::step: Repair step: ' . $event->getArgument(0), ['app' => 'updater']); |
|
525 | + $log->info('\OC\Repair::step: Repair step: '.$event->getArgument(0), ['app' => 'updater']); |
|
526 | 526 | break; |
527 | 527 | case '\OC\Repair::info': |
528 | - $log->info('\OC\Repair::info: Repair info: ' . $event->getArgument(0), ['app' => 'updater']); |
|
528 | + $log->info('\OC\Repair::info: Repair info: '.$event->getArgument(0), ['app' => 'updater']); |
|
529 | 529 | break; |
530 | 530 | case '\OC\Repair::warning': |
531 | - $log->warning('\OC\Repair::warning: Repair warning: ' . $event->getArgument(0), ['app' => 'updater']); |
|
531 | + $log->warning('\OC\Repair::warning: Repair warning: '.$event->getArgument(0), ['app' => 'updater']); |
|
532 | 532 | break; |
533 | 533 | case '\OC\Repair::error': |
534 | - $log->error('\OC\Repair::error: Repair error: ' . $event->getArgument(0), ['app' => 'updater']); |
|
534 | + $log->error('\OC\Repair::error: Repair error: '.$event->getArgument(0), ['app' => 'updater']); |
|
535 | 535 | break; |
536 | 536 | } |
537 | 537 | }; |
@@ -545,74 +545,74 @@ discard block |
||
545 | 545 | $dispatcher->addListener('\OC\Repair::error', $repairListener); |
546 | 546 | |
547 | 547 | |
548 | - $this->listen('\OC\Updater', 'maintenanceEnabled', function () use($log) { |
|
548 | + $this->listen('\OC\Updater', 'maintenanceEnabled', function() use($log) { |
|
549 | 549 | $log->info('\OC\Updater::maintenanceEnabled: Turned on maintenance mode', ['app' => 'updater']); |
550 | 550 | }); |
551 | - $this->listen('\OC\Updater', 'maintenanceDisabled', function () use($log) { |
|
551 | + $this->listen('\OC\Updater', 'maintenanceDisabled', function() use($log) { |
|
552 | 552 | $log->info('\OC\Updater::maintenanceDisabled: Turned off maintenance mode', ['app' => 'updater']); |
553 | 553 | }); |
554 | - $this->listen('\OC\Updater', 'maintenanceActive', function () use($log) { |
|
554 | + $this->listen('\OC\Updater', 'maintenanceActive', function() use($log) { |
|
555 | 555 | $log->info('\OC\Updater::maintenanceActive: Maintenance mode is kept active', ['app' => 'updater']); |
556 | 556 | }); |
557 | - $this->listen('\OC\Updater', 'updateEnd', function ($success) use($log) { |
|
557 | + $this->listen('\OC\Updater', 'updateEnd', function($success) use($log) { |
|
558 | 558 | if ($success) { |
559 | 559 | $log->info('\OC\Updater::updateEnd: Update successful', ['app' => 'updater']); |
560 | 560 | } else { |
561 | 561 | $log->error('\OC\Updater::updateEnd: Update failed', ['app' => 'updater']); |
562 | 562 | } |
563 | 563 | }); |
564 | - $this->listen('\OC\Updater', 'dbUpgradeBefore', function () use($log) { |
|
564 | + $this->listen('\OC\Updater', 'dbUpgradeBefore', function() use($log) { |
|
565 | 565 | $log->info('\OC\Updater::dbUpgradeBefore: Updating database schema', ['app' => 'updater']); |
566 | 566 | }); |
567 | - $this->listen('\OC\Updater', 'dbUpgrade', function () use($log) { |
|
567 | + $this->listen('\OC\Updater', 'dbUpgrade', function() use($log) { |
|
568 | 568 | $log->info('\OC\Updater::dbUpgrade: Updated database', ['app' => 'updater']); |
569 | 569 | }); |
570 | - $this->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use($log) { |
|
570 | + $this->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function() use($log) { |
|
571 | 571 | $log->info('\OC\Updater::dbSimulateUpgradeBefore: Checking whether the database schema can be updated (this can take a long time depending on the database size)', ['app' => 'updater']); |
572 | 572 | }); |
573 | - $this->listen('\OC\Updater', 'dbSimulateUpgrade', function () use($log) { |
|
573 | + $this->listen('\OC\Updater', 'dbSimulateUpgrade', function() use($log) { |
|
574 | 574 | $log->info('\OC\Updater::dbSimulateUpgrade: Checked database schema update', ['app' => 'updater']); |
575 | 575 | }); |
576 | - $this->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use($log) { |
|
577 | - $log->info('\OC\Updater::incompatibleAppDisabled: Disabled incompatible app: ' . $app, ['app' => 'updater']); |
|
576 | + $this->listen('\OC\Updater', 'incompatibleAppDisabled', function($app) use($log) { |
|
577 | + $log->info('\OC\Updater::incompatibleAppDisabled: Disabled incompatible app: '.$app, ['app' => 'updater']); |
|
578 | 578 | }); |
579 | - $this->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use($log) { |
|
580 | - $log->info('\OC\Updater::checkAppStoreAppBefore: Checking for update of app "' . $app . '" in appstore', ['app' => 'updater']); |
|
579 | + $this->listen('\OC\Updater', 'checkAppStoreAppBefore', function($app) use($log) { |
|
580 | + $log->info('\OC\Updater::checkAppStoreAppBefore: Checking for update of app "'.$app.'" in appstore', ['app' => 'updater']); |
|
581 | 581 | }); |
582 | - $this->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use($log) { |
|
583 | - $log->info('\OC\Updater::upgradeAppStoreApp: Update app "' . $app . '" from appstore', ['app' => 'updater']); |
|
582 | + $this->listen('\OC\Updater', 'upgradeAppStoreApp', function($app) use($log) { |
|
583 | + $log->info('\OC\Updater::upgradeAppStoreApp: Update app "'.$app.'" from appstore', ['app' => 'updater']); |
|
584 | 584 | }); |
585 | - $this->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use($log) { |
|
586 | - $log->info('\OC\Updater::checkAppStoreApp: Checked for update of app "' . $app . '" in appstore', ['app' => 'updater']); |
|
585 | + $this->listen('\OC\Updater', 'checkAppStoreApp', function($app) use($log) { |
|
586 | + $log->info('\OC\Updater::checkAppStoreApp: Checked for update of app "'.$app.'" in appstore', ['app' => 'updater']); |
|
587 | 587 | }); |
588 | - $this->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($log) { |
|
588 | + $this->listen('\OC\Updater', 'appUpgradeCheckBefore', function() use ($log) { |
|
589 | 589 | $log->info('\OC\Updater::appUpgradeCheckBefore: Checking updates of apps', ['app' => 'updater']); |
590 | 590 | }); |
591 | - $this->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($log) { |
|
592 | - $log->info('\OC\Updater::appSimulateUpdate: Checking whether the database schema for <' . $app . '> can be updated (this can take a long time depending on the database size)', ['app' => 'updater']); |
|
591 | + $this->listen('\OC\Updater', 'appSimulateUpdate', function($app) use ($log) { |
|
592 | + $log->info('\OC\Updater::appSimulateUpdate: Checking whether the database schema for <'.$app.'> can be updated (this can take a long time depending on the database size)', ['app' => 'updater']); |
|
593 | 593 | }); |
594 | - $this->listen('\OC\Updater', 'appUpgradeCheck', function () use ($log) { |
|
594 | + $this->listen('\OC\Updater', 'appUpgradeCheck', function() use ($log) { |
|
595 | 595 | $log->info('\OC\Updater::appUpgradeCheck: Checked database schema update for apps', ['app' => 'updater']); |
596 | 596 | }); |
597 | - $this->listen('\OC\Updater', 'appUpgradeStarted', function ($app) use ($log) { |
|
598 | - $log->info('\OC\Updater::appUpgradeStarted: Updating <' . $app . '> ...', ['app' => 'updater']); |
|
597 | + $this->listen('\OC\Updater', 'appUpgradeStarted', function($app) use ($log) { |
|
598 | + $log->info('\OC\Updater::appUpgradeStarted: Updating <'.$app.'> ...', ['app' => 'updater']); |
|
599 | 599 | }); |
600 | - $this->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($log) { |
|
601 | - $log->info('\OC\Updater::appUpgrade: Updated <' . $app . '> to ' . $version, ['app' => 'updater']); |
|
600 | + $this->listen('\OC\Updater', 'appUpgrade', function($app, $version) use ($log) { |
|
601 | + $log->info('\OC\Updater::appUpgrade: Updated <'.$app.'> to '.$version, ['app' => 'updater']); |
|
602 | 602 | }); |
603 | - $this->listen('\OC\Updater', 'failure', function ($message) use($log) { |
|
604 | - $log->error('\OC\Updater::failure: ' . $message, ['app' => 'updater']); |
|
603 | + $this->listen('\OC\Updater', 'failure', function($message) use($log) { |
|
604 | + $log->error('\OC\Updater::failure: '.$message, ['app' => 'updater']); |
|
605 | 605 | }); |
606 | - $this->listen('\OC\Updater', 'setDebugLogLevel', function () use($log) { |
|
606 | + $this->listen('\OC\Updater', 'setDebugLogLevel', function() use($log) { |
|
607 | 607 | $log->info('\OC\Updater::setDebugLogLevel: Set log level to debug', ['app' => 'updater']); |
608 | 608 | }); |
609 | - $this->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use($log) { |
|
610 | - $log->info('\OC\Updater::resetLogLevel: Reset log level to ' . $logLevelName . '(' . $logLevel . ')', ['app' => 'updater']); |
|
609 | + $this->listen('\OC\Updater', 'resetLogLevel', function($logLevel, $logLevelName) use($log) { |
|
610 | + $log->info('\OC\Updater::resetLogLevel: Reset log level to '.$logLevelName.'('.$logLevel.')', ['app' => 'updater']); |
|
611 | 611 | }); |
612 | - $this->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use($log) { |
|
612 | + $this->listen('\OC\Updater', 'startCheckCodeIntegrity', function() use($log) { |
|
613 | 613 | $log->info('\OC\Updater::startCheckCodeIntegrity: Starting code integrity check...', ['app' => 'updater']); |
614 | 614 | }); |
615 | - $this->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use($log) { |
|
615 | + $this->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function() use($log) { |
|
616 | 616 | $log->info('\OC\Updater::finishedCheckCodeIntegrity: Finished code integrity check', ['app' => 'updater']); |
617 | 617 | }); |
618 | 618 |