Skip to content
Open
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
1 change: 0 additions & 1 deletion apps/files/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
'OCA\\Files\\Activity\\Settings\\FileChanged' => $baseDir . '/../lib/Activity/Settings/FileChanged.php',
'OCA\\Files\\Activity\\Settings\\FileFavoriteChanged' => $baseDir . '/../lib/Activity/Settings/FileFavoriteChanged.php',
'OCA\\Files\\AdvancedCapabilities' => $baseDir . '/../lib/AdvancedCapabilities.php',
'OCA\\Files\\App' => $baseDir . '/../lib/App.php',
'OCA\\Files\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
'OCA\\Files\\BackgroundJob\\CleanupDirectEditingTokens' => $baseDir . '/../lib/BackgroundJob/CleanupDirectEditingTokens.php',
'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => $baseDir . '/../lib/BackgroundJob/CleanupFileLocks.php',
Expand Down
1 change: 0 additions & 1 deletion apps/files/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class ComposerStaticInitFiles
'OCA\\Files\\Activity\\Settings\\FileChanged' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileChanged.php',
'OCA\\Files\\Activity\\Settings\\FileFavoriteChanged' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileFavoriteChanged.php',
'OCA\\Files\\AdvancedCapabilities' => __DIR__ . '/..' . '/../lib/AdvancedCapabilities.php',
'OCA\\Files\\App' => __DIR__ . '/..' . '/../lib/App.php',
'OCA\\Files\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
'OCA\\Files\\BackgroundJob\\CleanupDirectEditingTokens' => __DIR__ . '/..' . '/../lib/BackgroundJob/CleanupDirectEditingTokens.php',
'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => __DIR__ . '/..' . '/../lib/BackgroundJob/CleanupFileLocks.php',
Expand Down
22 changes: 0 additions & 22 deletions apps/files/lib/App.php

This file was deleted.

42 changes: 23 additions & 19 deletions apps/files/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/
namespace OCA\Files\AppInfo;

use Closure;
use OCA\Files\AdvancedCapabilities;
use OCA\Files\Capabilities;
use OCA\Files\Collaboration\Resources\Listener;
Expand Down Expand Up @@ -50,12 +49,13 @@
use OCP\IL10N;
use OCP\IPreview;
use OCP\IRequest;
use OCP\IServerContainer;
use OCP\ITagManager;
use OCP\IUserSession;
use OCP\Share\Events\ShareCreatedEvent;
use OCP\Share\Events\ShareDeletedEvent;
use OCP\Share\Events\ShareDeletedFromSelfEvent;
use OCP\Share\IManager as IShareManager;
use OCP\User\Events\UserFirstTimeLoggedInEvent;
use OCP\Util;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;

