@@ -30,10 +30,10 @@ |
||
30 | 30 | * @since 24.0.7 |
31 | 31 | */ |
32 | 32 | interface ICountMappedUsersBackend { |
33 | - /** |
|
34 | - * @since 24.0.7 |
|
35 | - * |
|
36 | - * @return int The number of users already mapped to a Nextcloud account |
|
37 | - */ |
|
38 | - public function countMappedUsers(): int; |
|
33 | + /** |
|
34 | + * @since 24.0.7 |
|
35 | + * |
|
36 | + * @return int The number of users already mapped to a Nextcloud account |
|
37 | + */ |
|
38 | + public function countMappedUsers(): int; |
|
39 | 39 | } |
@@ -62,9 +62,9 @@ |
||
62 | 62 | } |
63 | 63 | /* Replace by normalized form */ |
64 | 64 | if ($parsedIp instanceof IPv6) { |
65 | - $ip = (string)($parsedIp->toIPv4() ?? $parsedIp); |
|
65 | + $ip = (string) ($parsedIp->toIPv4() ?? $parsedIp); |
|
66 | 66 | } else { |
67 | - $ip = (string)$parsedIp; |
|
67 | + $ip = (string) $parsedIp; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { |
@@ -21,41 +21,41 @@ |
||
21 | 21 | * @internal |
22 | 22 | */ |
23 | 23 | class IpAddressClassifier { |
24 | - private const LOCAL_ADDRESS_RANGES = [ |
|
25 | - '100.64.0.0/10', // See RFC 6598 |
|
26 | - '192.0.0.0/24', // See RFC 6890 |
|
27 | - ]; |
|
28 | - |
|
29 | - /** |
|
30 | - * Check host identifier for local IPv4 and IPv6 address ranges |
|
31 | - * |
|
32 | - * Hostnames are not considered local. Use the HostnameClassifier for those. |
|
33 | - */ |
|
34 | - public function isLocalAddress(string $ip): bool { |
|
35 | - $parsedIp = Factory::parseAddressString( |
|
36 | - $ip, |
|
37 | - ParseStringFlag::IPV4_MAYBE_NON_DECIMAL | ParseStringFlag::IPV4ADDRESS_MAYBE_NON_QUAD_DOTTED | ParseStringFlag::MAY_INCLUDE_ZONEID |
|
38 | - ); |
|
39 | - if ($parsedIp === null) { |
|
40 | - /* Not an IP */ |
|
41 | - return false; |
|
42 | - } |
|
43 | - /* Replace by normalized form */ |
|
44 | - if ($parsedIp instanceof IPv6) { |
|
45 | - $ip = (string)($parsedIp->toIPv4() ?? $parsedIp); |
|
46 | - } else { |
|
47 | - $ip = (string)$parsedIp; |
|
48 | - } |
|
49 | - |
|
50 | - if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { |
|
51 | - /* Range address */ |
|
52 | - return true; |
|
53 | - } |
|
54 | - if (IpUtils::checkIp($ip, self::LOCAL_ADDRESS_RANGES)) { |
|
55 | - /* Within local range */ |
|
56 | - return true; |
|
57 | - } |
|
58 | - |
|
59 | - return false; |
|
60 | - } |
|
24 | + private const LOCAL_ADDRESS_RANGES = [ |
|
25 | + '100.64.0.0/10', // See RFC 6598 |
|
26 | + '192.0.0.0/24', // See RFC 6890 |
|
27 | + ]; |
|
28 | + |
|
29 | + /** |
|
30 | + * Check host identifier for local IPv4 and IPv6 address ranges |
|
31 | + * |
|
32 | + * Hostnames are not considered local. Use the HostnameClassifier for those. |
|
33 | + */ |
|
34 | + public function isLocalAddress(string $ip): bool { |
|
35 | + $parsedIp = Factory::parseAddressString( |
|
36 | + $ip, |
|
37 | + ParseStringFlag::IPV4_MAYBE_NON_DECIMAL | ParseStringFlag::IPV4ADDRESS_MAYBE_NON_QUAD_DOTTED | ParseStringFlag::MAY_INCLUDE_ZONEID |
|
38 | + ); |
|
39 | + if ($parsedIp === null) { |
|
40 | + /* Not an IP */ |
|
41 | + return false; |
|
42 | + } |
|
43 | + /* Replace by normalized form */ |
|
44 | + if ($parsedIp instanceof IPv6) { |
|
45 | + $ip = (string)($parsedIp->toIPv4() ?? $parsedIp); |
|
46 | + } else { |
|
47 | + $ip = (string)$parsedIp; |
|
48 | + } |
|
49 | + |
|
50 | + if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { |
|
51 | + /* Range address */ |
|
52 | + return true; |
|
53 | + } |
|
54 | + if (IpUtils::checkIp($ip, self::LOCAL_ADDRESS_RANGES)) { |
|
55 | + /* Within local range */ |
|
56 | + return true; |
|
57 | + } |
|
58 | + |
|
59 | + return false; |
|
60 | + } |
|
61 | 61 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public function onShutdown(): void { |
56 | 56 | $error = error_get_last(); |
57 | 57 | if ($error) { |
58 | - $msg = $error['message'] . ' at ' . $error['file'] . '#' . $error['line']; |
|
58 | + $msg = $error['message'].' at '.$error['file'].'#'.$error['line']; |
|
59 | 59 | $this->logger->critical(self::removePassword($msg), ['app' => 'PHP']); |
60 | 60 | } |
61 | 61 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | public function onException(Throwable $exception): void { |
67 | 67 | $class = get_class($exception); |
68 | 68 | $msg = $exception->getMessage(); |
69 | - $msg = "$class: $msg at " . $exception->getFile() . '#' . $exception->getLine(); |
|
69 | + $msg = "$class: $msg at ".$exception->getFile().'#'.$exception->getLine(); |
|
70 | 70 | $this->logger->critical(self::removePassword($msg), ['app' => 'PHP']); |
71 | 71 | } |
72 | 72 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | if (!(error_reporting() & $number)) { |
78 | 78 | return true; |
79 | 79 | } |
80 | - $msg = $message . ' at ' . $file . '#' . $line; |
|
80 | + $msg = $message.' at '.$file.'#'.$line; |
|
81 | 81 | $e = new Error(self::removePassword($msg)); |
82 | 82 | $this->logger->log(self::errnoToLogLevel($number), $e->getMessage(), ['app' => 'PHP']); |
83 | 83 | return true; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * Recoverable handler which catch all errors, warnings and notices |
88 | 88 | */ |
89 | 89 | public function onAll(int $number, string $message, string $file, int $line): bool { |
90 | - $msg = $message . ' at ' . $file . '#' . $line; |
|
90 | + $msg = $message.' at '.$file.'#'.$line; |
|
91 | 91 | $e = new Error(self::removePassword($msg)); |
92 | 92 | $this->logger->log(self::errnoToLogLevel($number), $e->getMessage(), ['app' => 'PHP']); |
93 | 93 | return true; |
@@ -14,68 +14,68 @@ |
||
14 | 14 | use Throwable; |
15 | 15 | |
16 | 16 | class ErrorHandler { |
17 | - public function __construct( |
|
18 | - private LoggerInterface $logger, |
|
19 | - ) { |
|
20 | - } |
|
17 | + public function __construct( |
|
18 | + private LoggerInterface $logger, |
|
19 | + ) { |
|
20 | + } |
|
21 | 21 | |
22 | - /** |
|
23 | - * Remove password in URLs |
|
24 | - */ |
|
25 | - private static function removePassword(string $msg): string { |
|
26 | - return preg_replace('#//(.*):(.*)@#', '//xxx:xxx@', $msg); |
|
27 | - } |
|
22 | + /** |
|
23 | + * Remove password in URLs |
|
24 | + */ |
|
25 | + private static function removePassword(string $msg): string { |
|
26 | + return preg_replace('#//(.*):(.*)@#', '//xxx:xxx@', $msg); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Fatal errors handler |
|
31 | - */ |
|
32 | - public function onShutdown(): void { |
|
33 | - $error = error_get_last(); |
|
34 | - if ($error) { |
|
35 | - $msg = $error['message'] . ' at ' . $error['file'] . '#' . $error['line']; |
|
36 | - $this->logger->critical(self::removePassword($msg), ['app' => 'PHP']); |
|
37 | - } |
|
38 | - } |
|
29 | + /** |
|
30 | + * Fatal errors handler |
|
31 | + */ |
|
32 | + public function onShutdown(): void { |
|
33 | + $error = error_get_last(); |
|
34 | + if ($error) { |
|
35 | + $msg = $error['message'] . ' at ' . $error['file'] . '#' . $error['line']; |
|
36 | + $this->logger->critical(self::removePassword($msg), ['app' => 'PHP']); |
|
37 | + } |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Uncaught exception handler |
|
42 | - */ |
|
43 | - public function onException(Throwable $exception): void { |
|
44 | - $class = get_class($exception); |
|
45 | - $msg = $exception->getMessage(); |
|
46 | - $msg = "$class: $msg at " . $exception->getFile() . '#' . $exception->getLine(); |
|
47 | - $this->logger->critical(self::removePassword($msg), ['app' => 'PHP']); |
|
48 | - } |
|
40 | + /** |
|
41 | + * Uncaught exception handler |
|
42 | + */ |
|
43 | + public function onException(Throwable $exception): void { |
|
44 | + $class = get_class($exception); |
|
45 | + $msg = $exception->getMessage(); |
|
46 | + $msg = "$class: $msg at " . $exception->getFile() . '#' . $exception->getLine(); |
|
47 | + $this->logger->critical(self::removePassword($msg), ['app' => 'PHP']); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * Recoverable errors handler |
|
52 | - */ |
|
53 | - public function onError(int $number, string $message, string $file, int $line): bool { |
|
54 | - if (!(error_reporting() & $number)) { |
|
55 | - return true; |
|
56 | - } |
|
57 | - $msg = $message . ' at ' . $file . '#' . $line; |
|
58 | - $e = new Error(self::removePassword($msg)); |
|
59 | - $this->logger->log(self::errnoToLogLevel($number), $e->getMessage(), ['app' => 'PHP']); |
|
60 | - return true; |
|
61 | - } |
|
50 | + /** |
|
51 | + * Recoverable errors handler |
|
52 | + */ |
|
53 | + public function onError(int $number, string $message, string $file, int $line): bool { |
|
54 | + if (!(error_reporting() & $number)) { |
|
55 | + return true; |
|
56 | + } |
|
57 | + $msg = $message . ' at ' . $file . '#' . $line; |
|
58 | + $e = new Error(self::removePassword($msg)); |
|
59 | + $this->logger->log(self::errnoToLogLevel($number), $e->getMessage(), ['app' => 'PHP']); |
|
60 | + return true; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Recoverable handler which catch all errors, warnings and notices |
|
65 | - */ |
|
66 | - public function onAll(int $number, string $message, string $file, int $line): bool { |
|
67 | - $msg = $message . ' at ' . $file . '#' . $line; |
|
68 | - $e = new Error(self::removePassword($msg)); |
|
69 | - $this->logger->log(self::errnoToLogLevel($number), $e->getMessage(), ['app' => 'PHP']); |
|
70 | - return true; |
|
71 | - } |
|
63 | + /** |
|
64 | + * Recoverable handler which catch all errors, warnings and notices |
|
65 | + */ |
|
66 | + public function onAll(int $number, string $message, string $file, int $line): bool { |
|
67 | + $msg = $message . ' at ' . $file . '#' . $line; |
|
68 | + $e = new Error(self::removePassword($msg)); |
|
69 | + $this->logger->log(self::errnoToLogLevel($number), $e->getMessage(), ['app' => 'PHP']); |
|
70 | + return true; |
|
71 | + } |
|
72 | 72 | |
73 | - private static function errnoToLogLevel(int $errno): int { |
|
74 | - return match ($errno) { |
|
75 | - E_WARNING, E_USER_WARNING => ILogger::WARN, |
|
76 | - E_DEPRECATED, E_USER_DEPRECATED => ILogger::DEBUG, |
|
77 | - E_NOTICE, E_USER_NOTICE => ILogger::INFO, |
|
78 | - default => ILogger::ERROR, |
|
79 | - }; |
|
80 | - } |
|
73 | + private static function errnoToLogLevel(int $errno): int { |
|
74 | + return match ($errno) { |
|
75 | + E_WARNING, E_USER_WARNING => ILogger::WARN, |
|
76 | + E_DEPRECATED, E_USER_DEPRECATED => ILogger::DEBUG, |
|
77 | + E_NOTICE, E_USER_NOTICE => ILogger::INFO, |
|
78 | + default => ILogger::ERROR, |
|
79 | + }; |
|
80 | + } |
|
81 | 81 | } |
@@ -33,23 +33,23 @@ |
||
33 | 33 | use OCP\Support\Subscription\IRegistry; |
34 | 34 | |
35 | 35 | class Assertion implements IAssertion { |
36 | - private IRegistry $registry; |
|
37 | - private IFactory $l10nFactory; |
|
38 | - private IManager $notificationManager; |
|
36 | + private IRegistry $registry; |
|
37 | + private IFactory $l10nFactory; |
|
38 | + private IManager $notificationManager; |
|
39 | 39 | |
40 | - public function __construct(IRegistry $registry, IFactory $l10nFactory, IManager $notificationManager) { |
|
41 | - $this->registry = $registry; |
|
42 | - $this->l10nFactory = $l10nFactory; |
|
43 | - $this->notificationManager = $notificationManager; |
|
44 | - } |
|
40 | + public function __construct(IRegistry $registry, IFactory $l10nFactory, IManager $notificationManager) { |
|
41 | + $this->registry = $registry; |
|
42 | + $this->l10nFactory = $l10nFactory; |
|
43 | + $this->notificationManager = $notificationManager; |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * @inheritDoc |
|
48 | - */ |
|
49 | - public function createUserIsLegit(): void { |
|
50 | - if ($this->registry->delegateIsHardUserLimitReached($this->notificationManager)) { |
|
51 | - $l = $this->l10nFactory->get('lib'); |
|
52 | - throw new HintException($l->t('The user was not created because the user limit has been reached. Check your notifications to learn more.')); |
|
53 | - } |
|
54 | - } |
|
46 | + /** |
|
47 | + * @inheritDoc |
|
48 | + */ |
|
49 | + public function createUserIsLegit(): void { |
|
50 | + if ($this->registry->delegateIsHardUserLimitReached($this->notificationManager)) { |
|
51 | + $l = $this->l10nFactory->get('lib'); |
|
52 | + throw new HintException($l->t('The user was not created because the user limit has been reached. Check your notifications to learn more.')); |
|
53 | + } |
|
54 | + } |
|
55 | 55 | } |
@@ -20,6 +20,6 @@ |
||
20 | 20 | ); |
21 | 21 | } |
22 | 22 | |
23 | -require_once __DIR__ . '/composer/autoload_real.php'; |
|
23 | +require_once __DIR__.'/composer/autoload_real.php'; |
|
24 | 24 | |
25 | 25 | return ComposerAutoloaderInitDAV::getLoader(); |
@@ -20,6 +20,6 @@ |
||
20 | 20 | ); |
21 | 21 | } |
22 | 22 | |
23 | -require_once __DIR__ . '/composer/autoload_real.php'; |
|
23 | +require_once __DIR__.'/composer/autoload_real.php'; |
|
24 | 24 | |
25 | 25 | return ComposerAutoloaderInitFiles_Versions::getLoader(); |
@@ -20,6 +20,6 @@ |
||
20 | 20 | ); |
21 | 21 | } |
22 | 22 | |
23 | -require_once __DIR__ . '/composer/autoload_real.php'; |
|
23 | +require_once __DIR__.'/composer/autoload_real.php'; |
|
24 | 24 | |
25 | 25 | return ComposerAutoloaderInitLookupServerConnector::getLoader(); |
@@ -20,6 +20,6 @@ |
||
20 | 20 | ); |
21 | 21 | } |
22 | 22 | |
23 | -require_once __DIR__ . '/composer/autoload_real.php'; |
|
23 | +require_once __DIR__.'/composer/autoload_real.php'; |
|
24 | 24 | |
25 | 25 | return ComposerAutoloaderInitCloudFederationAPI::getLoader(); |
@@ -20,6 +20,6 @@ |
||
20 | 20 | ); |
21 | 21 | } |
22 | 22 | |
23 | -require_once __DIR__ . '/composer/autoload_real.php'; |
|
23 | +require_once __DIR__.'/composer/autoload_real.php'; |
|
24 | 24 | |
25 | 25 | return ComposerAutoloaderInitOAuth2::getLoader(); |