From 650be687d68fd430833bbe98af6b537be3ab34d9 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Sun, 29 May 2022 18:50:58 +0200 Subject: [PATCH] Uses IShare::TYPE_... in Server.php rather than the obsolete Constants Signed-off-by: Cyrille Bollu --- lib/private/Collaboration/Collaborators/Search.php | 2 +- lib/private/Server.php | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/private/Collaboration/Collaborators/Search.php b/lib/private/Collaboration/Collaborators/Search.php index b0ee09356af79..573165fd32bf4 100644 --- a/lib/private/Collaboration/Collaborators/Search.php +++ b/lib/private/Collaboration/Collaborators/Search.php @@ -106,7 +106,7 @@ public function search($search, array $shareTypes, $lookup, $limit, $offset) { } public function registerPlugin(array $pluginInfo) { - $shareType = constant(Share::class . '::' . $pluginInfo['shareType']); + $shareType = $pluginInfo['shareType']; if ($shareType === null) { throw new \InvalidArgumentException('Provided ShareType is invalid'); } diff --git a/lib/private/Server.php b/lib/private/Server.php index 6e6fa43048972..eb2efcdfaff8f 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -238,6 +238,7 @@ use OCP\Security\ISecureRandom; use OCP\Security\ITrustedDomainHelper; use OCP\Security\VerificationToken\IVerificationToken; +use OCP\Share\IShare; use OCP\Share\IShareHelper; use OCP\SystemTag\ISystemTagManager; use OCP\SystemTag\ISystemTagObjectMapper; @@ -1313,11 +1314,11 @@ public function __construct($webRoot, \OC\Config $config) { $instance = new Collaboration\Collaborators\Search($c); // register default plugins - $instance->registerPlugin(['shareType' => 'SHARE_TYPE_USER', 'class' => UserPlugin::class]); - $instance->registerPlugin(['shareType' => 'SHARE_TYPE_GROUP', 'class' => GroupPlugin::class]); - $instance->registerPlugin(['shareType' => 'SHARE_TYPE_EMAIL', 'class' => MailPlugin::class]); - $instance->registerPlugin(['shareType' => 'SHARE_TYPE_REMOTE', 'class' => RemotePlugin::class]); - $instance->registerPlugin(['shareType' => 'SHARE_TYPE_REMOTE_GROUP', 'class' => RemoteGroupPlugin::class]); + $instance->registerPlugin(['shareType' => IShare::TYPE_USER, 'class' => UserPlugin::class]); + $instance->registerPlugin(['shareType' => IShare::TYPE_GROUP, 'class' => GroupPlugin::class]); + $instance->registerPlugin(['shareType' => IShare::TYPE_EMAIL, 'class' => MailPlugin::class]); + $instance->registerPlugin(['shareType' => IShare::TYPE_REMOTE, 'class' => RemotePlugin::class]); + $instance->registerPlugin(['shareType' => IShare::TYPE_REMOTE_GROUP, 'class' => RemoteGroupPlugin::class]); return $instance; });