@@ -143,14 +143,14 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | $updateCount = count($this->getAppsWithUpdates()); |
| 145 | 145 | $formattedCategories = [ |
| 146 | - ['id' => self::CAT_ALL_INSTALLED, 'ident' => 'installed', 'displayName' => (string)$this->l10n->t('Your apps')], |
|
| 147 | - ['id' => self::CAT_UPDATES, 'ident' => 'updates', 'displayName' => (string)$this->l10n->t('Updates'), 'counter' => $updateCount], |
|
| 148 | - ['id' => self::CAT_ENABLED, 'ident' => 'enabled', 'displayName' => (string)$this->l10n->t('Enabled apps')], |
|
| 149 | - ['id' => self::CAT_DISABLED, 'ident' => 'disabled', 'displayName' => (string)$this->l10n->t('Disabled apps')], |
|
| 150 | - ['id' => self::CAT_APP_BUNDLES, 'ident' => 'app-bundles', 'displayName' => (string)$this->l10n->t('App bundles')], |
|
| 146 | + ['id' => self::CAT_ALL_INSTALLED, 'ident' => 'installed', 'displayName' => (string) $this->l10n->t('Your apps')], |
|
| 147 | + ['id' => self::CAT_UPDATES, 'ident' => 'updates', 'displayName' => (string) $this->l10n->t('Updates'), 'counter' => $updateCount], |
|
| 148 | + ['id' => self::CAT_ENABLED, 'ident' => 'enabled', 'displayName' => (string) $this->l10n->t('Enabled apps')], |
|
| 149 | + ['id' => self::CAT_DISABLED, 'ident' => 'disabled', 'displayName' => (string) $this->l10n->t('Disabled apps')], |
|
| 150 | + ['id' => self::CAT_APP_BUNDLES, 'ident' => 'app-bundles', 'displayName' => (string) $this->l10n->t('App bundles')], |
|
| 151 | 151 | ]; |
| 152 | 152 | $categories = $this->categoryFetcher->get(); |
| 153 | - foreach($categories as $category) { |
|
| 153 | + foreach ($categories as $category) { |
|
| 154 | 154 | $formattedCategories[] = [ |
| 155 | 155 | 'id' => $category['id'], |
| 156 | 156 | 'ident' => $category['id'], |
@@ -180,46 +180,46 @@ discard block |
||
| 180 | 180 | $versionParser = new VersionParser(); |
| 181 | 181 | $formattedApps = []; |
| 182 | 182 | $apps = $this->appFetcher->get(); |
| 183 | - foreach($apps as $app) { |
|
| 183 | + foreach ($apps as $app) { |
|
| 184 | 184 | if (isset($app['isFeatured'])) { |
| 185 | 185 | $app['featured'] = $app['isFeatured']; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | // Skip all apps not in the requested category |
| 189 | 189 | $isInCategory = false; |
| 190 | - foreach($app['categories'] as $category) { |
|
| 191 | - if($category === $requestedCategory) { |
|
| 190 | + foreach ($app['categories'] as $category) { |
|
| 191 | + if ($category === $requestedCategory) { |
|
| 192 | 192 | $isInCategory = true; |
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | - if(!$isInCategory) { |
|
| 195 | + if (!$isInCategory) { |
|
| 196 | 196 | continue; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | $nextCloudVersion = $versionParser->getVersion($app['releases'][0]['rawPlatformVersionSpec']); |
| 200 | 200 | $nextCloudVersionDependencies = []; |
| 201 | - if($nextCloudVersion->getMinimumVersion() !== '') { |
|
| 201 | + if ($nextCloudVersion->getMinimumVersion() !== '') { |
|
| 202 | 202 | $nextCloudVersionDependencies['nextcloud']['@attributes']['min-version'] = $nextCloudVersion->getMinimumVersion(); |
| 203 | 203 | } |
| 204 | - if($nextCloudVersion->getMaximumVersion() !== '') { |
|
| 204 | + if ($nextCloudVersion->getMaximumVersion() !== '') { |
|
| 205 | 205 | $nextCloudVersionDependencies['nextcloud']['@attributes']['max-version'] = $nextCloudVersion->getMaximumVersion(); |
| 206 | 206 | } |
| 207 | 207 | $phpVersion = $versionParser->getVersion($app['releases'][0]['rawPhpVersionSpec']); |
| 208 | 208 | $existsLocally = (\OC_App::getAppPath($app['id']) !== false) ? true : false; |
| 209 | 209 | $phpDependencies = []; |
| 210 | - if($phpVersion->getMinimumVersion() !== '') { |
|
| 210 | + if ($phpVersion->getMinimumVersion() !== '') { |
|
| 211 | 211 | $phpDependencies['php']['@attributes']['min-version'] = $phpVersion->getMinimumVersion(); |
| 212 | 212 | } |
| 213 | - if($phpVersion->getMaximumVersion() !== '') { |
|
| 213 | + if ($phpVersion->getMaximumVersion() !== '') { |
|
| 214 | 214 | $phpDependencies['php']['@attributes']['max-version'] = $phpVersion->getMaximumVersion(); |
| 215 | 215 | } |
| 216 | - if(isset($app['releases'][0]['minIntSize'])) { |
|
| 216 | + if (isset($app['releases'][0]['minIntSize'])) { |
|
| 217 | 217 | $phpDependencies['php']['@attributes']['min-int-size'] = $app['releases'][0]['minIntSize']; |
| 218 | 218 | } |
| 219 | 219 | $authors = ''; |
| 220 | - foreach($app['authors'] as $key => $author) { |
|
| 220 | + foreach ($app['authors'] as $key => $author) { |
|
| 221 | 221 | $authors .= $author['name']; |
| 222 | - if($key !== count($app['authors']) - 1) { |
|
| 222 | + if ($key !== count($app['authors']) - 1) { |
|
| 223 | 223 | $authors .= ', '; |
| 224 | 224 | } |
| 225 | 225 | } |
@@ -227,12 +227,12 @@ discard block |
||
| 227 | 227 | $currentLanguage = substr(\OC::$server->getL10NFactory()->findLanguage(), 0, 2); |
| 228 | 228 | $enabledValue = $this->config->getAppValue($app['id'], 'enabled', 'no'); |
| 229 | 229 | $groups = null; |
| 230 | - if($enabledValue !== 'no' && $enabledValue !== 'yes') { |
|
| 230 | + if ($enabledValue !== 'no' && $enabledValue !== 'yes') { |
|
| 231 | 231 | $groups = $enabledValue; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | $currentVersion = ''; |
| 235 | - if($this->appManager->isInstalled($app['id'])) { |
|
| 235 | + if ($this->appManager->isInstalled($app['id'])) { |
|
| 236 | 236 | $currentVersion = \OC_App::getAppVersion($app['id']); |
| 237 | 237 | } else { |
| 238 | 238 | $currentLanguage = $app['releases'][0]['version']; |
@@ -277,8 +277,8 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | |
| 279 | 279 | $newVersion = $this->installer->isUpdateAvailable($app['id']); |
| 280 | - if($newVersion && $this->appManager->isInstalled($app['id'])) { |
|
| 281 | - $formattedApps[count($formattedApps)-1]['update'] = $newVersion; |
|
| 280 | + if ($newVersion && $this->appManager->isInstalled($app['id'])) { |
|
| 281 | + $formattedApps[count($formattedApps) - 1]['update'] = $newVersion; |
|
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | |
@@ -288,17 +288,17 @@ discard block |
||
| 288 | 288 | private function getAppsWithUpdates() { |
| 289 | 289 | $appClass = new \OC_App(); |
| 290 | 290 | $apps = $appClass->listAllApps(); |
| 291 | - foreach($apps as $key => $app) { |
|
| 291 | + foreach ($apps as $key => $app) { |
|
| 292 | 292 | $newVersion = $this->installer->isUpdateAvailable($app['id']); |
| 293 | - if($newVersion !== false) { |
|
| 293 | + if ($newVersion !== false) { |
|
| 294 | 294 | $apps[$key]['update'] = $newVersion; |
| 295 | 295 | } else { |
| 296 | 296 | unset($apps[$key]); |
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | - usort($apps, function ($a, $b) { |
|
| 300 | - $a = (string)$a['name']; |
|
| 301 | - $b = (string)$b['name']; |
|
| 299 | + usort($apps, function($a, $b) { |
|
| 300 | + $a = (string) $a['name']; |
|
| 301 | + $b = (string) $b['name']; |
|
| 302 | 302 | if ($a === $b) { |
| 303 | 303 | return 0; |
| 304 | 304 | } |
@@ -321,14 +321,14 @@ discard block |
||
| 321 | 321 | case 'installed': |
| 322 | 322 | $apps = $appClass->listAllApps(); |
| 323 | 323 | |
| 324 | - foreach($apps as $key => $app) { |
|
| 324 | + foreach ($apps as $key => $app) { |
|
| 325 | 325 | $newVersion = $this->installer->isUpdateAvailable($app['id']); |
| 326 | 326 | $apps[$key]['update'] = $newVersion; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - usort($apps, function ($a, $b) { |
|
| 330 | - $a = (string)$a['name']; |
|
| 331 | - $b = (string)$b['name']; |
|
| 329 | + usort($apps, function($a, $b) { |
|
| 330 | + $a = (string) $a['name']; |
|
| 331 | + $b = (string) $b['name']; |
|
| 332 | 332 | if ($a === $b) { |
| 333 | 333 | return 0; |
| 334 | 334 | } |
@@ -342,18 +342,18 @@ discard block |
||
| 342 | 342 | // enabled apps |
| 343 | 343 | case 'enabled': |
| 344 | 344 | $apps = $appClass->listAllApps(); |
| 345 | - $apps = array_filter($apps, function ($app) { |
|
| 345 | + $apps = array_filter($apps, function($app) { |
|
| 346 | 346 | return $app['active']; |
| 347 | 347 | }); |
| 348 | 348 | |
| 349 | - foreach($apps as $key => $app) { |
|
| 349 | + foreach ($apps as $key => $app) { |
|
| 350 | 350 | $newVersion = $this->installer->isUpdateAvailable($app['id']); |
| 351 | 351 | $apps[$key]['update'] = $newVersion; |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | - usort($apps, function ($a, $b) { |
|
| 355 | - $a = (string)$a['name']; |
|
| 356 | - $b = (string)$b['name']; |
|
| 354 | + usort($apps, function($a, $b) { |
|
| 355 | + $a = (string) $a['name']; |
|
| 356 | + $b = (string) $b['name']; |
|
| 357 | 357 | if ($a === $b) { |
| 358 | 358 | return 0; |
| 359 | 359 | } |
@@ -363,11 +363,11 @@ discard block |
||
| 363 | 363 | // disabled apps |
| 364 | 364 | case 'disabled': |
| 365 | 365 | $apps = $appClass->listAllApps(); |
| 366 | - $apps = array_filter($apps, function ($app) { |
|
| 366 | + $apps = array_filter($apps, function($app) { |
|
| 367 | 367 | return !$app['active']; |
| 368 | 368 | }); |
| 369 | 369 | |
| 370 | - $apps = array_map(function ($app) { |
|
| 370 | + $apps = array_map(function($app) { |
|
| 371 | 371 | $newVersion = $this->installer->isUpdateAvailable($app['id']); |
| 372 | 372 | if ($newVersion !== false) { |
| 373 | 373 | $app['update'] = $newVersion; |
@@ -375,9 +375,9 @@ discard block |
||
| 375 | 375 | return $app; |
| 376 | 376 | }, $apps); |
| 377 | 377 | |
| 378 | - usort($apps, function ($a, $b) { |
|
| 379 | - $a = (string)$a['name']; |
|
| 380 | - $b = (string)$b['name']; |
|
| 378 | + usort($apps, function($a, $b) { |
|
| 379 | + $a = (string) $a['name']; |
|
| 380 | + $b = (string) $b['name']; |
|
| 381 | 381 | if ($a === $b) { |
| 382 | 382 | return 0; |
| 383 | 383 | } |
@@ -387,15 +387,15 @@ discard block |
||
| 387 | 387 | case 'app-bundles': |
| 388 | 388 | $bundles = $this->bundleFetcher->getBundles(); |
| 389 | 389 | $apps = []; |
| 390 | - foreach($bundles as $bundle) { |
|
| 390 | + foreach ($bundles as $bundle) { |
|
| 391 | 391 | $newCategory = true; |
| 392 | 392 | $allApps = $appClass->listAllApps(); |
| 393 | 393 | $categories = $this->getAllCategories(); |
| 394 | - foreach($categories as $singleCategory) { |
|
| 394 | + foreach ($categories as $singleCategory) { |
|
| 395 | 395 | $newApps = $this->getAppsForCategory($singleCategory['id']); |
| 396 | - foreach($allApps as $app) { |
|
| 397 | - foreach($newApps as $key => $newApp) { |
|
| 398 | - if($app['id'] === $newApp['id']) { |
|
| 396 | + foreach ($allApps as $app) { |
|
| 397 | + foreach ($newApps as $key => $newApp) { |
|
| 398 | + if ($app['id'] === $newApp['id']) { |
|
| 399 | 399 | unset($newApps[$key]); |
| 400 | 400 | } |
| 401 | 401 | } |
@@ -403,10 +403,10 @@ discard block |
||
| 403 | 403 | $allApps = array_merge($allApps, $newApps); |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - foreach($bundle->getAppIdentifiers() as $identifier) { |
|
| 407 | - foreach($allApps as $app) { |
|
| 408 | - if($app['id'] === $identifier) { |
|
| 409 | - if($newCategory) { |
|
| 406 | + foreach ($bundle->getAppIdentifiers() as $identifier) { |
|
| 407 | + foreach ($allApps as $app) { |
|
| 408 | + if ($app['id'] === $identifier) { |
|
| 409 | + if ($newCategory) { |
|
| 410 | 410 | $app['newCategory'] = true; |
| 411 | 411 | $app['categoryName'] = $bundle->getName(); |
| 412 | 412 | } |
@@ -423,9 +423,9 @@ discard block |
||
| 423 | 423 | $apps = $this->getAppsForCategory($category); |
| 424 | 424 | |
| 425 | 425 | // sort by score |
| 426 | - usort($apps, function ($a, $b) { |
|
| 427 | - $a = (int)$a['score']; |
|
| 428 | - $b = (int)$b['score']; |
|
| 426 | + usort($apps, function($a, $b) { |
|
| 427 | + $a = (int) $a['score']; |
|
| 428 | + $b = (int) $b['score']; |
|
| 429 | 429 | if ($a === $b) { |
| 430 | 430 | return 0; |
| 431 | 431 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $appId = $input->getArgument('app-id'); |
| 47 | 47 | |
| 48 | 48 | if (\OC_App::getAppPath($appId)) { |
| 49 | - $output->writeln($appId . ' already installed'); |
|
| 49 | + $output->writeln($appId.' already installed'); |
|
| 50 | 50 | return 1; |
| 51 | 51 | } |
| 52 | 52 | |
@@ -54,17 +54,17 @@ discard block |
||
| 54 | 54 | $installer = \OC::$server->query(Installer::class); |
| 55 | 55 | $installer->downloadApp($appId); |
| 56 | 56 | $result = $installer->installApp($appId); |
| 57 | - } catch(\Exception $e) { |
|
| 58 | - $output->writeln('Error: ' . $e->getMessage()); |
|
| 57 | + } catch (\Exception $e) { |
|
| 58 | + $output->writeln('Error: '.$e->getMessage()); |
|
| 59 | 59 | return 1; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if($result === false) { |
|
| 63 | - $output->writeln($appId . ' couldn\'t be installed'); |
|
| 62 | + if ($result === false) { |
|
| 63 | + $output->writeln($appId.' couldn\'t be installed'); |
|
| 64 | 64 | return 1; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $output->writeln($appId . ' installed'); |
|
| 67 | + $output->writeln($appId.' installed'); |
|
| 68 | 68 | |
| 69 | 69 | return 0; |
| 70 | 70 | } |
@@ -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 | } |
@@ -140,15 +140,15 @@ discard block |
||
| 140 | 140 | public static function loadApp($app) { |
| 141 | 141 | self::$loadedApps[] = $app; |
| 142 | 142 | $appPath = self::getAppPath($app); |
| 143 | - if($appPath === false) { |
|
| 143 | + if ($appPath === false) { |
|
| 144 | 144 | return; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // in case someone calls loadApp() directly |
| 148 | 148 | self::registerAutoloading($app, $appPath); |
| 149 | 149 | |
| 150 | - if (is_file($appPath . '/appinfo/app.php')) { |
|
| 151 | - \OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app); |
|
| 150 | + if (is_file($appPath.'/appinfo/app.php')) { |
|
| 151 | + \OC::$server->getEventLogger()->start('load_app_'.$app, 'Load app: '.$app); |
|
| 152 | 152 | self::requireAppFile($app); |
| 153 | 153 | if (self::isType($app, array('authentication'))) { |
| 154 | 154 | // since authentication apps affect the "is app enabled for group" check, |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | // enabled for groups |
| 158 | 158 | self::$enabledAppsCache = array(); |
| 159 | 159 | } |
| 160 | - \OC::$server->getEventLogger()->end('load_app_' . $app); |
|
| 160 | + \OC::$server->getEventLogger()->end('load_app_'.$app); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | $info = self::getAppInfo($app); |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $plugins = isset($info['collaboration']['plugins']['plugin']['@value']) ? |
| 182 | 182 | [$info['collaboration']['plugins']['plugin']] : $info['collaboration']['plugins']['plugin']; |
| 183 | 183 | foreach ($plugins as $plugin) { |
| 184 | - if($plugin['@attributes']['type'] === 'collaborator-search') { |
|
| 184 | + if ($plugin['@attributes']['type'] === 'collaborator-search') { |
|
| 185 | 185 | $pluginInfo = [ |
| 186 | 186 | 'shareType' => $plugin['@attributes']['share-type'], |
| 187 | 187 | 'class' => $plugin['@value'], |
@@ -200,8 +200,8 @@ discard block |
||
| 200 | 200 | * @param string $path |
| 201 | 201 | */ |
| 202 | 202 | public static function registerAutoloading($app, $path) { |
| 203 | - $key = $app . '-' . $path; |
|
| 204 | - if(isset(self::$alreadyRegistered[$key])) { |
|
| 203 | + $key = $app.'-'.$path; |
|
| 204 | + if (isset(self::$alreadyRegistered[$key])) { |
|
| 205 | 205 | return; |
| 206 | 206 | } |
| 207 | 207 | |
@@ -211,17 +211,17 @@ discard block |
||
| 211 | 211 | $appNamespace = \OC\AppFramework\App::buildAppNamespace($app); |
| 212 | 212 | \OC::$server->registerNamespace($app, $appNamespace); |
| 213 | 213 | |
| 214 | - if (file_exists($path . '/composer/autoload.php')) { |
|
| 215 | - require_once $path . '/composer/autoload.php'; |
|
| 214 | + if (file_exists($path.'/composer/autoload.php')) { |
|
| 215 | + require_once $path.'/composer/autoload.php'; |
|
| 216 | 216 | } else { |
| 217 | - \OC::$composerAutoloader->addPsr4($appNamespace . '\\', $path . '/lib/', true); |
|
| 217 | + \OC::$composerAutoloader->addPsr4($appNamespace.'\\', $path.'/lib/', true); |
|
| 218 | 218 | // Register on legacy autoloader |
| 219 | 219 | \OC::$loader->addValidRoot($path); |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | // Register Test namespace only when testing |
| 223 | 223 | if (defined('PHPUNIT_RUN') || defined('CLI_TEST_RUN')) { |
| 224 | - \OC::$composerAutoloader->addPsr4($appNamespace . '\\Tests\\', $path . '/tests/', true); |
|
| 224 | + \OC::$composerAutoloader->addPsr4($appNamespace.'\\Tests\\', $path.'/tests/', true); |
|
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | private static function requireAppFile($app) { |
| 234 | 234 | try { |
| 235 | 235 | // encapsulated here to avoid variable scope conflicts |
| 236 | - require_once $app . '/appinfo/app.php'; |
|
| 236 | + require_once $app.'/appinfo/app.php'; |
|
| 237 | 237 | } catch (Error $ex) { |
| 238 | 238 | \OC::$server->getLogger()->logException($ex); |
| 239 | 239 | $blacklist = \OC::$server->getAppManager()->getAlwaysEnabledApps(); |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | */ |
| 288 | 288 | public static function setAppTypes($app) { |
| 289 | 289 | $appData = self::getAppInfo($app); |
| 290 | - if(!is_array($appData)) { |
|
| 290 | + if (!is_array($appData)) { |
|
| 291 | 291 | return; |
| 292 | 292 | } |
| 293 | 293 | |
@@ -339,8 +339,8 @@ discard block |
||
| 339 | 339 | } else { |
| 340 | 340 | $apps = $appManager->getEnabledAppsForUser($user); |
| 341 | 341 | } |
| 342 | - $apps = array_filter($apps, function ($app) { |
|
| 343 | - return $app !== 'files';//we add this manually |
|
| 342 | + $apps = array_filter($apps, function($app) { |
|
| 343 | + return $app !== 'files'; //we add this manually |
|
| 344 | 344 | }); |
| 345 | 345 | sort($apps); |
| 346 | 346 | array_unshift($apps, 'files'); |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | $installer = \OC::$server->query(Installer::class); |
| 379 | 379 | $isDownloaded = $installer->isDownloaded($appId); |
| 380 | 380 | |
| 381 | - if(!$isDownloaded) { |
|
| 381 | + if (!$isDownloaded) { |
|
| 382 | 382 | $installer->downloadApp($appId); |
| 383 | 383 | } |
| 384 | 384 | |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | */ |
| 492 | 492 | public static function findAppInDirectories($appId) { |
| 493 | 493 | $sanitizedAppId = self::cleanAppId($appId); |
| 494 | - if($sanitizedAppId !== $appId) { |
|
| 494 | + if ($sanitizedAppId !== $appId) { |
|
| 495 | 495 | return false; |
| 496 | 496 | } |
| 497 | 497 | static $app_dir = array(); |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | |
| 503 | 503 | $possibleApps = array(); |
| 504 | 504 | foreach (OC::$APPSROOTS as $dir) { |
| 505 | - if (file_exists($dir['path'] . '/' . $appId)) { |
|
| 505 | + if (file_exists($dir['path'].'/'.$appId)) { |
|
| 506 | 506 | $possibleApps[] = $dir; |
| 507 | 507 | } |
| 508 | 508 | } |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | if (($dir = self::findAppInDirectories($appId)) != false) { |
| 546 | - return $dir['path'] . '/' . $appId; |
|
| 546 | + return $dir['path'].'/'.$appId; |
|
| 547 | 547 | } |
| 548 | 548 | return false; |
| 549 | 549 | } |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | */ |
| 558 | 558 | public static function getAppWebPath($appId) { |
| 559 | 559 | if (($dir = self::findAppInDirectories($appId)) != false) { |
| 560 | - return OC::$WEBROOT . $dir['url'] . '/' . $appId; |
|
| 560 | + return OC::$WEBROOT.$dir['url'].'/'.$appId; |
|
| 561 | 561 | } |
| 562 | 562 | return false; |
| 563 | 563 | } |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | * @return string |
| 571 | 571 | */ |
| 572 | 572 | public static function getAppVersion($appId, $useCache = true) { |
| 573 | - if($useCache && isset(self::$appVersion[$appId])) { |
|
| 573 | + if ($useCache && isset(self::$appVersion[$appId])) { |
|
| 574 | 574 | return self::$appVersion[$appId]; |
| 575 | 575 | } |
| 576 | 576 | |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | * @return string |
| 587 | 587 | */ |
| 588 | 588 | public static function getAppVersionByPath($path) { |
| 589 | - $infoFile = $path . '/appinfo/info.xml'; |
|
| 589 | + $infoFile = $path.'/appinfo/info.xml'; |
|
| 590 | 590 | $appData = self::getAppInfo($infoFile, true); |
| 591 | 591 | return isset($appData['version']) ? $appData['version'] : ''; |
| 592 | 592 | } |
@@ -609,10 +609,10 @@ discard block |
||
| 609 | 609 | return self::$appInfo[$appId]; |
| 610 | 610 | } |
| 611 | 611 | $appPath = self::getAppPath($appId); |
| 612 | - if($appPath === false) { |
|
| 612 | + if ($appPath === false) { |
|
| 613 | 613 | return null; |
| 614 | 614 | } |
| 615 | - $file = $appPath . '/appinfo/info.xml'; |
|
| 615 | + $file = $appPath.'/appinfo/info.xml'; |
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | $parser = new InfoParser(\OC::$server->getMemCacheFactory()->createLocal('core.appinfo')); |
@@ -621,9 +621,9 @@ discard block |
||
| 621 | 621 | if (is_array($data)) { |
| 622 | 622 | $data = OC_App::parseAppInfo($data, $lang); |
| 623 | 623 | } |
| 624 | - if(isset($data['ocsid'])) { |
|
| 624 | + if (isset($data['ocsid'])) { |
|
| 625 | 625 | $storedId = \OC::$server->getConfig()->getAppValue($appId, 'ocsid'); |
| 626 | - if($storedId !== '' && $storedId !== $data['ocsid']) { |
|
| 626 | + if ($storedId !== '' && $storedId !== $data['ocsid']) { |
|
| 627 | 627 | $data['ocsid'] = $storedId; |
| 628 | 628 | } |
| 629 | 629 | } |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | * @param string $page |
| 716 | 716 | */ |
| 717 | 717 | public static function registerAdmin($app, $page) { |
| 718 | - self::$adminForms[] = $app . '/' . $page . '.php'; |
|
| 718 | + self::$adminForms[] = $app.'/'.$page.'.php'; |
|
| 719 | 719 | } |
| 720 | 720 | |
| 721 | 721 | /** |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | * @param string $page |
| 725 | 725 | */ |
| 726 | 726 | public static function registerPersonal($app, $page) { |
| 727 | - self::$personalForms[] = $app . '/' . $page . '.php'; |
|
| 727 | + self::$personalForms[] = $app.'/'.$page.'.php'; |
|
| 728 | 728 | } |
| 729 | 729 | |
| 730 | 730 | /** |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | |
| 754 | 754 | foreach (OC::$APPSROOTS as $apps_dir) { |
| 755 | 755 | if (!is_readable($apps_dir['path'])) { |
| 756 | - \OCP\Util::writeLog('core', 'unable to read app folder : ' . $apps_dir['path'], \OCP\Util::WARN); |
|
| 756 | + \OCP\Util::writeLog('core', 'unable to read app folder : '.$apps_dir['path'], \OCP\Util::WARN); |
|
| 757 | 757 | continue; |
| 758 | 758 | } |
| 759 | 759 | $dh = opendir($apps_dir['path']); |
@@ -761,7 +761,7 @@ discard block |
||
| 761 | 761 | if (is_resource($dh)) { |
| 762 | 762 | while (($file = readdir($dh)) !== false) { |
| 763 | 763 | |
| 764 | - if ($file[0] != '.' and is_dir($apps_dir['path'] . '/' . $file) and is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml')) { |
|
| 764 | + if ($file[0] != '.' and is_dir($apps_dir['path'].'/'.$file) and is_file($apps_dir['path'].'/'.$file.'/appinfo/info.xml')) { |
|
| 765 | 765 | |
| 766 | 766 | $apps[] = $file; |
| 767 | 767 | } |
@@ -794,12 +794,12 @@ discard block |
||
| 794 | 794 | |
| 795 | 795 | $info = OC_App::getAppInfo($app, false, $langCode); |
| 796 | 796 | if (!is_array($info)) { |
| 797 | - \OCP\Util::writeLog('core', 'Could not read app info file for app "' . $app . '"', \OCP\Util::ERROR); |
|
| 797 | + \OCP\Util::writeLog('core', 'Could not read app info file for app "'.$app.'"', \OCP\Util::ERROR); |
|
| 798 | 798 | continue; |
| 799 | 799 | } |
| 800 | 800 | |
| 801 | 801 | if (!isset($info['name'])) { |
| 802 | - \OCP\Util::writeLog('core', 'App id "' . $app . '" has no name in appinfo', \OCP\Util::ERROR); |
|
| 802 | + \OCP\Util::writeLog('core', 'App id "'.$app.'" has no name in appinfo', \OCP\Util::ERROR); |
|
| 803 | 803 | continue; |
| 804 | 804 | } |
| 805 | 805 | |
@@ -826,13 +826,13 @@ discard block |
||
| 826 | 826 | } |
| 827 | 827 | |
| 828 | 828 | $appPath = self::getAppPath($app); |
| 829 | - if($appPath !== false) { |
|
| 830 | - $appIcon = $appPath . '/img/' . $app . '.svg'; |
|
| 829 | + if ($appPath !== false) { |
|
| 830 | + $appIcon = $appPath.'/img/'.$app.'.svg'; |
|
| 831 | 831 | if (file_exists($appIcon)) { |
| 832 | - $info['preview'] = $urlGenerator->imagePath($app, $app . '.svg'); |
|
| 832 | + $info['preview'] = $urlGenerator->imagePath($app, $app.'.svg'); |
|
| 833 | 833 | $info['previewAsIcon'] = true; |
| 834 | 834 | } else { |
| 835 | - $appIcon = $appPath . '/img/app.svg'; |
|
| 835 | + $appIcon = $appPath.'/img/app.svg'; |
|
| 836 | 836 | if (file_exists($appIcon)) { |
| 837 | 837 | $info['preview'] = $urlGenerator->imagePath($app, 'app.svg'); |
| 838 | 838 | $info['previewAsIcon'] = true; |
@@ -957,7 +957,7 @@ discard block |
||
| 957 | 957 | public static function getAppVersions() { |
| 958 | 958 | static $versions; |
| 959 | 959 | |
| 960 | - if(!$versions) { |
|
| 960 | + if (!$versions) { |
|
| 961 | 961 | $appConfig = \OC::$server->getAppConfig(); |
| 962 | 962 | $versions = $appConfig->getValues(false, 'installed_version'); |
| 963 | 963 | } |
@@ -979,7 +979,7 @@ discard block |
||
| 979 | 979 | if ($app !== false) { |
| 980 | 980 | // check if the app is compatible with this version of ownCloud |
| 981 | 981 | $info = self::getAppInfo($app); |
| 982 | - if(!is_array($info)) { |
|
| 982 | + if (!is_array($info)) { |
|
| 983 | 983 | throw new \Exception( |
| 984 | 984 | $l->t('App "%s" cannot be installed because appinfo file cannot be read.', |
| 985 | 985 | [$info['name']] |
@@ -1004,7 +1004,7 @@ discard block |
||
| 1004 | 1004 | $config->setAppValue($app, 'ocsid', $appData['id']); |
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | - if(isset($info['settings']) && is_array($info['settings'])) { |
|
| 1007 | + if (isset($info['settings']) && is_array($info['settings'])) { |
|
| 1008 | 1008 | $appPath = self::getAppPath($app); |
| 1009 | 1009 | self::registerAutoloading($app, $appPath); |
| 1010 | 1010 | \OC::$server->getSettingsManager()->setupSettings($info['settings']); |
@@ -1012,7 +1012,7 @@ discard block |
||
| 1012 | 1012 | |
| 1013 | 1013 | \OC_Hook::emit('OC_App', 'post_enable', array('app' => $app)); |
| 1014 | 1014 | } else { |
| 1015 | - if(empty($appName) ) { |
|
| 1015 | + if (empty($appName)) { |
|
| 1016 | 1016 | throw new \Exception($l->t("No app name specified")); |
| 1017 | 1017 | } else { |
| 1018 | 1018 | throw new \Exception($l->t("App '%s' could not be installed!", $appName)); |
@@ -1030,7 +1030,7 @@ discard block |
||
| 1030 | 1030 | */ |
| 1031 | 1031 | public static function updateApp($appId) { |
| 1032 | 1032 | $appPath = self::getAppPath($appId); |
| 1033 | - if($appPath === false) { |
|
| 1033 | + if ($appPath === false) { |
|
| 1034 | 1034 | return false; |
| 1035 | 1035 | } |
| 1036 | 1036 | self::registerAutoloading($appId, $appPath); |
@@ -1038,8 +1038,8 @@ discard block |
||
| 1038 | 1038 | $appData = self::getAppInfo($appId); |
| 1039 | 1039 | self::executeRepairSteps($appId, $appData['repair-steps']['pre-migration']); |
| 1040 | 1040 | |
| 1041 | - if (file_exists($appPath . '/appinfo/database.xml')) { |
|
| 1042 | - OC_DB::updateDbFromStructure($appPath . '/appinfo/database.xml'); |
|
| 1041 | + if (file_exists($appPath.'/appinfo/database.xml')) { |
|
| 1042 | + OC_DB::updateDbFromStructure($appPath.'/appinfo/database.xml'); |
|
| 1043 | 1043 | } else { |
| 1044 | 1044 | $ms = new MigrationService($appId, \OC::$server->getDatabaseConnection()); |
| 1045 | 1045 | $ms->migrate(); |
@@ -1050,26 +1050,26 @@ discard block |
||
| 1050 | 1050 | unset(self::$appVersion[$appId]); |
| 1051 | 1051 | |
| 1052 | 1052 | // run upgrade code |
| 1053 | - if (file_exists($appPath . '/appinfo/update.php')) { |
|
| 1053 | + if (file_exists($appPath.'/appinfo/update.php')) { |
|
| 1054 | 1054 | self::loadApp($appId); |
| 1055 | - include $appPath . '/appinfo/update.php'; |
|
| 1055 | + include $appPath.'/appinfo/update.php'; |
|
| 1056 | 1056 | } |
| 1057 | 1057 | self::setupBackgroundJobs($appData['background-jobs']); |
| 1058 | - if(isset($appData['settings']) && is_array($appData['settings'])) { |
|
| 1058 | + if (isset($appData['settings']) && is_array($appData['settings'])) { |
|
| 1059 | 1059 | \OC::$server->getSettingsManager()->setupSettings($appData['settings']); |
| 1060 | 1060 | } |
| 1061 | 1061 | |
| 1062 | 1062 | //set remote/public handlers |
| 1063 | 1063 | if (array_key_exists('ocsid', $appData)) { |
| 1064 | 1064 | \OC::$server->getConfig()->setAppValue($appId, 'ocsid', $appData['ocsid']); |
| 1065 | - } elseif(\OC::$server->getConfig()->getAppValue($appId, 'ocsid', null) !== null) { |
|
| 1065 | + } elseif (\OC::$server->getConfig()->getAppValue($appId, 'ocsid', null) !== null) { |
|
| 1066 | 1066 | \OC::$server->getConfig()->deleteAppValue($appId, 'ocsid'); |
| 1067 | 1067 | } |
| 1068 | 1068 | foreach ($appData['remote'] as $name => $path) { |
| 1069 | - \OC::$server->getConfig()->setAppValue('core', 'remote_' . $name, $appId . '/' . $path); |
|
| 1069 | + \OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $appId.'/'.$path); |
|
| 1070 | 1070 | } |
| 1071 | 1071 | foreach ($appData['public'] as $name => $path) { |
| 1072 | - \OC::$server->getConfig()->setAppValue('core', 'public_' . $name, $appId . '/' . $path); |
|
| 1072 | + \OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $appId.'/'.$path); |
|
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | self::setAppTypes($appId); |
@@ -1139,17 +1139,17 @@ discard block |
||
| 1139 | 1139 | public static function getStorage($appId) { |
| 1140 | 1140 | if (\OC::$server->getAppManager()->isEnabledForUser($appId)) { //sanity check |
| 1141 | 1141 | if (\OC::$server->getUserSession()->isLoggedIn()) { |
| 1142 | - $view = new \OC\Files\View('/' . OC_User::getUser()); |
|
| 1142 | + $view = new \OC\Files\View('/'.OC_User::getUser()); |
|
| 1143 | 1143 | if (!$view->file_exists($appId)) { |
| 1144 | 1144 | $view->mkdir($appId); |
| 1145 | 1145 | } |
| 1146 | - return new \OC\Files\View('/' . OC_User::getUser() . '/' . $appId); |
|
| 1146 | + return new \OC\Files\View('/'.OC_User::getUser().'/'.$appId); |
|
| 1147 | 1147 | } else { |
| 1148 | - \OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', \OCP\Util::ERROR); |
|
| 1148 | + \OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.', user not logged in', \OCP\Util::ERROR); |
|
| 1149 | 1149 | return false; |
| 1150 | 1150 | } |
| 1151 | 1151 | } else { |
| 1152 | - \OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', \OCP\Util::ERROR); |
|
| 1152 | + \OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.' not enabled', \OCP\Util::ERROR); |
|
| 1153 | 1153 | return false; |
| 1154 | 1154 | } |
| 1155 | 1155 | } |
@@ -1181,9 +1181,9 @@ discard block |
||
| 1181 | 1181 | |
| 1182 | 1182 | if ($attributeLang === $similarLang) { |
| 1183 | 1183 | $similarLangFallback = $option['@value']; |
| 1184 | - } else if (strpos($attributeLang, $similarLang . '_') === 0) { |
|
| 1184 | + } else if (strpos($attributeLang, $similarLang.'_') === 0) { |
|
| 1185 | 1185 | if ($similarLangFallback === false) { |
| 1186 | - $similarLangFallback = $option['@value']; |
|
| 1186 | + $similarLangFallback = $option['@value']; |
|
| 1187 | 1187 | } |
| 1188 | 1188 | } |
| 1189 | 1189 | } else { |
@@ -1218,7 +1218,7 @@ discard block |
||
| 1218 | 1218 | $data['description'] = trim(self::findBestL10NOption($data['description'], $lang)); |
| 1219 | 1219 | } else if (isset($data['description']) && is_string($data['description'])) { |
| 1220 | 1220 | $data['description'] = trim($data['description']); |
| 1221 | - } else { |
|
| 1221 | + } else { |
|
| 1222 | 1222 | $data['description'] = ''; |
| 1223 | 1223 | } |
| 1224 | 1224 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | // If at least PHP 7.0.0 is used we don't need to disable apps as we catch |
| 96 | 96 | // fatal errors and exceptions and disable the app just instead. |
| 97 | - if(version_compare(phpversion(), '7.0.0', '>=')) { |
|
| 97 | + if (version_compare(phpversion(), '7.0.0', '>=')) { |
|
| 98 | 98 | $this->skip3rdPartyAppsDisable = true; |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -120,43 +120,43 @@ discard block |
||
| 120 | 120 | $this->logAllEvents(); |
| 121 | 121 | |
| 122 | 122 | $logLevel = $this->config->getSystemValue('loglevel', Util::WARN); |
| 123 | - $this->emit('\OC\Updater', 'setDebugLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]); |
|
| 123 | + $this->emit('\OC\Updater', 'setDebugLogLevel', [$logLevel, $this->logLevelNames[$logLevel]]); |
|
| 124 | 124 | $this->config->setSystemValue('loglevel', Util::DEBUG); |
| 125 | 125 | |
| 126 | 126 | $wasMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false); |
| 127 | 127 | |
| 128 | - if(!$wasMaintenanceModeEnabled) { |
|
| 128 | + if (!$wasMaintenanceModeEnabled) { |
|
| 129 | 129 | $this->config->setSystemValue('maintenance', true); |
| 130 | 130 | $this->emit('\OC\Updater', 'maintenanceEnabled'); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | $installedVersion = $this->config->getSystemValue('version', '0.0.0'); |
| 134 | 134 | $currentVersion = implode('.', \OCP\Util::getVersion()); |
| 135 | - $this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, array('app' => 'core')); |
|
| 135 | + $this->log->debug('starting upgrade from '.$installedVersion.' to '.$currentVersion, array('app' => 'core')); |
|
| 136 | 136 | |
| 137 | 137 | $success = true; |
| 138 | 138 | try { |
| 139 | 139 | $this->doUpgrade($currentVersion, $installedVersion); |
| 140 | 140 | } catch (HintException $exception) { |
| 141 | 141 | $this->log->logException($exception, ['app' => 'core']); |
| 142 | - $this->emit('\OC\Updater', 'failure', array($exception->getMessage() . ': ' .$exception->getHint())); |
|
| 142 | + $this->emit('\OC\Updater', 'failure', array($exception->getMessage().': '.$exception->getHint())); |
|
| 143 | 143 | $success = false; |
| 144 | 144 | } catch (\Exception $exception) { |
| 145 | 145 | $this->log->logException($exception, ['app' => 'core']); |
| 146 | - $this->emit('\OC\Updater', 'failure', array(get_class($exception) . ': ' .$exception->getMessage())); |
|
| 146 | + $this->emit('\OC\Updater', 'failure', array(get_class($exception).': '.$exception->getMessage())); |
|
| 147 | 147 | $success = false; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | $this->emit('\OC\Updater', 'updateEnd', array($success)); |
| 151 | 151 | |
| 152 | - if(!$wasMaintenanceModeEnabled && $success) { |
|
| 152 | + if (!$wasMaintenanceModeEnabled && $success) { |
|
| 153 | 153 | $this->config->setSystemValue('maintenance', false); |
| 154 | 154 | $this->emit('\OC\Updater', 'maintenanceDisabled'); |
| 155 | 155 | } else { |
| 156 | 156 | $this->emit('\OC\Updater', 'maintenanceActive'); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - $this->emit('\OC\Updater', 'resetLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]); |
|
| 159 | + $this->emit('\OC\Updater', 'resetLogLevel', [$logLevel, $this->logLevelNames[$logLevel]]); |
|
| 160 | 160 | $this->config->setSystemValue('loglevel', $logLevel); |
| 161 | 161 | $this->config->setSystemValue('installed', true); |
| 162 | 162 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | private function getAllowedPreviousVersions() { |
| 172 | 172 | // this should really be a JSON file |
| 173 | - require \OC::$SERVERROOT . '/version.php'; |
|
| 173 | + require \OC::$SERVERROOT.'/version.php'; |
|
| 174 | 174 | /** @var array $OC_VersionCanBeUpgradedFrom */ |
| 175 | 175 | return $OC_VersionCanBeUpgradedFrom; |
| 176 | 176 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | private function getVendor() { |
| 184 | 184 | // this should really be a JSON file |
| 185 | - require \OC::$SERVERROOT . '/version.php'; |
|
| 185 | + require \OC::$SERVERROOT.'/version.php'; |
|
| 186 | 186 | /** @var string $vendor */ |
| 187 | 187 | return (string) $vendor; |
| 188 | 188 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | public function isUpgradePossible($oldVersion, $newVersion, array $allowedPreviousVersions) { |
| 198 | 198 | $version = explode('.', $oldVersion); |
| 199 | - $majorMinor = $version[0] . '.' . $version[1]; |
|
| 199 | + $majorMinor = $version[0].'.'.$version[1]; |
|
| 200 | 200 | |
| 201 | 201 | $currentVendor = $this->config->getAppValue('core', 'vendor', ''); |
| 202 | 202 | |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | // create empty file in data dir, so we can later find |
| 252 | 252 | // out that this is indeed an ownCloud data directory |
| 253 | 253 | // (in case it didn't exist before) |
| 254 | - file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', ''); |
|
| 254 | + file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/.ocdata', ''); |
|
| 255 | 255 | |
| 256 | 256 | // pre-upgrade repairs |
| 257 | 257 | $repair = new Repair(Repair::getBeforeUpgradeRepairSteps(), \OC::$server->getEventDispatcher()); |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | foreach ($errors as $appId => $exception) { |
| 283 | 283 | /** @var \Exception $exception */ |
| 284 | 284 | $this->log->logException($exception, ['app' => $appId]); |
| 285 | - $this->emit('\OC\Updater', 'failure', [$appId . ': ' . $exception->getMessage()]); |
|
| 285 | + $this->emit('\OC\Updater', 'failure', [$appId.': '.$exception->getMessage()]); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | // post-upgrade repairs |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | $this->config->setAppValue('core', 'lastupdatedat', 0); |
| 294 | 294 | |
| 295 | 295 | // Check for code integrity if not disabled |
| 296 | - if(\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) { |
|
| 296 | + if (\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) { |
|
| 297 | 297 | $this->emit('\OC\Updater', 'startCheckCodeIntegrity'); |
| 298 | 298 | $this->checker->runInstanceVerification(); |
| 299 | 299 | $this->emit('\OC\Updater', 'finishedCheckCodeIntegrity'); |
@@ -334,12 +334,12 @@ discard block |
||
| 334 | 334 | * @link https://github.com/owncloud/core/issues/10980 |
| 335 | 335 | * @see \OC_App::updateApp |
| 336 | 336 | */ |
| 337 | - if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/preupdate.php')) { |
|
| 337 | + if (file_exists(\OC_App::getAppPath($appId).'/appinfo/preupdate.php')) { |
|
| 338 | 338 | $this->includePreUpdate($appId); |
| 339 | 339 | } |
| 340 | - if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/database.xml')) { |
|
| 340 | + if (file_exists(\OC_App::getAppPath($appId).'/appinfo/database.xml')) { |
|
| 341 | 341 | $this->emit('\OC\Updater', 'appSimulateUpdate', array($appId)); |
| 342 | - \OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId) . '/appinfo/database.xml'); |
|
| 342 | + \OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId).'/appinfo/database.xml'); |
|
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | } |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | * @param string $appId |
| 353 | 353 | */ |
| 354 | 354 | private function includePreUpdate($appId) { |
| 355 | - include \OC_App::getAppPath($appId) . '/appinfo/preupdate.php'; |
|
| 355 | + include \OC_App::getAppPath($appId).'/appinfo/preupdate.php'; |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | /** |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | foreach ($apps as $appId) { |
| 371 | 371 | $priorityType = false; |
| 372 | 372 | foreach ($priorityTypes as $type) { |
| 373 | - if(!isset($stacks[$type])) { |
|
| 373 | + if (!isset($stacks[$type])) { |
|
| 374 | 374 | $stacks[$type] = array(); |
| 375 | 375 | } |
| 376 | 376 | if (\OC_App::isType($appId, $type)) { |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | \OC_App::updateApp($appId); |
| 391 | 391 | $this->emit('\OC\Updater', 'appUpgrade', [$appId, \OC_App::getAppVersion($appId)]); |
| 392 | 392 | } |
| 393 | - if($type !== $pseudoOtherType) { |
|
| 393 | + if ($type !== $pseudoOtherType) { |
|
| 394 | 394 | // load authentication, filesystem and logging apps after |
| 395 | 395 | // upgrading them. Other apps my need to rely on modifying |
| 396 | 396 | // user and/or filesystem aspects. |
@@ -418,9 +418,9 @@ discard block |
||
| 418 | 418 | foreach ($apps as $app) { |
| 419 | 419 | // check if the app is compatible with this version of ownCloud |
| 420 | 420 | $info = OC_App::getAppInfo($app); |
| 421 | - if(!OC_App::isAppCompatible($version, $info)) { |
|
| 421 | + if (!OC_App::isAppCompatible($version, $info)) { |
|
| 422 | 422 | if ($appManager->isShipped($app)) { |
| 423 | - throw new \UnexpectedValueException('The files of the app "' . $app . '" were not correctly replaced before running the update'); |
|
| 423 | + throw new \UnexpectedValueException('The files of the app "'.$app.'" were not correctly replaced before running the update'); |
|
| 424 | 424 | } |
| 425 | 425 | OC_App::disable($app); |
| 426 | 426 | $this->emit('\OC\Updater', 'incompatibleAppDisabled', array($app)); |
@@ -439,9 +439,9 @@ discard block |
||
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | // disable any other 3rd party apps if not overriden |
| 442 | - if(!$this->skip3rdPartyAppsDisable) { |
|
| 442 | + if (!$this->skip3rdPartyAppsDisable) { |
|
| 443 | 443 | \OC_App::disable($app); |
| 444 | - $disabledApps[]= $app; |
|
| 444 | + $disabledApps[] = $app; |
|
| 445 | 445 | $this->emit('\OC\Updater', 'thirdPartyAppDisabled', array($app)); |
| 446 | 446 | }; |
| 447 | 447 | } |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | * @throws \Exception |
| 466 | 466 | */ |
| 467 | 467 | private function upgradeAppStoreApps(array $disabledApps) { |
| 468 | - foreach($disabledApps as $app) { |
|
| 468 | + foreach ($disabledApps as $app) { |
|
| 469 | 469 | try { |
| 470 | 470 | $this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]); |
| 471 | 471 | if ($this->installer->isUpdateAvailable($app)) { |
@@ -484,22 +484,22 @@ discard block |
||
| 484 | 484 | */ |
| 485 | 485 | private function emitRepairEvents() { |
| 486 | 486 | $dispatcher = \OC::$server->getEventDispatcher(); |
| 487 | - $dispatcher->addListener('\OC\Repair::warning', function ($event) { |
|
| 487 | + $dispatcher->addListener('\OC\Repair::warning', function($event) { |
|
| 488 | 488 | if ($event instanceof GenericEvent) { |
| 489 | 489 | $this->emit('\OC\Updater', 'repairWarning', $event->getArguments()); |
| 490 | 490 | } |
| 491 | 491 | }); |
| 492 | - $dispatcher->addListener('\OC\Repair::error', function ($event) { |
|
| 492 | + $dispatcher->addListener('\OC\Repair::error', function($event) { |
|
| 493 | 493 | if ($event instanceof GenericEvent) { |
| 494 | 494 | $this->emit('\OC\Updater', 'repairError', $event->getArguments()); |
| 495 | 495 | } |
| 496 | 496 | }); |
| 497 | - $dispatcher->addListener('\OC\Repair::info', function ($event) { |
|
| 497 | + $dispatcher->addListener('\OC\Repair::info', function($event) { |
|
| 498 | 498 | if ($event instanceof GenericEvent) { |
| 499 | 499 | $this->emit('\OC\Updater', 'repairInfo', $event->getArguments()); |
| 500 | 500 | } |
| 501 | 501 | }); |
| 502 | - $dispatcher->addListener('\OC\Repair::step', function ($event) { |
|
| 502 | + $dispatcher->addListener('\OC\Repair::step', function($event) { |
|
| 503 | 503 | if ($event instanceof GenericEvent) { |
| 504 | 504 | $this->emit('\OC\Updater', 'repairStep', $event->getArguments()); |
| 505 | 505 | } |
@@ -514,13 +514,13 @@ discard block |
||
| 514 | 514 | if (!$event instanceof GenericEvent) { |
| 515 | 515 | return; |
| 516 | 516 | } |
| 517 | - $log->info('\OC\DB\Migrator::executeSql: ' . $event->getSubject() . ' (' . $event->getArgument(0) . ' of ' . $event->getArgument(1) . ')', ['app' => 'updater']); |
|
| 517 | + $log->info('\OC\DB\Migrator::executeSql: '.$event->getSubject().' ('.$event->getArgument(0).' of '.$event->getArgument(1).')', ['app' => 'updater']); |
|
| 518 | 518 | }); |
| 519 | 519 | $dispatcher->addListener('\OC\DB\Migrator::checkTable', function($event) use ($log) { |
| 520 | 520 | if (!$event instanceof GenericEvent) { |
| 521 | 521 | return; |
| 522 | 522 | } |
| 523 | - $log->info('\OC\DB\Migrator::checkTable: ' . $event->getSubject() . ' (' . $event->getArgument(0) . ' of ' . $event->getArgument(1) . ')', ['app' => 'updater']); |
|
| 523 | + $log->info('\OC\DB\Migrator::checkTable: '.$event->getSubject().' ('.$event->getArgument(0).' of '.$event->getArgument(1).')', ['app' => 'updater']); |
|
| 524 | 524 | }); |
| 525 | 525 | |
| 526 | 526 | $repairListener = function($event) use ($log) { |
@@ -529,30 +529,30 @@ discard block |
||
| 529 | 529 | } |
| 530 | 530 | switch ($event->getSubject()) { |
| 531 | 531 | case '\OC\Repair::startProgress': |
| 532 | - $log->info('\OC\Repair::startProgress: Starting ... ' . $event->getArgument(1) . ' (' . $event->getArgument(0) . ')', ['app' => 'updater']); |
|
| 532 | + $log->info('\OC\Repair::startProgress: Starting ... '.$event->getArgument(1).' ('.$event->getArgument(0).')', ['app' => 'updater']); |
|
| 533 | 533 | break; |
| 534 | 534 | case '\OC\Repair::advance': |
| 535 | 535 | $desc = $event->getArgument(1); |
| 536 | 536 | if (empty($desc)) { |
| 537 | 537 | $desc = ''; |
| 538 | 538 | } |
| 539 | - $log->info('\OC\Repair::advance: ' . $desc . ' (' . $event->getArgument(0) . ')', ['app' => 'updater']); |
|
| 539 | + $log->info('\OC\Repair::advance: '.$desc.' ('.$event->getArgument(0).')', ['app' => 'updater']); |
|
| 540 | 540 | |
| 541 | 541 | break; |
| 542 | 542 | case '\OC\Repair::finishProgress': |
| 543 | 543 | $log->info('\OC\Repair::finishProgress', ['app' => 'updater']); |
| 544 | 544 | break; |
| 545 | 545 | case '\OC\Repair::step': |
| 546 | - $log->info('\OC\Repair::step: Repair step: ' . $event->getArgument(0), ['app' => 'updater']); |
|
| 546 | + $log->info('\OC\Repair::step: Repair step: '.$event->getArgument(0), ['app' => 'updater']); |
|
| 547 | 547 | break; |
| 548 | 548 | case '\OC\Repair::info': |
| 549 | - $log->info('\OC\Repair::info: Repair info: ' . $event->getArgument(0), ['app' => 'updater']); |
|
| 549 | + $log->info('\OC\Repair::info: Repair info: '.$event->getArgument(0), ['app' => 'updater']); |
|
| 550 | 550 | break; |
| 551 | 551 | case '\OC\Repair::warning': |
| 552 | - $log->warning('\OC\Repair::warning: Repair warning: ' . $event->getArgument(0), ['app' => 'updater']); |
|
| 552 | + $log->warning('\OC\Repair::warning: Repair warning: '.$event->getArgument(0), ['app' => 'updater']); |
|
| 553 | 553 | break; |
| 554 | 554 | case '\OC\Repair::error': |
| 555 | - $log->error('\OC\Repair::error: Repair error: ' . $event->getArgument(0), ['app' => 'updater']); |
|
| 555 | + $log->error('\OC\Repair::error: Repair error: '.$event->getArgument(0), ['app' => 'updater']); |
|
| 556 | 556 | break; |
| 557 | 557 | } |
| 558 | 558 | }; |
@@ -566,77 +566,77 @@ discard block |
||
| 566 | 566 | $dispatcher->addListener('\OC\Repair::error', $repairListener); |
| 567 | 567 | |
| 568 | 568 | |
| 569 | - $this->listen('\OC\Updater', 'maintenanceEnabled', function () use($log) { |
|
| 569 | + $this->listen('\OC\Updater', 'maintenanceEnabled', function() use($log) { |
|
| 570 | 570 | $log->info('\OC\Updater::maintenanceEnabled: Turned on maintenance mode', ['app' => 'updater']); |
| 571 | 571 | }); |
| 572 | - $this->listen('\OC\Updater', 'maintenanceDisabled', function () use($log) { |
|
| 572 | + $this->listen('\OC\Updater', 'maintenanceDisabled', function() use($log) { |
|
| 573 | 573 | $log->info('\OC\Updater::maintenanceDisabled: Turned off maintenance mode', ['app' => 'updater']); |
| 574 | 574 | }); |
| 575 | - $this->listen('\OC\Updater', 'maintenanceActive', function () use($log) { |
|
| 575 | + $this->listen('\OC\Updater', 'maintenanceActive', function() use($log) { |
|
| 576 | 576 | $log->info('\OC\Updater::maintenanceActive: Maintenance mode is kept active', ['app' => 'updater']); |
| 577 | 577 | }); |
| 578 | - $this->listen('\OC\Updater', 'updateEnd', function ($success) use($log) { |
|
| 578 | + $this->listen('\OC\Updater', 'updateEnd', function($success) use($log) { |
|
| 579 | 579 | if ($success) { |
| 580 | 580 | $log->info('\OC\Updater::updateEnd: Update successful', ['app' => 'updater']); |
| 581 | 581 | } else { |
| 582 | 582 | $log->error('\OC\Updater::updateEnd: Update failed', ['app' => 'updater']); |
| 583 | 583 | } |
| 584 | 584 | }); |
| 585 | - $this->listen('\OC\Updater', 'dbUpgradeBefore', function () use($log) { |
|
| 585 | + $this->listen('\OC\Updater', 'dbUpgradeBefore', function() use($log) { |
|
| 586 | 586 | $log->info('\OC\Updater::dbUpgradeBefore: Updating database schema', ['app' => 'updater']); |
| 587 | 587 | }); |
| 588 | - $this->listen('\OC\Updater', 'dbUpgrade', function () use($log) { |
|
| 588 | + $this->listen('\OC\Updater', 'dbUpgrade', function() use($log) { |
|
| 589 | 589 | $log->info('\OC\Updater::dbUpgrade: Updated database', ['app' => 'updater']); |
| 590 | 590 | }); |
| 591 | - $this->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use($log) { |
|
| 591 | + $this->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function() use($log) { |
|
| 592 | 592 | $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']); |
| 593 | 593 | }); |
| 594 | - $this->listen('\OC\Updater', 'dbSimulateUpgrade', function () use($log) { |
|
| 594 | + $this->listen('\OC\Updater', 'dbSimulateUpgrade', function() use($log) { |
|
| 595 | 595 | $log->info('\OC\Updater::dbSimulateUpgrade: Checked database schema update', ['app' => 'updater']); |
| 596 | 596 | }); |
| 597 | - $this->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use($log) { |
|
| 598 | - $log->info('\OC\Updater::incompatibleAppDisabled: Disabled incompatible app: ' . $app, ['app' => 'updater']); |
|
| 597 | + $this->listen('\OC\Updater', 'incompatibleAppDisabled', function($app) use($log) { |
|
| 598 | + $log->info('\OC\Updater::incompatibleAppDisabled: Disabled incompatible app: '.$app, ['app' => 'updater']); |
|
| 599 | 599 | }); |
| 600 | - $this->listen('\OC\Updater', 'thirdPartyAppDisabled', function ($app) use ($log) { |
|
| 601 | - $log->info('\OC\Updater::thirdPartyAppDisabled: Disabled 3rd-party app: ' . $app, ['app' => 'updater']); |
|
| 600 | + $this->listen('\OC\Updater', 'thirdPartyAppDisabled', function($app) use ($log) { |
|
| 601 | + $log->info('\OC\Updater::thirdPartyAppDisabled: Disabled 3rd-party app: '.$app, ['app' => 'updater']); |
|
| 602 | 602 | }); |
| 603 | - $this->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use($log) { |
|
| 604 | - $log->info('\OC\Updater::checkAppStoreAppBefore: Checking for update of app "' . $app . '" in appstore', ['app' => 'updater']); |
|
| 603 | + $this->listen('\OC\Updater', 'checkAppStoreAppBefore', function($app) use($log) { |
|
| 604 | + $log->info('\OC\Updater::checkAppStoreAppBefore: Checking for update of app "'.$app.'" in appstore', ['app' => 'updater']); |
|
| 605 | 605 | }); |
| 606 | - $this->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use($log) { |
|
| 607 | - $log->info('\OC\Updater::upgradeAppStoreApp: Update app "' . $app . '" from appstore', ['app' => 'updater']); |
|
| 606 | + $this->listen('\OC\Updater', 'upgradeAppStoreApp', function($app) use($log) { |
|
| 607 | + $log->info('\OC\Updater::upgradeAppStoreApp: Update app "'.$app.'" from appstore', ['app' => 'updater']); |
|
| 608 | 608 | }); |
| 609 | - $this->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use($log) { |
|
| 610 | - $log->info('\OC\Updater::checkAppStoreApp: Checked for update of app "' . $app . '" in appstore', ['app' => 'updater']); |
|
| 609 | + $this->listen('\OC\Updater', 'checkAppStoreApp', function($app) use($log) { |
|
| 610 | + $log->info('\OC\Updater::checkAppStoreApp: Checked for update of app "'.$app.'" in appstore', ['app' => 'updater']); |
|
| 611 | 611 | }); |
| 612 | - $this->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($log) { |
|
| 612 | + $this->listen('\OC\Updater', 'appUpgradeCheckBefore', function() use ($log) { |
|
| 613 | 613 | $log->info('\OC\Updater::appUpgradeCheckBefore: Checking updates of apps', ['app' => 'updater']); |
| 614 | 614 | }); |
| 615 | - $this->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($log) { |
|
| 616 | - $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']); |
|
| 615 | + $this->listen('\OC\Updater', 'appSimulateUpdate', function($app) use ($log) { |
|
| 616 | + $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']); |
|
| 617 | 617 | }); |
| 618 | - $this->listen('\OC\Updater', 'appUpgradeCheck', function () use ($log) { |
|
| 618 | + $this->listen('\OC\Updater', 'appUpgradeCheck', function() use ($log) { |
|
| 619 | 619 | $log->info('\OC\Updater::appUpgradeCheck: Checked database schema update for apps', ['app' => 'updater']); |
| 620 | 620 | }); |
| 621 | - $this->listen('\OC\Updater', 'appUpgradeStarted', function ($app) use ($log) { |
|
| 622 | - $log->info('\OC\Updater::appUpgradeStarted: Updating <' . $app . '> ...', ['app' => 'updater']); |
|
| 621 | + $this->listen('\OC\Updater', 'appUpgradeStarted', function($app) use ($log) { |
|
| 622 | + $log->info('\OC\Updater::appUpgradeStarted: Updating <'.$app.'> ...', ['app' => 'updater']); |
|
| 623 | 623 | }); |
| 624 | - $this->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($log) { |
|
| 625 | - $log->info('\OC\Updater::appUpgrade: Updated <' . $app . '> to ' . $version, ['app' => 'updater']); |
|
| 624 | + $this->listen('\OC\Updater', 'appUpgrade', function($app, $version) use ($log) { |
|
| 625 | + $log->info('\OC\Updater::appUpgrade: Updated <'.$app.'> to '.$version, ['app' => 'updater']); |
|
| 626 | 626 | }); |
| 627 | - $this->listen('\OC\Updater', 'failure', function ($message) use($log) { |
|
| 628 | - $log->error('\OC\Updater::failure: ' . $message, ['app' => 'updater']); |
|
| 627 | + $this->listen('\OC\Updater', 'failure', function($message) use($log) { |
|
| 628 | + $log->error('\OC\Updater::failure: '.$message, ['app' => 'updater']); |
|
| 629 | 629 | }); |
| 630 | - $this->listen('\OC\Updater', 'setDebugLogLevel', function () use($log) { |
|
| 630 | + $this->listen('\OC\Updater', 'setDebugLogLevel', function() use($log) { |
|
| 631 | 631 | $log->info('\OC\Updater::setDebugLogLevel: Set log level to debug', ['app' => 'updater']); |
| 632 | 632 | }); |
| 633 | - $this->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use($log) { |
|
| 634 | - $log->info('\OC\Updater::resetLogLevel: Reset log level to ' . $logLevelName . '(' . $logLevel . ')', ['app' => 'updater']); |
|
| 633 | + $this->listen('\OC\Updater', 'resetLogLevel', function($logLevel, $logLevelName) use($log) { |
|
| 634 | + $log->info('\OC\Updater::resetLogLevel: Reset log level to '.$logLevelName.'('.$logLevel.')', ['app' => 'updater']); |
|
| 635 | 635 | }); |
| 636 | - $this->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use($log) { |
|
| 636 | + $this->listen('\OC\Updater', 'startCheckCodeIntegrity', function() use($log) { |
|
| 637 | 637 | $log->info('\OC\Updater::startCheckCodeIntegrity: Starting code integrity check...', ['app' => 'updater']); |
| 638 | 638 | }); |
| 639 | - $this->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use($log) { |
|
| 639 | + $this->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function() use($log) { |
|
| 640 | 640 | $log->info('\OC\Updater::finishedCheckCodeIntegrity: Finished code integrity check', ['app' => 'updater']); |
| 641 | 641 | }); |
| 642 | 642 | |
@@ -165,24 +165,24 @@ discard block |
||
| 165 | 165 | $configuredDatabases = $this->config->getValue('supportedDatabases', |
| 166 | 166 | ['sqlite', 'mysql', 'pgsql']); |
| 167 | 167 | } |
| 168 | - if(!is_array($configuredDatabases)) { |
|
| 168 | + if (!is_array($configuredDatabases)) { |
|
| 169 | 169 | throw new Exception('Supported databases are not properly configured.'); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | $supportedDatabases = array(); |
| 173 | 173 | |
| 174 | - foreach($configuredDatabases as $database) { |
|
| 175 | - if(array_key_exists($database, $availableDatabases)) { |
|
| 174 | + foreach ($configuredDatabases as $database) { |
|
| 175 | + if (array_key_exists($database, $availableDatabases)) { |
|
| 176 | 176 | $working = false; |
| 177 | 177 | $type = $availableDatabases[$database]['type']; |
| 178 | 178 | $call = $availableDatabases[$database]['call']; |
| 179 | 179 | |
| 180 | 180 | if ($type === 'function') { |
| 181 | 181 | $working = $this->is_callable($call); |
| 182 | - } elseif($type === 'pdo') { |
|
| 182 | + } elseif ($type === 'pdo') { |
|
| 183 | 183 | $working = in_array($call, $this->getAvailableDbDriversForPdo(), true); |
| 184 | 184 | } |
| 185 | - if($working) { |
|
| 185 | + if ($working) { |
|
| 186 | 186 | $supportedDatabases[$database] = $availableDatabases[$database]['name']; |
| 187 | 187 | } |
| 188 | 188 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | // Create data directory to test whether the .htaccess works |
| 209 | 209 | // Notice that this is not necessarily the same data directory as the one |
| 210 | 210 | // that will effectively be used. |
| 211 | - if(!file_exists($dataDir)) { |
|
| 211 | + if (!file_exists($dataDir)) { |
|
| 212 | 212 | @mkdir($dataDir); |
| 213 | 213 | } |
| 214 | 214 | $htAccessWorking = true; |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | if (\OC_Util::runningOnMac()) { |
| 232 | 232 | $errors[] = [ |
| 233 | 233 | 'error' => $this->l10n->t( |
| 234 | - 'Mac OS X is not supported and %s will not work properly on this platform. ' . |
|
| 234 | + 'Mac OS X is not supported and %s will not work properly on this platform. '. |
|
| 235 | 235 | 'Use it at your own risk! ', |
| 236 | 236 | [$this->defaults->getName()] |
| 237 | 237 | ), |
@@ -239,10 +239,10 @@ discard block |
||
| 239 | 239 | ]; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - if($this->iniWrapper->getString('open_basedir') !== '' && PHP_INT_SIZE === 4) { |
|
| 242 | + if ($this->iniWrapper->getString('open_basedir') !== '' && PHP_INT_SIZE === 4) { |
|
| 243 | 243 | $errors[] = [ |
| 244 | 244 | 'error' => $this->l10n->t( |
| 245 | - 'It seems that this %s instance is running on a 32-bit PHP environment and the open_basedir has been configured in php.ini. ' . |
|
| 245 | + 'It seems that this %s instance is running on a 32-bit PHP environment and the open_basedir has been configured in php.ini. '. |
|
| 246 | 246 | 'This will lead to problems with files over 4 GB and is highly discouraged.', |
| 247 | 247 | [$this->defaults->getName()] |
| 248 | 248 | ), |
@@ -272,13 +272,13 @@ discard block |
||
| 272 | 272 | $error = array(); |
| 273 | 273 | $dbType = $options['dbtype']; |
| 274 | 274 | |
| 275 | - if(empty($options['adminlogin'])) { |
|
| 275 | + if (empty($options['adminlogin'])) { |
|
| 276 | 276 | $error[] = $l->t('Set an admin username.'); |
| 277 | 277 | } |
| 278 | - if(empty($options['adminpass'])) { |
|
| 278 | + if (empty($options['adminpass'])) { |
|
| 279 | 279 | $error[] = $l->t('Set an admin password.'); |
| 280 | 280 | } |
| 281 | - if(empty($options['directory'])) { |
|
| 281 | + if (empty($options['directory'])) { |
|
| 282 | 282 | $options['directory'] = \OC::$SERVERROOT."/data"; |
| 283 | 283 | } |
| 284 | 284 | |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | $request = \OC::$server->getRequest(); |
| 308 | 308 | |
| 309 | 309 | //no errors, good |
| 310 | - if(isset($options['trusted_domains']) |
|
| 310 | + if (isset($options['trusted_domains']) |
|
| 311 | 311 | && is_array($options['trusted_domains'])) { |
| 312 | 312 | $trustedDomains = $options['trusted_domains']; |
| 313 | 313 | } else { |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | 'secret' => $secret, |
| 331 | 331 | 'trusted_domains' => $trustedDomains, |
| 332 | 332 | 'datadirectory' => $dataDir, |
| 333 | - 'overwrite.cli.url' => $request->getServerProtocol() . '://' . $request->getInsecureServerHost() . \OC::$WEBROOT, |
|
| 333 | + 'overwrite.cli.url' => $request->getServerProtocol().'://'.$request->getInsecureServerHost().\OC::$WEBROOT, |
|
| 334 | 334 | 'dbtype' => $dbType, |
| 335 | 335 | 'version' => implode('.', \OCP\Util::getVersion()), |
| 336 | 336 | ]); |
@@ -348,20 +348,20 @@ discard block |
||
| 348 | 348 | return $error; |
| 349 | 349 | } catch (Exception $e) { |
| 350 | 350 | $error[] = [ |
| 351 | - 'error' => 'Error while trying to create admin user: ' . $e->getMessage(), |
|
| 351 | + 'error' => 'Error while trying to create admin user: '.$e->getMessage(), |
|
| 352 | 352 | 'hint' => '', |
| 353 | 353 | ]; |
| 354 | 354 | return $error; |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | //create the user and group |
| 358 | - $user = null; |
|
| 358 | + $user = null; |
|
| 359 | 359 | try { |
| 360 | 360 | $user = \OC::$server->getUserManager()->createUser($username, $password); |
| 361 | 361 | if (!$user) { |
| 362 | 362 | $error[] = "User <$username> could not be created."; |
| 363 | 363 | } |
| 364 | - } catch(Exception $exception) { |
|
| 364 | + } catch (Exception $exception) { |
|
| 365 | 365 | $error[] = $exception->getMessage(); |
| 366 | 366 | } |
| 367 | 367 | |
@@ -371,14 +371,14 @@ discard block |
||
| 371 | 371 | $config->setAppValue('core', 'lastupdatedat', microtime(true)); |
| 372 | 372 | $config->setAppValue('core', 'vendor', $this->getVendor()); |
| 373 | 373 | |
| 374 | - $group =\OC::$server->getGroupManager()->createGroup('admin'); |
|
| 374 | + $group = \OC::$server->getGroupManager()->createGroup('admin'); |
|
| 375 | 375 | $group->addUser($user); |
| 376 | 376 | |
| 377 | 377 | // Install shipped apps and specified app bundles |
| 378 | 378 | Installer::installShippedApps(); |
| 379 | 379 | $bundleFetcher = new BundleFetcher(\OC::$server->getL10N('lib')); |
| 380 | 380 | $defaultInstallationBundles = $bundleFetcher->getDefaultInstallationBundle(); |
| 381 | - foreach($defaultInstallationBundles as $bundle) { |
|
| 381 | + foreach ($defaultInstallationBundles as $bundle) { |
|
| 382 | 382 | try { |
| 383 | 383 | $this->installer->installAppBundle($bundle); |
| 384 | 384 | } catch (Exception $e) {} |
@@ -431,9 +431,9 @@ discard block |
||
| 431 | 431 | $config = \OC::$server->getSystemConfig(); |
| 432 | 432 | |
| 433 | 433 | // For CLI read the value from overwrite.cli.url |
| 434 | - if(\OC::$CLI) { |
|
| 434 | + if (\OC::$CLI) { |
|
| 435 | 435 | $webRoot = $config->getValue('overwrite.cli.url', ''); |
| 436 | - if($webRoot === '') { |
|
| 436 | + if ($webRoot === '') { |
|
| 437 | 437 | return false; |
| 438 | 438 | } |
| 439 | 439 | $webRoot = parse_url($webRoot, PHP_URL_PATH); |
@@ -457,14 +457,14 @@ discard block |
||
| 457 | 457 | $htaccessContent = explode($content, $htaccessContent, 2)[0]; |
| 458 | 458 | |
| 459 | 459 | //custom 403 error page |
| 460 | - $content.= "\nErrorDocument 403 ".$webRoot."/"; |
|
| 460 | + $content .= "\nErrorDocument 403 ".$webRoot."/"; |
|
| 461 | 461 | |
| 462 | 462 | //custom 404 error page |
| 463 | - $content.= "\nErrorDocument 404 ".$webRoot."/"; |
|
| 463 | + $content .= "\nErrorDocument 404 ".$webRoot."/"; |
|
| 464 | 464 | |
| 465 | 465 | // Add rewrite rules if the RewriteBase is configured |
| 466 | 466 | $rewriteBase = $config->getValue('htaccess.RewriteBase', ''); |
| 467 | - if($rewriteBase !== '') { |
|
| 467 | + if ($rewriteBase !== '') { |
|
| 468 | 468 | $content .= "\n<IfModule mod_rewrite.c>"; |
| 469 | 469 | $content .= "\n Options -MultiViews"; |
| 470 | 470 | $content .= "\n RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1]"; |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | $content .= "\n RewriteCond %{REQUEST_FILENAME} !/ocs-provider/"; |
| 485 | 485 | $content .= "\n RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.*"; |
| 486 | 486 | $content .= "\n RewriteRule . index.php [PT,E=PATH_INFO:$1]"; |
| 487 | - $content .= "\n RewriteBase " . $rewriteBase; |
|
| 487 | + $content .= "\n RewriteBase ".$rewriteBase; |
|
| 488 | 488 | $content .= "\n <IfModule mod_env.c>"; |
| 489 | 489 | $content .= "\n SetEnv front_controller_active true"; |
| 490 | 490 | $content .= "\n <IfModule mod_dir.c>"; |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | |
| 497 | 497 | if ($content !== '') { |
| 498 | 498 | //suppress errors in case we don't have permissions for it |
| 499 | - return (bool) @file_put_contents($setupHelper->pathToHtaccess(), $htaccessContent.$content . "\n"); |
|
| 499 | + return (bool) @file_put_contents($setupHelper->pathToHtaccess(), $htaccessContent.$content."\n"); |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | return false; |
@@ -504,25 +504,25 @@ discard block |
||
| 504 | 504 | |
| 505 | 505 | public static function protectDataDirectory() { |
| 506 | 506 | //Require all denied |
| 507 | - $now = date('Y-m-d H:i:s'); |
|
| 507 | + $now = date('Y-m-d H:i:s'); |
|
| 508 | 508 | $content = "# Generated by Nextcloud on $now\n"; |
| 509 | - $content.= "# line below if for Apache 2.4\n"; |
|
| 510 | - $content.= "<ifModule mod_authz_core.c>\n"; |
|
| 511 | - $content.= "Require all denied\n"; |
|
| 512 | - $content.= "</ifModule>\n\n"; |
|
| 513 | - $content.= "# line below if for Apache 2.2\n"; |
|
| 514 | - $content.= "<ifModule !mod_authz_core.c>\n"; |
|
| 515 | - $content.= "deny from all\n"; |
|
| 516 | - $content.= "Satisfy All\n"; |
|
| 517 | - $content.= "</ifModule>\n\n"; |
|
| 518 | - $content.= "# section for Apache 2.2 and 2.4\n"; |
|
| 519 | - $content.= "<ifModule mod_autoindex.c>\n"; |
|
| 520 | - $content.= "IndexIgnore *\n"; |
|
| 521 | - $content.= "</ifModule>\n"; |
|
| 522 | - |
|
| 523 | - $baseDir = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data'); |
|
| 524 | - file_put_contents($baseDir . '/.htaccess', $content); |
|
| 525 | - file_put_contents($baseDir . '/index.html', ''); |
|
| 509 | + $content .= "# line below if for Apache 2.4\n"; |
|
| 510 | + $content .= "<ifModule mod_authz_core.c>\n"; |
|
| 511 | + $content .= "Require all denied\n"; |
|
| 512 | + $content .= "</ifModule>\n\n"; |
|
| 513 | + $content .= "# line below if for Apache 2.2\n"; |
|
| 514 | + $content .= "<ifModule !mod_authz_core.c>\n"; |
|
| 515 | + $content .= "deny from all\n"; |
|
| 516 | + $content .= "Satisfy All\n"; |
|
| 517 | + $content .= "</ifModule>\n\n"; |
|
| 518 | + $content .= "# section for Apache 2.2 and 2.4\n"; |
|
| 519 | + $content .= "<ifModule mod_autoindex.c>\n"; |
|
| 520 | + $content .= "IndexIgnore *\n"; |
|
| 521 | + $content .= "</ifModule>\n"; |
|
| 522 | + |
|
| 523 | + $baseDir = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data'); |
|
| 524 | + file_put_contents($baseDir.'/.htaccess', $content); |
|
| 525 | + file_put_contents($baseDir.'/index.html', ''); |
|
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | /** |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | */ |
| 535 | 535 | private function getVendor() { |
| 536 | 536 | // this should really be a JSON file |
| 537 | - require \OC::$SERVERROOT . '/version.php'; |
|
| 537 | + require \OC::$SERVERROOT.'/version.php'; |
|
| 538 | 538 | /** @var string $vendor */ |
| 539 | 539 | return (string) $vendor; |
| 540 | 540 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function installApp($appId) { |
| 102 | 102 | $app = \OC_App::findAppInDirectories($appId); |
| 103 | - if($app === false) { |
|
| 103 | + if ($app === false) { |
|
| 104 | 104 | throw new \Exception('App not found in any app directory'); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $l = \OC::$server->getL10N('core'); |
| 111 | 111 | |
| 112 | - if(!is_array($info)) { |
|
| 112 | + if (!is_array($info)) { |
|
| 113 | 113 | throw new \Exception( |
| 114 | 114 | $l->t('App "%s" cannot be installed because appinfo file cannot be read.', |
| 115 | 115 | [$info['name']] |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | \OC_App::registerAutoloading($appId, $basedir); |
| 133 | 133 | |
| 134 | 134 | //install the database |
| 135 | - if(is_file($basedir.'/appinfo/database.xml')) { |
|
| 135 | + if (is_file($basedir.'/appinfo/database.xml')) { |
|
| 136 | 136 | if (\OC::$server->getAppConfig()->getValue($info['id'], 'installed_version') === null) { |
| 137 | 137 | OC_DB::createDbFromStructure($basedir.'/appinfo/database.xml'); |
| 138 | 138 | } else { |
@@ -144,13 +144,13 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | \OC_App::setupBackgroundJobs($info['background-jobs']); |
| 147 | - if(isset($info['settings']) && is_array($info['settings'])) { |
|
| 147 | + if (isset($info['settings']) && is_array($info['settings'])) { |
|
| 148 | 148 | \OC::$server->getSettingsManager()->setupSettings($info['settings']); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | //run appinfo/install.php |
| 152 | - if((!isset($data['noinstall']) or $data['noinstall']==false)) { |
|
| 153 | - self::includeAppScript($basedir . '/appinfo/install.php'); |
|
| 152 | + if ((!isset($data['noinstall']) or $data['noinstall'] == false)) { |
|
| 153 | + self::includeAppScript($basedir.'/appinfo/install.php'); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | $appData = OC_App::getAppInfo($appId); |
@@ -161,10 +161,10 @@ discard block |
||
| 161 | 161 | \OC::$server->getConfig()->setAppValue($info['id'], 'enabled', 'no'); |
| 162 | 162 | |
| 163 | 163 | //set remote/public handlers |
| 164 | - foreach($info['remote'] as $name=>$path) { |
|
| 164 | + foreach ($info['remote'] as $name=>$path) { |
|
| 165 | 165 | \OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $info['id'].'/'.$path); |
| 166 | 166 | } |
| 167 | - foreach($info['public'] as $name=>$path) { |
|
| 167 | + foreach ($info['public'] as $name=>$path) { |
|
| 168 | 168 | \OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $info['id'].'/'.$path); |
| 169 | 169 | } |
| 170 | 170 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * |
| 181 | 181 | * Checks whether or not an app is installed, i.e. registered in apps table. |
| 182 | 182 | */ |
| 183 | - public static function isInstalled( $app ) { |
|
| 183 | + public static function isInstalled($app) { |
|
| 184 | 184 | return (\OC::$server->getConfig()->getAppValue($app, "installed_version", null) !== null); |
| 185 | 185 | } |
| 186 | 186 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @return bool |
| 192 | 192 | */ |
| 193 | 193 | public function updateAppstoreApp($appId) { |
| 194 | - if($this->isUpdateAvailable($appId)) { |
|
| 194 | + if ($this->isUpdateAvailable($appId)) { |
|
| 195 | 195 | try { |
| 196 | 196 | $this->downloadApp($appId); |
| 197 | 197 | } catch (\Exception $e) { |
@@ -215,18 +215,18 @@ discard block |
||
| 215 | 215 | $appId = strtolower($appId); |
| 216 | 216 | |
| 217 | 217 | $apps = $this->appFetcher->get(); |
| 218 | - foreach($apps as $app) { |
|
| 219 | - if($app['id'] === $appId) { |
|
| 218 | + foreach ($apps as $app) { |
|
| 219 | + if ($app['id'] === $appId) { |
|
| 220 | 220 | // Load the certificate |
| 221 | 221 | $certificate = new X509(); |
| 222 | - $certificate->loadCA(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crt')); |
|
| 222 | + $certificate->loadCA(file_get_contents(__DIR__.'/../../resources/codesigning/root.crt')); |
|
| 223 | 223 | $loadedCertificate = $certificate->loadX509($app['certificate']); |
| 224 | 224 | |
| 225 | 225 | // Verify if the certificate has been revoked |
| 226 | 226 | $crl = new X509(); |
| 227 | - $crl->loadCA(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crt')); |
|
| 228 | - $crl->loadCRL(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crl')); |
|
| 229 | - if($crl->validateSignature() !== true) { |
|
| 227 | + $crl->loadCA(file_get_contents(__DIR__.'/../../resources/codesigning/root.crt')); |
|
| 228 | + $crl->loadCRL(file_get_contents(__DIR__.'/../../resources/codesigning/root.crl')); |
|
| 229 | + if ($crl->validateSignature() !== true) { |
|
| 230 | 230 | throw new \Exception('Could not validate CRL signature'); |
| 231 | 231 | } |
| 232 | 232 | $csn = $loadedCertificate['tbsCertificate']['serialNumber']->toString(); |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | // Verify if the certificate has been issued by the Nextcloud Code Authority CA |
| 244 | - if($certificate->validateSignature() !== true) { |
|
| 244 | + if ($certificate->validateSignature() !== true) { |
|
| 245 | 245 | throw new \Exception( |
| 246 | 246 | sprintf( |
| 247 | 247 | 'App with id %s has a certificate not issued by a trusted Code Signing Authority', |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | // Verify if the certificate is issued for the requested app id |
| 254 | 254 | $certInfo = openssl_x509_parse($app['certificate']); |
| 255 | - if(!isset($certInfo['subject']['CN'])) { |
|
| 255 | + if (!isset($certInfo['subject']['CN'])) { |
|
| 256 | 256 | throw new \Exception( |
| 257 | 257 | sprintf( |
| 258 | 258 | 'App with id %s has a cert with no CN', |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | ) |
| 261 | 261 | ); |
| 262 | 262 | } |
| 263 | - if($certInfo['subject']['CN'] !== $appId) { |
|
| 263 | + if ($certInfo['subject']['CN'] !== $appId) { |
|
| 264 | 264 | throw new \Exception( |
| 265 | 265 | sprintf( |
| 266 | 266 | 'App with id %s has a cert issued to %s', |
@@ -277,15 +277,15 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | // Check if the signature actually matches the downloaded content |
| 279 | 279 | $certificate = openssl_get_publickey($app['certificate']); |
| 280 | - $verified = (bool)openssl_verify(file_get_contents($tempFile), base64_decode($app['releases'][0]['signature']), $certificate, OPENSSL_ALGO_SHA512); |
|
| 280 | + $verified = (bool) openssl_verify(file_get_contents($tempFile), base64_decode($app['releases'][0]['signature']), $certificate, OPENSSL_ALGO_SHA512); |
|
| 281 | 281 | openssl_free_key($certificate); |
| 282 | 282 | |
| 283 | - if($verified === true) { |
|
| 283 | + if ($verified === true) { |
|
| 284 | 284 | // Seems to match, let's proceed |
| 285 | 285 | $extractDir = $this->tempManager->getTemporaryFolder(); |
| 286 | 286 | $archive = new TAR($tempFile); |
| 287 | 287 | |
| 288 | - if($archive) { |
|
| 288 | + if ($archive) { |
|
| 289 | 289 | if (!$archive->extract($extractDir)) { |
| 290 | 290 | throw new \Exception( |
| 291 | 291 | sprintf( |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | $folders = array_diff($allFiles, ['.', '..']); |
| 299 | 299 | $folders = array_values($folders); |
| 300 | 300 | |
| 301 | - if(count($folders) > 1) { |
|
| 301 | + if (count($folders) > 1) { |
|
| 302 | 302 | throw new \Exception( |
| 303 | 303 | sprintf( |
| 304 | 304 | 'Extracted app %s has more than 1 folder', |
@@ -309,22 +309,22 @@ discard block |
||
| 309 | 309 | |
| 310 | 310 | // Check if appinfo/info.xml has the same app ID as well |
| 311 | 311 | $loadEntities = libxml_disable_entity_loader(false); |
| 312 | - $xml = simplexml_load_file($extractDir . '/' . $folders[0] . '/appinfo/info.xml'); |
|
| 312 | + $xml = simplexml_load_file($extractDir.'/'.$folders[0].'/appinfo/info.xml'); |
|
| 313 | 313 | libxml_disable_entity_loader($loadEntities); |
| 314 | - if((string)$xml->id !== $appId) { |
|
| 314 | + if ((string) $xml->id !== $appId) { |
|
| 315 | 315 | throw new \Exception( |
| 316 | 316 | sprintf( |
| 317 | 317 | 'App for id %s has a wrong app ID in info.xml: %s', |
| 318 | 318 | $appId, |
| 319 | - (string)$xml->id |
|
| 319 | + (string) $xml->id |
|
| 320 | 320 | ) |
| 321 | 321 | ); |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | // Check if the version is lower than before |
| 325 | 325 | $currentVersion = OC_App::getAppVersion($appId); |
| 326 | - $newVersion = (string)$xml->version; |
|
| 327 | - if(version_compare($currentVersion, $newVersion) === 1) { |
|
| 326 | + $newVersion = (string) $xml->version; |
|
| 327 | + if (version_compare($currentVersion, $newVersion) === 1) { |
|
| 328 | 328 | throw new \Exception( |
| 329 | 329 | sprintf( |
| 330 | 330 | 'App for id %s has version %s and tried to update to lower version %s', |
@@ -335,12 +335,12 @@ discard block |
||
| 335 | 335 | ); |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - $baseDir = OC_App::getInstallPath() . '/' . $appId; |
|
| 338 | + $baseDir = OC_App::getInstallPath().'/'.$appId; |
|
| 339 | 339 | // Remove old app with the ID if existent |
| 340 | 340 | OC_Helper::rmdirr($baseDir); |
| 341 | 341 | // Move to app folder |
| 342 | - if(@mkdir($baseDir)) { |
|
| 343 | - $extractDir .= '/' . $folders[0]; |
|
| 342 | + if (@mkdir($baseDir)) { |
|
| 343 | + $extractDir .= '/'.$folders[0]; |
|
| 344 | 344 | OC_Helper::copyr($extractDir, $baseDir); |
| 345 | 345 | } |
| 346 | 346 | OC_Helper::copyr($extractDir, $baseDir); |
@@ -399,8 +399,8 @@ discard block |
||
| 399 | 399 | $apps = $this->appFetcher->get(); |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - foreach($apps as $app) { |
|
| 403 | - if($app['id'] === $appId) { |
|
| 402 | + foreach ($apps as $app) { |
|
| 403 | + if ($app['id'] === $appId) { |
|
| 404 | 404 | $currentVersion = OC_App::getAppVersion($appId); |
| 405 | 405 | $newestVersion = $app['releases'][0]['version']; |
| 406 | 406 | if (version_compare($newestVersion, $currentVersion, '>')) { |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | * The function will check if the app is already downloaded in the apps repository |
| 423 | 423 | */ |
| 424 | 424 | public function isDownloaded($name) { |
| 425 | - foreach(\OC::$APPSROOTS as $dir) { |
|
| 425 | + foreach (\OC::$APPSROOTS as $dir) { |
|
| 426 | 426 | $dirToTest = $dir['path']; |
| 427 | 427 | $dirToTest .= '/'; |
| 428 | 428 | $dirToTest .= $name; |
@@ -450,11 +450,11 @@ discard block |
||
| 450 | 450 | * this has to be done by the function oc_app_uninstall(). |
| 451 | 451 | */ |
| 452 | 452 | public function removeApp($appId) { |
| 453 | - if($this->isDownloaded( $appId )) { |
|
| 454 | - $appDir = OC_App::getInstallPath() . '/' . $appId; |
|
| 453 | + if ($this->isDownloaded($appId)) { |
|
| 454 | + $appDir = OC_App::getInstallPath().'/'.$appId; |
|
| 455 | 455 | OC_Helper::rmdirr($appDir); |
| 456 | 456 | return true; |
| 457 | - }else{ |
|
| 457 | + } else { |
|
| 458 | 458 | \OCP\Util::writeLog('core', 'can\'t remove app '.$appId.'. It is not installed.', \OCP\Util::ERROR); |
| 459 | 459 | |
| 460 | 460 | return false; |
@@ -470,8 +470,8 @@ discard block |
||
| 470 | 470 | */ |
| 471 | 471 | public function installAppBundle(Bundle $bundle) { |
| 472 | 472 | $appIds = $bundle->getAppIdentifiers(); |
| 473 | - foreach($appIds as $appId) { |
|
| 474 | - if(!$this->isDownloaded($appId)) { |
|
| 473 | + foreach ($appIds as $appId) { |
|
| 474 | + if (!$this->isDownloaded($appId)) { |
|
| 475 | 475 | $this->downloadApp($appId); |
| 476 | 476 | } |
| 477 | 477 | $this->installApp($appId); |
@@ -493,13 +493,13 @@ discard block |
||
| 493 | 493 | */ |
| 494 | 494 | public static function installShippedApps($softErrors = false) { |
| 495 | 495 | $errors = []; |
| 496 | - foreach(\OC::$APPSROOTS as $app_dir) { |
|
| 497 | - if($dir = opendir( $app_dir['path'] )) { |
|
| 498 | - while( false !== ( $filename = readdir( $dir ))) { |
|
| 499 | - if( substr( $filename, 0, 1 ) != '.' and is_dir($app_dir['path']."/$filename") ) { |
|
| 500 | - if( file_exists( $app_dir['path']."/$filename/appinfo/info.xml" )) { |
|
| 501 | - if(!Installer::isInstalled($filename)) { |
|
| 502 | - $info=OC_App::getAppInfo($filename); |
|
| 496 | + foreach (\OC::$APPSROOTS as $app_dir) { |
|
| 497 | + if ($dir = opendir($app_dir['path'])) { |
|
| 498 | + while (false !== ($filename = readdir($dir))) { |
|
| 499 | + if (substr($filename, 0, 1) != '.' and is_dir($app_dir['path']."/$filename")) { |
|
| 500 | + if (file_exists($app_dir['path']."/$filename/appinfo/info.xml")) { |
|
| 501 | + if (!Installer::isInstalled($filename)) { |
|
| 502 | + $info = OC_App::getAppInfo($filename); |
|
| 503 | 503 | $enabled = isset($info['default_enable']); |
| 504 | 504 | if (($enabled || in_array($filename, \OC::$server->getAppManager()->getAlwaysEnabledApps())) |
| 505 | 505 | && \OC::$server->getConfig()->getAppValue($filename, 'enabled') !== 'no') { |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | } |
| 523 | 523 | } |
| 524 | 524 | } |
| 525 | - closedir( $dir ); |
|
| 525 | + closedir($dir); |
|
| 526 | 526 | } |
| 527 | 527 | } |
| 528 | 528 | |
@@ -539,12 +539,12 @@ discard block |
||
| 539 | 539 | $appPath = OC_App::getAppPath($app); |
| 540 | 540 | \OC_App::registerAutoloading($app, $appPath); |
| 541 | 541 | |
| 542 | - if(is_file("$appPath/appinfo/database.xml")) { |
|
| 542 | + if (is_file("$appPath/appinfo/database.xml")) { |
|
| 543 | 543 | try { |
| 544 | 544 | OC_DB::createDbFromStructure("$appPath/appinfo/database.xml"); |
| 545 | 545 | } catch (TableExistsException $e) { |
| 546 | 546 | throw new HintException( |
| 547 | - 'Failed to enable app ' . $app, |
|
| 547 | + 'Failed to enable app '.$app, |
|
| 548 | 548 | 'Please ask for help via one of our <a href="https://nextcloud.com/support/" target="_blank" rel="noreferrer noopener">support channels</a>.', |
| 549 | 549 | 0, $e |
| 550 | 550 | ); |
@@ -573,16 +573,16 @@ discard block |
||
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | //set remote/public handlers |
| 576 | - foreach($info['remote'] as $name=>$path) { |
|
| 576 | + foreach ($info['remote'] as $name=>$path) { |
|
| 577 | 577 | $config->setAppValue('core', 'remote_'.$name, $app.'/'.$path); |
| 578 | 578 | } |
| 579 | - foreach($info['public'] as $name=>$path) { |
|
| 579 | + foreach ($info['public'] as $name=>$path) { |
|
| 580 | 580 | $config->setAppValue('core', 'public_'.$name, $app.'/'.$path); |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | OC_App::setAppTypes($info['id']); |
| 584 | 584 | |
| 585 | - if(isset($info['settings']) && is_array($info['settings'])) { |
|
| 585 | + if (isset($info['settings']) && is_array($info['settings'])) { |
|
| 586 | 586 | // requires that autoloading was registered for the app, |
| 587 | 587 | // as happens before running the install.php some lines above |
| 588 | 588 | \OC::$server->getSettingsManager()->setupSettings($info['settings']); |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | * @param string $script |
| 596 | 596 | */ |
| 597 | 597 | private static function includeAppScript($script) { |
| 598 | - if ( file_exists($script) ){ |
|
| 598 | + if (file_exists($script)) { |
|
| 599 | 599 | include $script; |
| 600 | 600 | } |
| 601 | 601 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | return; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | -$appId = (string)$_POST['appid']; |
|
| 38 | +$appId = (string) $_POST['appid']; |
|
| 39 | 39 | $appId = OC_App::cleanAppId($appId); |
| 40 | 40 | |
| 41 | 41 | $config = \OC::$server->getConfig(); |
@@ -44,15 +44,15 @@ discard block |
||
| 44 | 44 | $installer = \OC::$server->query(\OC\Installer::class); |
| 45 | 45 | $result = $installer->updateAppstoreApp($appId); |
| 46 | 46 | $config->setSystemValue('maintenance', false); |
| 47 | -} catch(Exception $ex) { |
|
| 47 | +} catch (Exception $ex) { |
|
| 48 | 48 | $config->setSystemValue('maintenance', false); |
| 49 | - OC_JSON::error(array('data' => array( 'message' => $ex->getMessage() ))); |
|
| 49 | + OC_JSON::error(array('data' => array('message' => $ex->getMessage()))); |
|
| 50 | 50 | return; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | -if($result !== false) { |
|
| 53 | +if ($result !== false) { |
|
| 54 | 54 | OC_JSON::success(array('data' => array('appid' => $appId))); |
| 55 | 55 | } else { |
| 56 | 56 | $l = \OC::$server->getL10N('settings'); |
| 57 | - OC_JSON::error(array('data' => array( 'message' => $l->t("Couldn't update app.") ))); |
|
| 57 | + OC_JSON::error(array('data' => array('message' => $l->t("Couldn't update app.")))); |
|
| 58 | 58 | } |