@@ -51,39 +51,18 @@ class DeckShareProvider implements \OCP\Share\IShareProvider, IPartialShareProvi
5151
5252 public const SHARE_TYPE_DECK_USER = IShare::TYPE_DECK_USER ;
5353
54- private IDBConnection $ dbConnection ;
55- private IManager $ shareManager ;
56- private AttachmentCacheHelper $ attachmentCacheHelper ;
57- private BoardMapper $ boardMapper ;
58- private CardMapper $ cardMapper ;
59- private PermissionService $ permissionService ;
60- private ITimeFactory $ timeFactory ;
61- private IL10N $ l ;
62- private IMimeTypeLoader $ mimeTypeLoader ;
63- private ?string $ userId ;
64-
6554 public function __construct (
66- IDBConnection $ connection ,
67- IManager $ shareManager ,
68- BoardMapper $ boardMapper ,
69- CardMapper $ cardMapper ,
70- PermissionService $ permissionService ,
71- AttachmentCacheHelper $ attachmentCacheHelper ,
72- IL10N $ l ,
73- ITimeFactory $ timeFactory ,
74- IMimeTypeLoader $ mimeTypeLoader ,
75- ?string $ userId ,
55+ private IDBConnection $ dbConnection ,
56+ private IManager $ shareManager ,
57+ private BoardMapper $ boardMapper ,
58+ private CardMapper $ cardMapper ,
59+ private PermissionService $ permissionService ,
60+ private AttachmentCacheHelper $ attachmentCacheHelper ,
61+ private IL10N $ l ,
62+ private ITimeFactory $ timeFactory ,
63+ private IMimeTypeLoader $ mimeTypeLoader ,
64+ private ?string $ userId = null ,
7665 ) {
77- $ this ->dbConnection = $ connection ;
78- $ this ->shareManager = $ shareManager ;
79- $ this ->boardMapper = $ boardMapper ;
80- $ this ->cardMapper = $ cardMapper ;
81- $ this ->attachmentCacheHelper = $ attachmentCacheHelper ;
82- $ this ->permissionService = $ permissionService ;
83- $ this ->l = $ l ;
84- $ this ->timeFactory = $ timeFactory ;
85- $ this ->mimeTypeLoader = $ mimeTypeLoader ;
86- $ this ->userId = $ userId ;
8766 }
8867
8968 public static function register (IEventDispatcher $ dispatcher ): void {
@@ -1096,11 +1075,18 @@ public function getAllShares(): iterable {
10961075
10971076 public function getOrphanedAttachmentShares (): array {
10981077 $ allCardIds = $ this ->cardMapper ->getAllCardIds ();
1078+
10991079 $ qb = $ this ->dbConnection ->getQueryBuilder ();
11001080 $ qb ->select ('* ' )
11011081 ->from ('share ' , 's ' )
1102- ->where ($ qb ->expr ()->eq ('s.share_type ' , $ qb ->createNamedParameter (IShare::TYPE_DECK )))
1103- ->andWhere ($ qb ->expr ()->notIn ('s.share_with ' , $ qb ->createNamedParameter ($ allCardIds , IQueryBuilder::PARAM_STR_ARRAY )));
1082+ ->where ($ qb ->expr ()->eq ('s.share_type ' , $ qb ->createNamedParameter (IShare::TYPE_DECK )));
1083+
1084+ $ chunks = array_chunk ($ allCardIds , 1000 );
1085+ foreach ($ chunks as $ chunk ) {
1086+ $ qb ->andWhere (
1087+ $ qb ->expr ()->notIn ('s.share_with ' , $ qb ->createNamedParameter ($ chunk , IQueryBuilder::PARAM_STR_ARRAY ))
1088+ );
1089+ }
11041090
11051091 $ cursor = $ qb ->executeQuery ();
11061092 $ shares = [];
0 commit comments