Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3223,25 +3223,6 @@
<code><![CDATA[$this->providers]]></code>
</UndefinedInterfaceMethod>
</file>
<file src="lib/private/Authentication/WebAuthn/Manager.php">
<InvalidNullableReturnType>
<code><![CDATA[string]]></code>
</InvalidNullableReturnType>
<NullableReturnStatement>
<code><![CDATA[preg_replace('/(:\d+$)/', '', $serverHost)]]></code>
</NullableReturnStatement>
</file>
<file src="lib/private/Avatar/Avatar.php">
<FalsableReturnStatement>
<code><![CDATA[$data]]></code>
</FalsableReturnStatement>
</file>
<file src="lib/private/Cache/File.php">
<LessSpecificImplementedReturnType>
<code><![CDATA[bool|mixed]]></code>
<code><![CDATA[bool|mixed]]></code>
</LessSpecificImplementedReturnType>
</file>
<file src="lib/private/Calendar/Manager.php">
<LessSpecificReturnStatement>
<code><![CDATA[array_merge(
Expand Down
22 changes: 4 additions & 18 deletions lib/OC.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use OCP\App\Events\AppsLoadedEvent;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Events\BeforeFileSystemSetupEvent;
use OCP\Files\ISetupManager;
use OCP\Group\Events\GroupDeletedEvent;
use OCP\Group\Events\UserRemovedEvent;
use OCP\IAppConfig;
Expand Down Expand Up @@ -1023,29 +1024,14 @@ public static function registerCleanupHooks(\OC\SystemConfig $systemConfig): voi
// NOTE: This will be replaced to use OCP
$userSession = Server::get(\OC\User\Session::class);
$userSession->listen('\OC\User', 'postLogin', function () use ($userSession) {
if (!defined('PHPUNIT_RUN') && $userSession->isLoggedIn()) {
if (!defined('PHPUNIT_RUN') && $userSession->isLoggedIn() && ($user = $userSession->getUser()) !== null) {
// reset brute force delay for this IP address and username
$uid = $userSession->getUser()->getUID();
$uid = $user->getUID();
$request = Server::get(IRequest::class);
$throttler = Server::get(IThrottler::class);
$throttler->resetDelay($request->getRemoteAddress(), 'login', ['user' => $uid]);

try {
$cache = new \OC\Cache\File();
$cache->gc();
} catch (\OC\ServerNotAvailableException $e) {
// not a GC exception, pass it on
throw $e;
} catch (\OC\ForbiddenException $e) {
// filesystem blocked for this request, ignore
} catch (\Exception $e) {
// a GC exception should not prevent users from using OC,
// so log the exception
Server::get(LoggerInterface::class)->warning('Exception when running cache gc.', [
'app' => 'core',
'exception' => $e,
]);
}
Server::get(ISetupManager::class)->setupForUser($user);
}
});
}
Expand Down
1 change: 0 additions & 1 deletion lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,6 @@
'OC\\BinaryFinder' => $baseDir . '/lib/private/BinaryFinder.php',
'OC\\Blurhash\\Listener\\GenerateBlurhashMetadata' => $baseDir . '/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php',
'OC\\Broadcast\\Events\\BroadcastEvent' => $baseDir . '/lib/private/Broadcast/Events/BroadcastEvent.php',
'OC\\Cache\\File' => $baseDir . '/lib/private/Cache/File.php',
'OC\\Calendar\\AvailabilityResult' => $baseDir . '/lib/private/Calendar/AvailabilityResult.php',
'OC\\Calendar\\CalendarEventBuilder' => $baseDir . '/lib/private/Calendar/CalendarEventBuilder.php',
'OC\\Calendar\\CalendarQuery' => $baseDir . '/lib/private/Calendar/CalendarQuery.php',
Expand Down
1 change: 0 additions & 1 deletion lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\BinaryFinder' => __DIR__ . '/../../..' . '/lib/private/BinaryFinder.php',
'OC\\Blurhash\\Listener\\GenerateBlurhashMetadata' => __DIR__ . '/../../..' . '/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php',
'OC\\Broadcast\\Events\\BroadcastEvent' => __DIR__ . '/../../..' . '/lib/private/Broadcast/Events/BroadcastEvent.php',
'OC\\Cache\\File' => __DIR__ . '/../../..' . '/lib/private/Cache/File.php',
'OC\\Calendar\\AvailabilityResult' => __DIR__ . '/../../..' . '/lib/private/Calendar/AvailabilityResult.php',
'OC\\Calendar\\CalendarEventBuilder' => __DIR__ . '/../../..' . '/lib/private/Calendar/CalendarEventBuilder.php',
'OC\\Calendar\\CalendarQuery' => __DIR__ . '/../../..' . '/lib/private/Calendar/CalendarQuery.php',
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Authentication/WebAuthn/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function finishRegister(PublicKeyCredentialCreationOptions $publicKeyCred
}

private function stripPort(string $serverHost): string {
return preg_replace('/(:\d+$)/', '', $serverHost);
return preg_replace('/(:\d+$)/', '', $serverHost) ?? '';
}

public function startAuthentication(string $uid, string $serverHost): PublicKeyCredentialRequestOptions {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Avatar/Avatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ protected function generateAvatar(string $userDisplayName, int $size, bool $dark
$data = ob_get_contents();
ob_end_clean();

return $data;
return $data ?: '';
}

/**
Expand Down
202 changes: 0 additions & 202 deletions lib/private/Cache/File.php

This file was deleted.

11 changes: 10 additions & 1 deletion lib/private/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,16 @@ public function __construct(

$this->registerAlias(IURLGenerator::class, URLGenerator::class);

$this->registerAlias(ICache::class, Cache\File::class);
$this->registerService(ICache::class, static function ($c) {
/** @var LoggerInterface $logger */
$logger = $c->get(LoggerInterface::class);
$logger->debug('The requested service "' . ICache::class . '" is deprecated. Please use "' . ICacheFactory::class . '" instead to create a cache. This service will be removed in a future Nextcloud version.', ['app' => 'serverDI']);

/** @var ICacheFactory $cacheFactory */
$cacheFactory = $c->get(ICacheFactory::class);
return $cacheFactory->isLocalCacheAvailable() ? $cacheFactory->createLocal() : $cacheFactory->createInMemory();
});

$this->registerService(Factory::class, static function (Server $c) {
$profiler = $c->get(IProfiler::class);
$logger = $c->get(LoggerInterface::class);
Expand Down
Loading
Loading