@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::addListener |
| 24 | 24 | */ |
| 25 | 25 | public function listen($scope, $method, callable $callback) { |
| 26 | - $eventName = $scope . '::' . $method; |
|
| 26 | + $eventName = $scope.'::'.$method; |
|
| 27 | 27 | if (!isset($this->listeners[$eventName])) { |
| 28 | 28 | $this->listeners[$eventName] = []; |
| 29 | 29 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $names = []; |
| 43 | 43 | $allNames = array_keys($this->listeners); |
| 44 | 44 | if ($scope && $method) { |
| 45 | - $name = $scope . '::' . $method; |
|
| 45 | + $name = $scope.'::'.$method; |
|
| 46 | 46 | if (isset($this->listeners[$name])) { |
| 47 | 47 | $names[] = $name; |
| 48 | 48 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::dispatchTyped |
| 84 | 84 | */ |
| 85 | 85 | protected function emit($scope, $method, array $arguments = []) { |
| 86 | - $eventName = $scope . '::' . $method; |
|
| 86 | + $eventName = $scope.'::'.$method; |
|
| 87 | 87 | if (isset($this->listeners[$eventName])) { |
| 88 | 88 | foreach ($this->listeners[$eventName] as $callback) { |
| 89 | 89 | call_user_func_array($callback, $arguments); |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | use CADTrait; |
| 19 | 19 | |
| 20 | 20 | public function get($key) { |
| 21 | - $result = apcu_fetch($this->getPrefix() . $key, $success); |
|
| 21 | + $result = apcu_fetch($this->getPrefix().$key, $success); |
|
| 22 | 22 | if (!$success) { |
| 23 | 23 | return null; |
| 24 | 24 | } |
@@ -29,24 +29,24 @@ discard block |
||
| 29 | 29 | if ($ttl === 0) { |
| 30 | 30 | $ttl = self::DEFAULT_TTL; |
| 31 | 31 | } |
| 32 | - return apcu_store($this->getPrefix() . $key, $value, $ttl); |
|
| 32 | + return apcu_store($this->getPrefix().$key, $value, $ttl); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function hasKey($key) { |
| 36 | - return apcu_exists($this->getPrefix() . $key); |
|
| 36 | + return apcu_exists($this->getPrefix().$key); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function remove($key) { |
| 40 | - return apcu_delete($this->getPrefix() . $key); |
|
| 40 | + return apcu_delete($this->getPrefix().$key); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function clear($prefix = '') { |
| 44 | - $ns = $this->getPrefix() . $prefix; |
|
| 44 | + $ns = $this->getPrefix().$prefix; |
|
| 45 | 45 | $ns = preg_quote($ns, '/'); |
| 46 | 46 | if (class_exists('\APCIterator')) { |
| 47 | - $iter = new \APCIterator('user', '/^' . $ns . '/', APC_ITER_KEY); |
|
| 47 | + $iter = new \APCIterator('user', '/^'.$ns.'/', APC_ITER_KEY); |
|
| 48 | 48 | } else { |
| 49 | - $iter = new \APCUIterator('/^' . $ns . '/', APC_ITER_KEY); |
|
| 49 | + $iter = new \APCUIterator('/^'.$ns.'/', APC_ITER_KEY); |
|
| 50 | 50 | } |
| 51 | 51 | return apcu_delete($iter); |
| 52 | 52 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | if ($ttl === 0) { |
| 64 | 64 | $ttl = self::DEFAULT_TTL; |
| 65 | 65 | } |
| 66 | - return apcu_add($this->getPrefix() . $key, $value, $ttl); |
|
| 66 | + return apcu_add($this->getPrefix().$key, $value, $ttl); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function inc($key, $step = 1) { |
| 77 | 77 | $success = null; |
| 78 | - return apcu_inc($this->getPrefix() . $key, $step, $success, self::DEFAULT_TTL); |
|
| 78 | + return apcu_inc($this->getPrefix().$key, $step, $success, self::DEFAULT_TTL); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | * @return int | bool |
| 87 | 87 | */ |
| 88 | 88 | public function dec($key, $step = 1) { |
| 89 | - return apcu_exists($this->getPrefix() . $key) |
|
| 90 | - ? apcu_dec($this->getPrefix() . $key, $step) |
|
| 89 | + return apcu_exists($this->getPrefix().$key) |
|
| 90 | + ? apcu_dec($this->getPrefix().$key, $step) |
|
| 91 | 91 | : false; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | public function cas($key, $old, $new) { |
| 103 | 103 | // apc only does cas for ints |
| 104 | 104 | if (is_int($old) && is_int($new)) { |
| 105 | - return apcu_cas($this->getPrefix() . $key, $old, $new); |
|
| 105 | + return apcu_cas($this->getPrefix().$key, $old, $new); |
|
| 106 | 106 | } else { |
| 107 | 107 | return $this->casEmulated($key, $old, $new); |
| 108 | 108 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | public function get($key) { |
| 84 | - $result = self::$cache->get($this->getNameSpace() . $key); |
|
| 84 | + $result = self::$cache->get($this->getNameSpace().$key); |
|
| 85 | 85 | if ($result === false && self::$cache->getResultCode() === \Memcached::RES_NOTFOUND) { |
| 86 | 86 | return null; |
| 87 | 87 | } else { |
@@ -91,20 +91,20 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | public function set($key, $value, $ttl = 0) { |
| 93 | 93 | if ($ttl > 0) { |
| 94 | - $result = self::$cache->set($this->getNameSpace() . $key, $value, $ttl); |
|
| 94 | + $result = self::$cache->set($this->getNameSpace().$key, $value, $ttl); |
|
| 95 | 95 | } else { |
| 96 | - $result = self::$cache->set($this->getNameSpace() . $key, $value); |
|
| 96 | + $result = self::$cache->set($this->getNameSpace().$key, $value); |
|
| 97 | 97 | } |
| 98 | 98 | return $result || $this->isSuccess(); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | public function hasKey($key) { |
| 102 | - self::$cache->get($this->getNameSpace() . $key); |
|
| 102 | + self::$cache->get($this->getNameSpace().$key); |
|
| 103 | 103 | return self::$cache->getResultCode() === \Memcached::RES_SUCCESS; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | public function remove($key) { |
| 107 | - $result = self::$cache->delete($this->getNameSpace() . $key); |
|
| 107 | + $result = self::$cache->delete($this->getNameSpace().$key); |
|
| 108 | 108 | return $result || $this->isSuccess() || self::$cache->getResultCode() === \Memcached::RES_NOTFOUND; |
| 109 | 109 | } |
| 110 | 110 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * @return bool |
| 124 | 124 | */ |
| 125 | 125 | public function add($key, $value, $ttl = 0) { |
| 126 | - $result = self::$cache->add($this->getPrefix() . $key, $value, $ttl); |
|
| 126 | + $result = self::$cache->add($this->getPrefix().$key, $value, $ttl); |
|
| 127 | 127 | return $result || $this->isSuccess(); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function inc($key, $step = 1) { |
| 138 | 138 | $this->add($key, 0); |
| 139 | - $result = self::$cache->increment($this->getPrefix() . $key, $step); |
|
| 139 | + $result = self::$cache->increment($this->getPrefix().$key, $step); |
|
| 140 | 140 | |
| 141 | 141 | if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { |
| 142 | 142 | return false; |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * @return int | bool |
| 154 | 154 | */ |
| 155 | 155 | public function dec($key, $step = 1) { |
| 156 | - $result = self::$cache->decrement($this->getPrefix() . $key, $step); |
|
| 156 | + $result = self::$cache->decrement($this->getPrefix().$key, $step); |
|
| 157 | 157 | |
| 158 | 158 | if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { |
| 159 | 159 | return false; |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | /** @var LoggerInterface $logger */ |
| 125 | 125 | $logger = \OC::$server->get(LoggerInterface::class); |
| 126 | 126 | |
| 127 | - $plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValueString('skeletondirectory', \OC::$SERVERROOT . '/core/skeleton'); |
|
| 127 | + $plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValueString('skeletondirectory', \OC::$SERVERROOT.'/core/skeleton'); |
|
| 128 | 128 | $userLang = \OC::$server->get(IFactory::class)->findLanguage(); |
| 129 | 129 | $skeletonDirectory = str_replace('{lang}', $userLang, $plainSkeletonDirectory); |
| 130 | 130 | |
@@ -146,13 +146,13 @@ discard block |
||
| 146 | 146 | if ($instanceId === null) { |
| 147 | 147 | throw new \RuntimeException('no instance id!'); |
| 148 | 148 | } |
| 149 | - $appdata = 'appdata_' . $instanceId; |
|
| 149 | + $appdata = 'appdata_'.$instanceId; |
|
| 150 | 150 | if ($userId === $appdata) { |
| 151 | - throw new \RuntimeException('username is reserved name: ' . $appdata); |
|
| 151 | + throw new \RuntimeException('username is reserved name: '.$appdata); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | if (!empty($skeletonDirectory)) { |
| 155 | - $logger->debug('copying skeleton for ' . $userId . ' from ' . $skeletonDirectory . ' to ' . $userDirectory->getFullPath('/'), ['app' => 'files_skeleton']); |
|
| 155 | + $logger->debug('copying skeleton for '.$userId.' from '.$skeletonDirectory.' to '.$userDirectory->getFullPath('/'), ['app' => 'files_skeleton']); |
|
| 156 | 156 | self::copyr($skeletonDirectory, $userDirectory); |
| 157 | 157 | // update the file cache |
| 158 | 158 | $userDirectory->getStorage()->getScanner()->scan('', \OC\Files\Cache\Scanner::SCAN_RECURSIVE); |
@@ -183,13 +183,13 @@ discard block |
||
| 183 | 183 | // Copy the files |
| 184 | 184 | while (false !== ($file = readdir($dir))) { |
| 185 | 185 | if (!\OC\Files\Filesystem::isIgnoredDir($file)) { |
| 186 | - if (is_dir($source . '/' . $file)) { |
|
| 186 | + if (is_dir($source.'/'.$file)) { |
|
| 187 | 187 | $child = $target->newFolder($file); |
| 188 | - self::copyr($source . '/' . $file, $child); |
|
| 188 | + self::copyr($source.'/'.$file, $child); |
|
| 189 | 189 | } else { |
| 190 | - $sourceStream = fopen($source . '/' . $file, 'r'); |
|
| 190 | + $sourceStream = fopen($source.'/'.$file, 'r'); |
|
| 191 | 191 | if ($sourceStream === false) { |
| 192 | - $logger->error(sprintf('Could not fopen "%s"', $source . '/' . $file), ['app' => 'core']); |
|
| 192 | + $logger->error(sprintf('Could not fopen "%s"', $source.'/'.$file), ['app' => 'core']); |
|
| 193 | 193 | closedir($dir); |
| 194 | 194 | return; |
| 195 | 195 | } |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | public static function checkServer(\OC\SystemConfig $config) { |
| 305 | 305 | $l = \OC::$server->getL10N('lib'); |
| 306 | 306 | $errors = []; |
| 307 | - $CONFIG_DATADIRECTORY = $config->getValue('datadirectory', OC::$SERVERROOT . '/data'); |
|
| 307 | + $CONFIG_DATADIRECTORY = $config->getValue('datadirectory', OC::$SERVERROOT.'/data'); |
|
| 308 | 308 | |
| 309 | 309 | if (!self::needUpgrade($config) && $config->getValue('installed', false)) { |
| 310 | 310 | // this check needs to be done every time |
@@ -331,14 +331,14 @@ discard block |
||
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | // Check if config folder is writable. |
| 334 | - if (!(bool)$config->getValue('config_is_read_only', false)) { |
|
| 334 | + if (!(bool) $config->getValue('config_is_read_only', false)) { |
|
| 335 | 335 | if (!is_writable(OC::$configDir) || !is_readable(OC::$configDir)) { |
| 336 | 336 | $errors[] = [ |
| 337 | 337 | 'error' => $l->t('Cannot write into "config" directory.'), |
| 338 | 338 | 'hint' => $l->t('This can usually be fixed by giving the web server write access to the config directory. See %s', |
| 339 | - [ $urlGenerator->linkToDocs('admin-dir_permissions') ]) . '. ' |
|
| 339 | + [$urlGenerator->linkToDocs('admin-dir_permissions')]).'. ' |
|
| 340 | 340 | . $l->t('Or, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it. See %s', |
| 341 | - [ $urlGenerator->linkToDocs('admin-config') ]) |
|
| 341 | + [$urlGenerator->linkToDocs('admin-config')]) |
|
| 342 | 342 | ]; |
| 343 | 343 | } |
| 344 | 344 | } |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | ]; |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | - if (!file_exists($dataDirectory . '/.ncdata')) { |
|
| 536 | + if (!file_exists($dataDirectory.'/.ncdata')) { |
|
| 537 | 537 | $errors[] = [ |
| 538 | 538 | 'error' => $l->t('Your data directory is invalid.'), |
| 539 | 539 | 'hint' => $l->t('Ensure there is a file called "%1$s" in the root of the data directory. It should have the content: "%2$s"', ['.ncdata', '# Nextcloud data directory']), |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | public static function checkLoggedIn(): void { |
| 552 | 552 | // Check if we are a user |
| 553 | 553 | if (!\OC::$server->getUserSession()->isLoggedIn()) { |
| 554 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute( |
|
| 554 | + header('Location: '.\OC::$server->getURLGenerator()->linkToRoute( |
|
| 555 | 555 | 'core.login.showLoginForm', |
| 556 | 556 | [ |
| 557 | 557 | 'redirect_url' => \OC::$server->getRequest()->getRequestUri(), |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | } |
| 563 | 563 | // Redirect to 2FA challenge selection if 2FA challenge was not solved yet |
| 564 | 564 | if (\OC::$server->get(TwoFactorAuthManager::class)->needsSecondFactor(\OC::$server->getUserSession()->getUser())) { |
| 565 | - header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge')); |
|
| 565 | + header('Location: '.\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge')); |
|
| 566 | 566 | exit(); |
| 567 | 567 | } |
| 568 | 568 | } |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | public static function checkAdminUser(): void { |
| 576 | 576 | self::checkLoggedIn(); |
| 577 | 577 | if (!OC_User::isAdminUser(OC_User::getUser())) { |
| 578 | - header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php')); |
|
| 578 | + header('Location: '.\OCP\Util::linkToAbsolute('', 'index.php')); |
|
| 579 | 579 | exit(); |
| 580 | 580 | } |
| 581 | 581 | } |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | */ |
| 602 | 602 | public static function redirectToDefaultPage(): void { |
| 603 | 603 | $location = self::getDefaultPageUrl(); |
| 604 | - header('Location: ' . $location); |
|
| 604 | + header('Location: '.$location); |
|
| 605 | 605 | exit(); |
| 606 | 606 | } |
| 607 | 607 | |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | $id = \OC::$server->getSystemConfig()->getValue('instanceid', null); |
| 615 | 615 | if (is_null($id)) { |
| 616 | 616 | // We need to guarantee at least one letter in instanceid so it can be used as the session_name |
| 617 | - $id = 'oc' . \OC::$server->get(ISecureRandom::class)->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER . \OCP\Security\ISecureRandom::CHAR_DIGITS); |
|
| 617 | + $id = 'oc'.\OC::$server->get(ISecureRandom::class)->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); |
|
| 618 | 618 | \OC::$server->getSystemConfig()->setValue('instanceid', $id); |
| 619 | 619 | } |
| 620 | 620 | return $id; |
@@ -632,12 +632,12 @@ discard block |
||
| 632 | 632 | */ |
| 633 | 633 | public static function sanitizeHTML($value) { |
| 634 | 634 | if (is_array($value)) { |
| 635 | - $value = array_map(function ($value) { |
|
| 635 | + $value = array_map(function($value) { |
|
| 636 | 636 | return self::sanitizeHTML($value); |
| 637 | 637 | }, $value); |
| 638 | 638 | } else { |
| 639 | 639 | // Specify encoding for PHP<5.4 |
| 640 | - $value = htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8'); |
|
| 640 | + $value = htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8'); |
|
| 641 | 641 | } |
| 642 | 642 | return $value; |
| 643 | 643 | } |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | $theme = \OC::$server->getSystemConfig()->getValue('theme', ''); |
| 752 | 752 | |
| 753 | 753 | if ($theme === '') { |
| 754 | - if (is_dir(OC::$SERVERROOT . '/themes/default')) { |
|
| 754 | + if (is_dir(OC::$SERVERROOT.'/themes/default')) { |
|
| 755 | 755 | $theme = 'default'; |
| 756 | 756 | } |
| 757 | 757 | } |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | |
| 773 | 773 | $normalizedValue = Normalizer::normalize($value); |
| 774 | 774 | if ($normalizedValue === false) { |
| 775 | - \OCP\Server::get(LoggerInterface::class)->warning('normalizing failed for "' . $value . '"', ['app' => 'core']); |
|
| 775 | + \OCP\Server::get(LoggerInterface::class)->warning('normalizing failed for "'.$value.'"', ['app' => 'core']); |
|
| 776 | 776 | return $value; |
| 777 | 777 | } |
| 778 | 778 | |
@@ -799,19 +799,19 @@ discard block |
||
| 799 | 799 | } elseif ($config->getValue('debug', false) && $versionDiff < 0) { |
| 800 | 800 | // downgrade with debug |
| 801 | 801 | $installedMajor = explode('.', $installedVersion); |
| 802 | - $installedMajor = $installedMajor[0] . '.' . $installedMajor[1]; |
|
| 802 | + $installedMajor = $installedMajor[0].'.'.$installedMajor[1]; |
|
| 803 | 803 | $currentMajor = explode('.', $currentVersion); |
| 804 | - $currentMajor = $currentMajor[0] . '.' . $currentMajor[1]; |
|
| 804 | + $currentMajor = $currentMajor[0].'.'.$currentMajor[1]; |
|
| 805 | 805 | if ($installedMajor === $currentMajor) { |
| 806 | 806 | // Same major, allow downgrade for developers |
| 807 | 807 | return true; |
| 808 | 808 | } else { |
| 809 | 809 | // downgrade attempt, throw exception |
| 810 | - throw new \OCP\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')'); |
|
| 810 | + throw new \OCP\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from '.$installedVersion.' to '.$currentVersion.')'); |
|
| 811 | 811 | } |
| 812 | 812 | } elseif ($versionDiff < 0) { |
| 813 | 813 | // downgrade attempt, throw exception |
| 814 | - throw new \OCP\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')'); |
|
| 814 | + throw new \OCP\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from '.$installedVersion.' to '.$currentVersion.')'); |
|
| 815 | 815 | } |
| 816 | 816 | |
| 817 | 817 | // also check for upgrades for apps (independently from the user) |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $appPath = $this->appManager->getAppPath($appId, true); |
| 64 | 64 | |
| 65 | 65 | $l = $this->l10nFactory->get('core'); |
| 66 | - $info = $this->appManager->getAppInfoByPath($appPath . '/appinfo/info.xml', $l->getLanguageCode()); |
|
| 66 | + $info = $this->appManager->getAppInfoByPath($appPath.'/appinfo/info.xml', $l->getLanguageCode()); |
|
| 67 | 67 | |
| 68 | 68 | if (!is_array($info) || $info['id'] !== $appId) { |
| 69 | 69 | throw new \Exception( |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | if ($app['id'] === $appId) { |
| 171 | 171 | // Load the certificate |
| 172 | 172 | $certificate = new X509(); |
| 173 | - $rootCrt = file_get_contents(__DIR__ . '/../../resources/codesigning/root.crt'); |
|
| 173 | + $rootCrt = file_get_contents(__DIR__.'/../../resources/codesigning/root.crt'); |
|
| 174 | 174 | $rootCrts = $this->splitCerts($rootCrt); |
| 175 | 175 | foreach ($rootCrts as $rootCrt) { |
| 176 | 176 | $certificate->loadCA($rootCrt); |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | foreach ($rootCrts as $rootCrt) { |
| 183 | 183 | $crl->loadCA($rootCrt); |
| 184 | 184 | } |
| 185 | - $crl->loadCRL(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crl')); |
|
| 185 | + $crl->loadCRL(file_get_contents(__DIR__.'/../../resources/codesigning/root.crl')); |
|
| 186 | 186 | if ($crl->validateSignature() !== true) { |
| 187 | 187 | throw new \Exception('Could not validate CRL signature'); |
| 188 | 188 | } |
@@ -250,11 +250,11 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | $archive = new TAR($tempFile); |
| 252 | 252 | if (!$archive->extract($extractDir)) { |
| 253 | - $errorMessage = 'Could not extract app ' . $appId; |
|
| 253 | + $errorMessage = 'Could not extract app '.$appId; |
|
| 254 | 254 | |
| 255 | 255 | $archiveError = $archive->getError(); |
| 256 | 256 | if ($archiveError instanceof \PEAR_Error) { |
| 257 | - $errorMessage .= ': ' . $archiveError->getMessage(); |
|
| 257 | + $errorMessage .= ': '.$archiveError->getMessage(); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | throw new \Exception($errorMessage); |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | // Check if appinfo/info.xml has the same app ID as well |
| 285 | - $xml = simplexml_load_string(file_get_contents($extractDir . '/' . $folders[0] . '/appinfo/info.xml')); |
|
| 285 | + $xml = simplexml_load_string(file_get_contents($extractDir.'/'.$folders[0].'/appinfo/info.xml')); |
|
| 286 | 286 | |
| 287 | 287 | if ($xml === false) { |
| 288 | 288 | throw new \Exception( |
@@ -293,19 +293,19 @@ discard block |
||
| 293 | 293 | ); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - if ((string)$xml->id !== $appId) { |
|
| 296 | + if ((string) $xml->id !== $appId) { |
|
| 297 | 297 | throw new \Exception( |
| 298 | 298 | sprintf( |
| 299 | 299 | 'App for id %s has a wrong app ID in info.xml: %s', |
| 300 | 300 | $appId, |
| 301 | - (string)$xml->id |
|
| 301 | + (string) $xml->id |
|
| 302 | 302 | ) |
| 303 | 303 | ); |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | // Check if the version is lower than before |
| 307 | 307 | $currentVersion = $this->appManager->getAppVersion($appId, true); |
| 308 | - $newVersion = (string)$xml->version; |
|
| 308 | + $newVersion = (string) $xml->version; |
|
| 309 | 309 | if (version_compare($currentVersion, $newVersion) === 1) { |
| 310 | 310 | throw new \Exception( |
| 311 | 311 | sprintf( |
@@ -317,12 +317,12 @@ discard block |
||
| 317 | 317 | ); |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - $baseDir = $installPath . '/' . $appId; |
|
| 320 | + $baseDir = $installPath.'/'.$appId; |
|
| 321 | 321 | // Remove old app with the ID if existent |
| 322 | 322 | Files::rmdirr($baseDir); |
| 323 | 323 | // Move to app folder |
| 324 | 324 | if (@mkdir($baseDir)) { |
| 325 | - $extractDir .= '/' . $folders[0]; |
|
| 325 | + $extractDir .= '/'.$folders[0]; |
|
| 326 | 326 | } |
| 327 | 327 | // otherwise we just copy the outer directory |
| 328 | 328 | $this->copyRecursive($extractDir, $baseDir); |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | * @param bool $allowUnstable |
| 358 | 358 | * @return string|false false or the version number of the update |
| 359 | 359 | */ |
| 360 | - public function isUpdateAvailable($appId, $allowUnstable = false): string|false { |
|
| 360 | + public function isUpdateAvailable($appId, $allowUnstable = false): string | false { |
|
| 361 | 361 | if ($this->isInstanceReadyForUpdates === null) { |
| 362 | 362 | $installPath = $this->getInstallPath(); |
| 363 | 363 | if ($installPath === null) { |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | private function isInstalledFromGit(string $appId): bool { |
| 407 | 407 | try { |
| 408 | 408 | $appPath = $this->appManager->getAppPath($appId); |
| 409 | - return file_exists($appPath . '/.git/'); |
|
| 409 | + return file_exists($appPath.'/.git/'); |
|
| 410 | 410 | } catch (AppPathNotFoundException) { |
| 411 | 411 | return false; |
| 412 | 412 | } |
@@ -453,11 +453,11 @@ discard block |
||
| 453 | 453 | $this->logger->error('No application directories are marked as writable.', ['app' => 'core']); |
| 454 | 454 | return false; |
| 455 | 455 | } |
| 456 | - $appDir = $installPath . '/' . $appId; |
|
| 456 | + $appDir = $installPath.'/'.$appId; |
|
| 457 | 457 | Files::rmdirr($appDir); |
| 458 | 458 | return true; |
| 459 | 459 | } else { |
| 460 | - $this->logger->error('can\'t remove app ' . $appId . '. It is not installed.'); |
|
| 460 | + $this->logger->error('can\'t remove app '.$appId.'. It is not installed.'); |
|
| 461 | 461 | |
| 462 | 462 | return false; |
| 463 | 463 | } |
@@ -498,8 +498,8 @@ discard block |
||
| 498 | 498 | foreach (\OC::$APPSROOTS as $app_dir) { |
| 499 | 499 | if ($dir = opendir($app_dir['path'])) { |
| 500 | 500 | while (false !== ($filename = readdir($dir))) { |
| 501 | - if ($filename[0] !== '.' && is_dir($app_dir['path'] . "/$filename")) { |
|
| 502 | - if (file_exists($app_dir['path'] . "/$filename/appinfo/info.xml")) { |
|
| 501 | + if ($filename[0] !== '.' && is_dir($app_dir['path']."/$filename")) { |
|
| 502 | + if (file_exists($app_dir['path']."/$filename/appinfo/info.xml")) { |
|
| 503 | 503 | if ($this->config->getAppValue($filename, 'installed_version') === '') { |
| 504 | 504 | $enabled = $this->appManager->isDefaultEnabled($filename); |
| 505 | 505 | if (($enabled || in_array($filename, $this->appManager->getAlwaysEnabledApps())) |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | if ($output instanceof IOutput) { |
| 552 | - $output->debug('Registering tasks of ' . $info['id']); |
|
| 552 | + $output->debug('Registering tasks of '.$info['id']); |
|
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | // Setup background jobs |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | // Run deprecated appinfo/install.php if any |
| 562 | - $appInstallScriptPath = $appPath . '/appinfo/install.php'; |
|
| 562 | + $appInstallScriptPath = $appPath.'/appinfo/install.php'; |
|
| 563 | 563 | if (file_exists($appInstallScriptPath)) { |
| 564 | 564 | $this->logger->warning('Using an appinfo/install.php file is deprecated. Application "{app}" still uses one.', [ |
| 565 | 565 | 'app' => $info['id'], |
@@ -575,10 +575,10 @@ discard block |
||
| 575 | 575 | |
| 576 | 576 | // Set remote/public handlers |
| 577 | 577 | foreach ($info['remote'] as $name => $path) { |
| 578 | - $this->config->setAppValue('core', 'remote_' . $name, $info['id'] . '/' . $path); |
|
| 578 | + $this->config->setAppValue('core', 'remote_'.$name, $info['id'].'/'.$path); |
|
| 579 | 579 | } |
| 580 | 580 | foreach ($info['public'] as $name => $path) { |
| 581 | - $this->config->setAppValue('core', 'public_' . $name, $info['id'] . '/' . $path); |
|
| 581 | + $this->config->setAppValue('core', 'public_'.$name, $info['id'].'/'.$path); |
|
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | \OC_App::setAppTypes($info['id']); |
@@ -589,9 +589,9 @@ discard block |
||
| 589 | 589 | /** |
| 590 | 590 | * install an app already placed in the app folder |
| 591 | 591 | */ |
| 592 | - public function installShippedApp(string $app, ?IOutput $output = null): string|false { |
|
| 592 | + public function installShippedApp(string $app, ?IOutput $output = null): string | false { |
|
| 593 | 593 | if ($output instanceof IOutput) { |
| 594 | - $output->debug('Installing ' . $app); |
|
| 594 | + $output->debug('Installing '.$app); |
|
| 595 | 595 | } |
| 596 | 596 | $info = $this->appManager->getAppInfo($app); |
| 597 | 597 | if (is_null($info) || $info['id'] !== $app) { |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function getLastLogin(): int { |
| 208 | 208 | if ($this->lastLogin === null) { |
| 209 | - $this->lastLogin = (int)$this->config->getUserValue($this->uid, 'login', 'lastLogin', 0); |
|
| 209 | + $this->lastLogin = (int) $this->config->getUserValue($this->uid, 'login', 'lastLogin', 0); |
|
| 210 | 210 | } |
| 211 | 211 | return $this->lastLogin; |
| 212 | 212 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public function getFirstLogin(): int { |
| 219 | 219 | if ($this->firstLogin === null) { |
| 220 | - $this->firstLogin = (int)$this->config->getUserValue($this->uid, 'login', 'firstLogin', 0); |
|
| 220 | + $this->firstLogin = (int) $this->config->getUserValue($this->uid, 'login', 'firstLogin', 0); |
|
| 221 | 221 | } |
| 222 | 222 | return $this->firstLogin; |
| 223 | 223 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | if ($now - $previousLogin > 60) { |
| 235 | 235 | $this->lastLogin = $now; |
| 236 | - $this->config->setUserValue($this->uid, 'login', 'lastLogin', (string)$this->lastLogin); |
|
| 236 | + $this->config->setUserValue($this->uid, 'login', 'lastLogin', (string) $this->lastLogin); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | if ($firstLogin === 0) { |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | /* Unknown first login, most likely was before upgrade to Nextcloud 31 */ |
| 244 | 244 | $this->firstLogin = -1; |
| 245 | 245 | } |
| 246 | - $this->config->setUserValue($this->uid, 'login', 'firstLogin', (string)$this->firstLogin); |
|
| 246 | + $this->config->setUserValue($this->uid, 'login', 'firstLogin', (string) $this->firstLogin); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | return $firstTimeLogin; |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | if (($this->backend instanceof IGetHomeBackend || $this->backend->implementsActions(Backend::GET_HOME)) && $home = $this->backend->getHome($this->uid)) { |
| 392 | 392 | $this->home = $home; |
| 393 | 393 | } else { |
| 394 | - $this->home = $this->config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/' . $this->uid; |
|
| 394 | + $this->home = $this->config->getSystemValueString('datadirectory', \OC::$SERVERROOT.'/data').'/'.$this->uid; |
|
| 395 | 395 | } |
| 396 | 396 | } |
| 397 | 397 | return $this->home; |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | * @return bool |
| 460 | 460 | */ |
| 461 | 461 | public function isEnabled() { |
| 462 | - $queryDatabaseValue = function (): bool { |
|
| 462 | + $queryDatabaseValue = function(): bool { |
|
| 463 | 463 | if ($this->enabled === null) { |
| 464 | 464 | $enabled = $this->config->getUserValue($this->uid, 'core', 'enabled', 'true'); |
| 465 | 465 | $this->enabled = $enabled === 'true'; |
@@ -480,12 +480,12 @@ discard block |
||
| 480 | 480 | */ |
| 481 | 481 | public function setEnabled(bool $enabled = true) { |
| 482 | 482 | $oldStatus = $this->isEnabled(); |
| 483 | - $setDatabaseValue = function (bool $enabled): void { |
|
| 483 | + $setDatabaseValue = function(bool $enabled): void { |
|
| 484 | 484 | $this->config->setUserValue($this->uid, 'core', 'enabled', $enabled ? 'true' : 'false'); |
| 485 | 485 | $this->enabled = $enabled; |
| 486 | 486 | }; |
| 487 | 487 | if ($this->backend instanceof IProvideEnabledStateBackend) { |
| 488 | - $queryDatabaseValue = function (): bool { |
|
| 488 | + $queryDatabaseValue = function(): bool { |
|
| 489 | 489 | if ($this->enabled === null) { |
| 490 | 490 | $enabled = $this->config->getUserValue($this->uid, 'core', 'enabled', 'true'); |
| 491 | 491 | $this->enabled = $enabled === 'true'; |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | return $quota; |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | - public function getQuotaBytes(): int|float { |
|
| 565 | + public function getQuotaBytes(): int | float { |
|
| 566 | 566 | $quota = $this->getQuota(); |
| 567 | 567 | if ($quota === 'none') { |
| 568 | 568 | return \OCP\Files\FileInfo::SPACE_UNLIMITED; |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | if ($quota !== 'none' && $quota !== 'default') { |
| 589 | 589 | $bytesQuota = \OCP\Util::computerFileSize($quota); |
| 590 | 590 | if ($bytesQuota === false) { |
| 591 | - throw new InvalidArgumentException('Failed to set quota to invalid value ' . $quota); |
|
| 591 | + throw new InvalidArgumentException('Failed to set quota to invalid value '.$quota); |
|
| 592 | 592 | } |
| 593 | 593 | $quota = \OCP\Util::humanFileSize($bytesQuota); |
| 594 | 594 | } |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | $this->config->setUserValue($this->uid, 'files', 'quota', $quota); |
| 597 | 597 | $this->triggerChange('quota', $quota, $oldQuota); |
| 598 | 598 | } |
| 599 | - \OC_Helper::clearStorageInfo('/' . $this->uid . '/files'); |
|
| 599 | + \OC_Helper::clearStorageInfo('/'.$this->uid.'/files'); |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | public function getManagerUids(): array { |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | $server = substr($server, 0, -10); |
| 656 | 656 | } |
| 657 | 657 | $server = $this->removeProtocolFromUrl($server); |
| 658 | - return $uid . '@' . $server; |
|
| 658 | + return $uid.'@'.$server; |
|
| 659 | 659 | } |
| 660 | 660 | |
| 661 | 661 | private function removeProtocolFromUrl(string $url): string { |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | header('X-Accel-Buffering: no'); |
| 34 | 34 | $this->fallback = isset($_GET['fallback']) && $_GET['fallback'] == 'true'; |
| 35 | 35 | if ($this->fallback) { |
| 36 | - $this->fallBackId = (int)$_GET['fallback_id']; |
|
| 36 | + $this->fallBackId = (int) $_GET['fallback_id']; |
|
| 37 | 37 | /** |
| 38 | 38 | * FIXME: The default content-security-policy of ownCloud forbids inline |
| 39 | 39 | * JavaScript for security reasons. IE starting on Windows 10 will |
@@ -46,12 +46,12 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | header("Content-Security-Policy: default-src 'none'; script-src 'unsafe-inline'"); |
| 48 | 48 | header('Content-Type: text/html'); |
| 49 | - echo str_repeat('<span></span>' . PHP_EOL, 10); //dummy data to keep IE happy |
|
| 49 | + echo str_repeat('<span></span>'.PHP_EOL, 10); //dummy data to keep IE happy |
|
| 50 | 50 | } else { |
| 51 | 51 | header('Content-Type: text/event-stream'); |
| 52 | 52 | } |
| 53 | 53 | if (!$this->request->passesStrictCookieCheck()) { |
| 54 | - header('Location: ' . \OC::$WEBROOT); |
|
| 54 | + header('Location: '.\OC::$WEBROOT); |
|
| 55 | 55 | exit(); |
| 56 | 56 | } |
| 57 | 57 | if (!$this->request->passesCSRFCheck()) { |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function send($type, $data = null) { |
| 76 | 76 | if ($data && !preg_match('/^[A-Za-z0-9_]+$/', $type)) { |
| 77 | - throw new \BadMethodCallException('Type needs to be alphanumeric (' . $type . ')'); |
|
| 77 | + throw new \BadMethodCallException('Type needs to be alphanumeric ('.$type.')'); |
|
| 78 | 78 | } |
| 79 | 79 | $this->init(); |
| 80 | 80 | if (is_null($data)) { |
@@ -83,13 +83,13 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | if ($this->fallback) { |
| 85 | 85 | $response = '<script type="text/javascript">window.parent.OC.EventSource.fallBackCallBack(' |
| 86 | - . $this->fallBackId . ',"' . ($type ?? '') . '",' . json_encode($data, JSON_HEX_TAG) . ')</script>' . PHP_EOL; |
|
| 86 | + . $this->fallBackId.',"'.($type ?? '').'",'.json_encode($data, JSON_HEX_TAG).')</script>'.PHP_EOL; |
|
| 87 | 87 | echo $response; |
| 88 | 88 | } else { |
| 89 | 89 | if ($type) { |
| 90 | - echo 'event: ' . $type . PHP_EOL; |
|
| 90 | + echo 'event: '.$type.PHP_EOL; |
|
| 91 | 91 | } |
| 92 | - echo 'data: ' . json_encode($data, JSON_HEX_TAG) . PHP_EOL; |
|
| 92 | + echo 'data: '.json_encode($data, JSON_HEX_TAG).PHP_EOL; |
|
| 93 | 93 | } |
| 94 | 94 | echo PHP_EOL; |
| 95 | 95 | flush(); |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | return $this->checkMask(Constants::PERMISSION_DELETE) && parent::unlink($path); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public function file_put_contents(string $path, mixed $data): int|float|false { |
|
| 91 | + public function file_put_contents(string $path, mixed $data): int | float | false { |
|
| 92 | 92 | $permissions = $this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE; |
| 93 | 93 | return $this->checkMask($permissions) ? parent::file_put_contents($path, $data) : false; |
| 94 | 94 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | } else { |
| 100 | 100 | // Update old classes to new namespace |
| 101 | 101 | if (str_contains($storage, 'OC_Filestorage_')) { |
| 102 | - $storage = '\OC\Files\Storage\\' . substr($storage, 15); |
|
| 102 | + $storage = '\OC\Files\Storage\\'.substr($storage, 15); |
|
| 103 | 103 | } |
| 104 | 104 | $this->class = $storage; |
| 105 | 105 | $this->arguments = $arguments; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | return; |
| 157 | 157 | } |
| 158 | 158 | } else { |
| 159 | - \OC::$server->get(LoggerInterface::class)->error('Storage backend ' . $this->class . ' not found', ['app' => 'core']); |
|
| 159 | + \OC::$server->get(LoggerInterface::class)->error('Storage backend '.$this->class.' not found', ['app' => 'core']); |
|
| 160 | 160 | $this->invalidStorage = true; |
| 161 | 161 | return; |
| 162 | 162 | } |
@@ -209,13 +209,13 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | public function getInternalPath($path) { |
| 211 | 211 | $path = Filesystem::normalizePath($path, true, false, true); |
| 212 | - if ($this->mountPoint === $path || $this->mountPoint . '/' === $path) { |
|
| 212 | + if ($this->mountPoint === $path || $this->mountPoint.'/' === $path) { |
|
| 213 | 213 | $internalPath = ''; |
| 214 | 214 | } else { |
| 215 | 215 | $internalPath = substr($path, strlen($this->mountPoint)); |
| 216 | 216 | } |
| 217 | 217 | // substr returns false instead of an empty string, we always want a string |
| 218 | - return (string)$internalPath; |
|
| 218 | + return (string) $internalPath; |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | /** |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | if ($storage === null) { |
| 274 | 274 | $this->rootId = -1; |
| 275 | 275 | } else { |
| 276 | - $this->rootId = (int)$storage->getCache()->getId(''); |
|
| 276 | + $this->rootId = (int) $storage->getCache()->getId(''); |
|
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | return $this->rootId; |