@@ -49,39 +49,18 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
4949
5050 public const SHARE_TYPE_DECK_USER = IShare::TYPE_DECK_USER ;
5151
52- private IDBConnection $ dbConnection ;
53- private IManager $ shareManager ;
54- private AttachmentCacheHelper $ attachmentCacheHelper ;
55- private BoardMapper $ boardMapper ;
56- private CardMapper $ cardMapper ;
57- private PermissionService $ permissionService ;
58- private ITimeFactory $ timeFactory ;
59- private IL10N $ l ;
60- private IMimeTypeLoader $ mimeTypeLoader ;
61- private ?string $ userId ;
62-
6352 public function __construct (
64- IDBConnection $ connection ,
65- IManager $ shareManager ,
66- BoardMapper $ boardMapper ,
67- CardMapper $ cardMapper ,
68- PermissionService $ permissionService ,
69- AttachmentCacheHelper $ attachmentCacheHelper ,
70- IL10N $ l ,
71- ITimeFactory $ timeFactory ,
72- IMimeTypeLoader $ mimeTypeLoader ,
73- ?string $ userId ,
53+ private IDBConnection $ dbConnection ,
54+ private IManager $ shareManager ,
55+ private BoardMapper $ boardMapper ,
56+ private CardMapper $ cardMapper ,
57+ private PermissionService $ permissionService ,
58+ private AttachmentCacheHelper $ attachmentCacheHelper ,
59+ private IL10N $ l ,
60+ private ITimeFactory $ timeFactory ,
61+ private IMimeTypeLoader $ mimeTypeLoader ,
62+ private ?string $ userId = null ,
7463 ) {
75- $ this ->dbConnection = $ connection ;
76- $ this ->shareManager = $ shareManager ;
77- $ this ->boardMapper = $ boardMapper ;
78- $ this ->cardMapper = $ cardMapper ;
79- $ this ->attachmentCacheHelper = $ attachmentCacheHelper ;
80- $ this ->permissionService = $ permissionService ;
81- $ this ->l = $ l ;
82- $ this ->timeFactory = $ timeFactory ;
83- $ this ->mimeTypeLoader = $ mimeTypeLoader ;
84- $ this ->userId = $ userId ;
8564 }
8665
8766 public static function register (IEventDispatcher $ dispatcher ): void {
@@ -1049,11 +1028,18 @@ public function getAllShares(): iterable {
10491028
10501029 public function getOrphanedAttachmentShares (): array {
10511030 $ allCardIds = $ this ->cardMapper ->getAllCardIds ();
1031+
10521032 $ qb = $ this ->dbConnection ->getQueryBuilder ();
10531033 $ qb ->select ('* ' )
10541034 ->from ('share ' , 's ' )
1055- ->where ($ qb ->expr ()->eq ('s.share_type ' , $ qb ->createNamedParameter (IShare::TYPE_DECK )))
1056- ->andWhere ($ qb ->expr ()->notIn ('s.share_with ' , $ qb ->createNamedParameter ($ allCardIds , IQueryBuilder::PARAM_STR_ARRAY )));
1035+ ->where ($ qb ->expr ()->eq ('s.share_type ' , $ qb ->createNamedParameter (IShare::TYPE_DECK )));
1036+
1037+ $ chunks = array_chunk ($ allCardIds , 1000 );
1038+ foreach ($ chunks as $ chunk ) {
1039+ $ qb ->andWhere (
1040+ $ qb ->expr ()->notIn ('s.share_with ' , $ qb ->createNamedParameter ($ chunk , IQueryBuilder::PARAM_STR_ARRAY ))
1041+ );
1042+ }
10571043
10581044 $ cursor = $ qb ->execute ();
10591045 $ shares = [];
0 commit comments