Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup tags and share component #32012

Merged
merged 1 commit into from
Sep 29, 2022
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
10 changes: 8 additions & 2 deletions core/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
use OC\DB\MissingPrimaryKeyInformation;
use OC\DB\SchemaWrapper;
use OC\Metadata\FileEventListener;
use OC\TagManager;
use OCP\AppFramework\App;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Events\Node\NodeDeletedEvent;
Expand Down Expand Up @@ -78,7 +79,7 @@ public function __construct() {

$server = $container->getServer();
/** @var IEventDispatcher $eventDispatcher */
$eventDispatcher = $server->query(IEventDispatcher::class);
$eventDispatcher = $server->get(IEventDispatcher::class);

$notificationManager = $server->getNotificationManager();
$notificationManager->registerNotifierService(CoreNotifier::class);
Expand Down Expand Up @@ -325,10 +326,15 @@ function (GenericEvent $event) use ($container) {
/** @var IConfig $config */
$config = $container->get(IConfig::class);
if ($config->getSystemValueBool('enable_file_metadata', true)) {
$eventDispatcher = \OC::$server->get(IEventDispatcher::class);
/** @psalm-suppress InvalidArgument */
$eventDispatcher->addServiceListener(NodeDeletedEvent::class, FileEventListener::class);
/** @psalm-suppress InvalidArgument */
$eventDispatcher->addServiceListener(NodeRemovedFromCache::class, FileEventListener::class);
/** @psalm-suppress InvalidArgument */
$eventDispatcher->addServiceListener(NodeWrittenEvent::class, FileEventListener::class);
}

// Tags
$eventDispatcher->addServiceListener(UserDeletedEvent::class, TagManager::class);
}
}
2 changes: 0 additions & 2 deletions lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -1595,8 +1595,6 @@
'OC\\User\\User' => $baseDir . '/lib/private/User/User.php',
'OC_API' => $baseDir . '/lib/private/legacy/OC_API.php',
'OC_App' => $baseDir . '/lib/private/legacy/OC_App.php',
'OC_DB' => $baseDir . '/lib/private/legacy/OC_DB.php',
'OC_DB_StatementWrapper' => $baseDir . '/lib/private/legacy/OC_DB_StatementWrapper.php',
'OC_Defaults' => $baseDir . '/lib/private/legacy/OC_Defaults.php',
'OC_EventSource' => $baseDir . '/lib/private/legacy/OC_EventSource.php',
'OC_FileChunking' => $baseDir . '/lib/private/legacy/OC_FileChunking.php',
Expand Down
2 changes: 0 additions & 2 deletions lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -1628,8 +1628,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\User\\User' => __DIR__ . '/../../..' . '/lib/private/User/User.php',
'OC_API' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_API.php',
'OC_App' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_App.php',
'OC_DB' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_DB.php',
'OC_DB_StatementWrapper' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_DB_StatementWrapper.php',
'OC_Defaults' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_Defaults.php',
'OC_EventSource' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_EventSource.php',
'OC_FileChunking' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_FileChunking.php',
Expand Down
3 changes: 3 additions & 0 deletions lib/private/Accounts/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
use OCP\User\Events\UserChangedEvent;
use Psr\Log\LoggerInterface;

/**
* @template-implements IEventListener<UserChangedEvent>
*/
class Hooks implements IEventListener {

/** @var IAccountManager */
Expand Down
6 changes: 4 additions & 2 deletions lib/private/Files/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
use OC\Files\Mount\MoveableMount;
use OC\Files\Storage\Storage;
use OC\User\LazyUser;
use OC\Share\Share;
use OC\User\User;
use OCA\Files_Sharing\SharedMount;
use OCP\Constants;
use OCP\Files\Cache\ICacheEntry;
Expand Down Expand Up @@ -1800,10 +1802,10 @@ private function targetIsNotShared(IStorage $targetStorage, string $targetIntern
}

// check if any of the parents were shared by the current owner (include collections)
$shares = \OCP\Share::getItemShared(
$shares = Share::getItemShared(
'folder',
$fileId,
\OCP\Share::FORMAT_NONE,
\OC\Share\Constants::FORMAT_NONE,
null,
true
);
Expand Down
5 changes: 5 additions & 0 deletions lib/private/Metadata/FileEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
use OCP\Files\FileInfo;
use Psr\Log\LoggerInterface;

/**
* @template-implements IEventListener<NodeRemovedFromCache>
* @template-implements IEventListener<NodeDeletedEvent>
* @template-implements IEventListener<NodeWrittenEvent>
*/
class FileEventListener implements IEventListener {
private IMetadataManager $manager;
private LoggerInterface $logger;
Expand Down
Loading