Expand All @@ -71,9 +71,12 @@ public function register(IRegistrationContext $context): void {
/**
* Controllers
*/
$context->registerService('APIController', function (ContainerInterface $c) {
/** @var IServerContainer $server */
$server = $c->get(IServerContainer::class);
$context->registerService(APIController::class, function (ContainerInterface $c): ApiController {
/** @var IUserSession $userSession */
$userSession = $c->get(IUserSession::class);

/** @var IRootFolder $rootFolder */
$rootFolder = $c->get(IRootFolder::class);

return new ApiController(
$c->get('AppName'),
Expand All @@ -83,7 +86,7 @@ public function register(IRegistrationContext $context): void {
$c->get(IPreview::class),
$c->get(IShareManager::class),
$c->get(IConfig::class),
$server->getUserFolder(),
$rootFolder->getUserFolder($userSession->getUser()->getUID()),
$c->get(UserConfig::class),
$c->get(ViewConfig::class),
$c->get(IL10N::class),
Expand All @@ -95,15 +98,18 @@ public function register(IRegistrationContext $context): void {
/**
* Services
*/
$context->registerService(TagService::class, function (ContainerInterface $c) {
/** @var IServerContainer $server */
$server = $c->get(IServerContainer::class);
$context->registerService(TagService::class, function (ContainerInterface $c): TagService {
/** @var IUserSession $userSession */
$userSession = $c->get(IUserSession::class);

/** @var IRootFolder $rootFolder */
$rootFolder = $c->get(IRootFolder::class);

return new TagService(
$c->get(IUserSession::class),
$userSession,
$c->get(IActivityManager::class),
$c->get(ITagManager::class)->load(self::APP_ID),
$server->getUserFolder(),
$rootFolder->getUserFolder($userSession->getUser()->getUID()),
);
});

Expand All @@ -126,6 +132,10 @@ public function register(IRegistrationContext $context): void {
$context->registerEventListener(NodeRemovedFromFavorite::class, NodeRemovedFromFavoriteListener::class);
$context->registerEventListener(UserFirstTimeLoggedInEvent::class, UserFirstTimeLoggedInListener::class);

$context->registerEventListener(ShareCreatedEvent::class, Listener::class);
$context->registerEventListener(ShareDeletedEvent::class, Listener::class);
$context->registerEventListener(ShareDeletedFromSelfEvent::class, Listener::class);

$context->registerSearchProvider(FilesSearchProvider::class);

$context->registerNotifierService(Notifier::class);
Expand All @@ -137,16 +147,10 @@ public function register(IRegistrationContext $context): void {

#[\Override]
public function boot(IBootContext $context): void {
$context->injectFn(Closure::fromCallable([$this, 'registerCollaboration']));
$context->injectFn([Listener::class, 'register']);
$this->registerHooks();
$context->injectFn($this->registerCollaboration(...));
}

private function registerCollaboration(IProviderManager $providerManager): void {
$providerManager->registerResourceProvider(ResourceProvider::class);
}

private function registerHooks(): void {
Util::connectHook('\OCP\Config', 'js', '\OCA\Files\App', 'extendJsConfig');
}
}
4 changes: 2 additions & 2 deletions apps/files/lib/BackgroundJob/ScanFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected function runScanner(string $user): void {
} catch (\Exception $e) {
$this->logger->error($e->getMessage(), ['exception' => $e, 'app' => 'files']);
}
\OC_Util::tearDownFS();
$this->setupManager->tearDown();
}

/**
Expand Down Expand Up @@ -127,7 +127,7 @@ private function getAllMountedStorages(): array {
* @throws \Exception
*/
#[\Override]
protected function run($argument) {
protected function run($argument): void {
if ($this->config->getSystemValueBool('files_no_background_scan', false)) {
return;
}
Expand Down
30 changes: 17 additions & 13 deletions apps/files/lib/Collaboration/Resources/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,29 @@
namespace OCA\Files\Collaboration\Resources;

use OCP\Collaboration\Resources\IManager;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Server;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\Share\Events\ShareCreatedEvent;
use OCP\Share\Events\ShareDeletedEvent;
use OCP\Share\Events\ShareDeletedFromSelfEvent;

class Listener {
public static function register(IEventDispatcher $dispatcher): void {
$dispatcher->addListener(ShareCreatedEvent::class, [self::class, 'shareModification']);
$dispatcher->addListener(ShareDeletedEvent::class, [self::class, 'shareModification']);
$dispatcher->addListener(ShareDeletedFromSelfEvent::class, [self::class, 'shareModification']);
/**
* @template-implements IEventListener<ShareCreatedEvent|ShareDeletedEvent|ShareDeletedFromSelfEvent>
*/
class Listener implements IEventListener {
public function __construct(
readonly protected IManager $resourceManager,
readonly protected ResourceProvider $resourceProvider,
) {
}

public static function shareModification(): void {
/** @var IManager $resourceManager */
$resourceManager = Server::get(IManager::class);
/** @var ResourceProvider $resourceProvider */
$resourceProvider = Server::get(ResourceProvider::class);
public function handle(Event $event): void {

Check failure on line 28 in apps/files/lib/Collaboration/Resources/Listener.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

MissingOverrideAttribute

apps/files/lib/Collaboration/Resources/Listener.php:28:2: MissingOverrideAttribute: Method OCA\Files\Collaboration\Resources\Listener::handle should have the "Override" attribute (see https://psalm.dev/358)
if ($event instanceof ShareDeletedFromSelfEvent || $event instanceof ShareDeletedEvent || $event instanceof ShareCreatedEvent) {
$this->shareModification();
}
}

$resourceManager->invalidateAccessCacheForProvider($resourceProvider);
public function shareModification(): void {
$this->resourceManager->invalidateAccessCacheForProvider($this->resourceProvider);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function handle(Event $event): void {
Util::addStyle(Application::APP_ID, 'icons');

$shareManager = Server::get(IManager::class);
if ($shareManager->shareApiEnabled() && class_exists('\OCA\Files\App')) {
if ($shareManager->shareApiEnabled()) {
Util::addInitScript(Application::APP_ID, 'init');
}
}
Expand Down
19 changes: 0 additions & 19 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1397,25 +1397,6 @@
<code><![CDATA[$this->fileIsEncrypted]]></code>
</TypeDoesNotContainType>
</file>
<file src="apps/files/lib/AppInfo/Application.php">
<DeprecatedInterface>
<code><![CDATA[$server]]></code>
<code><![CDATA[$server]]></code>
</DeprecatedInterface>
<DeprecatedMethod>
<code><![CDATA[Util::connectHook('\OCP\Config', 'js', '\OCA\Files\App', 'extendJsConfig')]]></code>
<code><![CDATA[getUserFolder]]></code>
<code><![CDATA[getUserFolder]]></code>
</DeprecatedMethod>
</file>
<file src="apps/files/lib/BackgroundJob/ScanFiles.php">
<DeprecatedClass>
<code><![CDATA[\OC_Util::tearDownFS()]]></code>
</DeprecatedClass>
<DeprecatedMethod>
<code><![CDATA[\OC_Util::tearDownFS()]]></code>
</DeprecatedMethod>
</file>
<file src="apps/files/lib/Command/Object/Multi/Users.php">
<DeprecatedMethod>
<code><![CDATA[getUsersForUserValue]]></code>
Expand Down
9 changes: 5 additions & 4 deletions lib/private/Template/JSConfigHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use OC\CapabilitiesManager;
use OC\Core\AppInfo\ConfigLexicon;
use OC\Files\FilenameValidator;
use OCA\Files\Service\ChunkedUploadConfig;
use OCA\Provisioning_API\Controller\AUserDataOCSController;
use OCP\App\AppPathNotFoundException;
use OCP\App\IAppManager;
Expand Down Expand Up @@ -256,7 +257,10 @@ public function getConfig(): string {
'defaultRemoteExpireDateEnabled' => $defaultRemoteExpireDateEnabled,
'defaultRemoteExpireDate' => $defaultRemoteExpireDate,
'defaultRemoteExpireDateEnforced' => $defaultRemoteExpireDateEnforced,
]
],
'files' => [
'max_chunk_size' => ChunkedUploadConfig::getMaxChunkSize(),
],
]),
'_theme' => json_encode([
'entity' => $this->defaults->getEntity(),
Expand Down Expand Up @@ -287,9 +291,6 @@ public function getConfig(): string {
$this->initialStateService->provideInitialState('core', 'config', $config);
$this->initialStateService->provideInitialState('core', 'capabilities', $capabilities);

// Allow hooks to modify the output values
\OC_Hook::emit('\OCP\Config', 'js', ['array' => &$array]);

$result = '';

// Echo it
Expand Down
Loading