From 8493bc83870fb35673ee9e86f7a9aa7f0444aa75 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Thu, 28 Nov 2024 10:24:31 -0100 Subject: [PATCH] fix backport Signed-off-by: Maxence Lange --- lib/Db/MountRequest.php | 4 ++-- lib/Migration/Version0031Date20241105133904.php | 4 +++- lib/MountManager/CircleMountProvider.php | 7 +++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/Db/MountRequest.php b/lib/Db/MountRequest.php index cd9d94e63..910978fd5 100644 --- a/lib/Db/MountRequest.php +++ b/lib/Db/MountRequest.php @@ -55,8 +55,8 @@ public function save(Mount $mount): void { ->setValue('single_id', $qb->createNamedParameter($mount->getOwner()->getSingleId())) ->setValue('token', $qb->createNamedParameter($mount->getToken())) ->setValue('parent', $qb->createNamedParameter($mount->getParent())) - ->setValue('mountpoint', $qb->createNamedParameter($mount->getMountPoint())) - ->setValue('mountpoint_hash', $qb->createNamedParameter(md5($mount->getMountPoint()))); + ->setValue('mountpoint', $qb->createNamedParameter($mount->getOriginalMountPoint())) + ->setValue('mountpoint_hash', $qb->createNamedParameter(md5($mount->getOriginalMountPoint()))); $qb->execute(); } diff --git a/lib/Migration/Version0031Date20241105133904.php b/lib/Migration/Version0031Date20241105133904.php index 54d68e4a3..4484b5aa1 100644 --- a/lib/Migration/Version0031Date20241105133904.php +++ b/lib/Migration/Version0031Date20241105133904.php @@ -14,6 +14,8 @@ use Closure; use Doctrine\DBAL\Schema\SchemaException; use OCP\DB\ISchemaWrapper; +use OCP\Migration\Attributes\AddIndex; +use OCP\Migration\Attributes\IndexType; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; use Psr\Log\LoggerInterface; @@ -30,7 +32,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt try { $table = $schema->getTable('circles_mountpoint'); - if (!$table->hasIndex('dname')) { + if (!$table->hasIndex('mp_sid_hash')) { $table->addUniqueIndex(['single_id', 'mountpoint_hash'], 'mp_sid_hash'); } } catch (SchemaException $e) { diff --git a/lib/MountManager/CircleMountProvider.php b/lib/MountManager/CircleMountProvider.php index e4ad23f0c..213f250a8 100644 --- a/lib/MountManager/CircleMountProvider.php +++ b/lib/MountManager/CircleMountProvider.php @@ -62,8 +62,6 @@ class CircleMountProvider implements IMountProvider { use TArrayTools; - public const EXTERNAL_STORAGE = ExternalStorage::class; - public function __construct( private IClientService $clientService, private IRootFolder $rootFolder, @@ -72,7 +70,8 @@ public function __construct( private MountRequest $mountRequest, private MountPointRequest $mountPointRequest, private FederatedUserService $federatedUserService, - private ConfigService $configService + private ConfigService $configService, + private LoggerInterface $logger, ) { } @@ -129,7 +128,7 @@ public function generateCircleMount(Mount $mount, IStorageFactory $storageFactor return new CircleMount( $mount, - self::EXTERNAL_STORAGE, + ExternalStorage::class, $storageFactory ); }