@@ -91,11 +91,11 @@ public function getRulesForFilesByPath(IUser $user, int $storageId, array $fileP
91
91
$ rows = [];
92
92
foreach (array_chunk ($ hashes , 1000 ) as $ chunk ) {
93
93
$ query = $ this ->connection ->getQueryBuilder ();
94
- $ query ->select (['f.fileid ' , 'mapping_type ' , 'mapping_id ' , 'mask ' , 'a.permissions ' , 'path ' ])
94
+ $ query ->select (['f.fileid ' , 'mapping_type ' , 'mapping_id ' , 'mask ' , 'a.permissions ' , 'f. path ' ])
95
95
->from ('group_folders_acl ' , 'a ' )
96
96
->innerJoin ('a ' , 'filecache ' , 'f ' , $ query ->expr ()->eq ('f.fileid ' , 'a.fileid ' ))
97
- ->where ($ query ->expr ()->in ('path_hash ' , $ query ->createNamedParameter ($ chunk , IQueryBuilder::PARAM_STR_ARRAY )))
98
- ->andWhere ($ query ->expr ()->eq ('storage ' , $ query ->createNamedParameter ($ storageId , IQueryBuilder::PARAM_INT )))
97
+ ->where ($ query ->expr ()->in ('f. path_hash ' , $ query ->createNamedParameter ($ chunk , IQueryBuilder::PARAM_STR_ARRAY )))
98
+ ->andWhere ($ query ->expr ()->eq ('f. storage ' , $ query ->createNamedParameter ($ storageId , IQueryBuilder::PARAM_INT )))
99
99
->andWhere ($ query ->expr ()->orX (...array_map (function (IUserMapping $ userMapping ) use ($ query ) {
100
100
return $ query ->expr ()->andX (
101
101
$ query ->expr ()->eq ('mapping_type ' , $ query ->createNamedParameter ($ userMapping ->getType ())),
@@ -129,20 +129,21 @@ public function getRulesForFilesByParent(IUser $user, int $storageId, string $pa
129
129
}
130
130
131
131
$ query = $ this ->connection ->getQueryBuilder ();
132
- $ query ->select (['f.fileid ' , 'mapping_type ' , 'mapping_id ' , 'mask ' , 'a.permissions ' , 'path ' ])
132
+ $ query ->select (['f.fileid ' , 'a. mapping_type ' , 'a. mapping_id ' , 'a. mask ' , 'a.permissions ' , 'f. path ' ])
133
133
->from ('filecache ' , 'f ' )
134
134
->leftJoin ('f ' , 'group_folders_acl ' , 'a ' , $ query ->expr ()->eq ('f.fileid ' , 'a.fileid ' ))
135
- ->andWhere ($ query ->expr ()->eq ('parent ' , $ query ->createNamedParameter ($ parentId , IQueryBuilder::PARAM_INT )))
135
+ ->andWhere ($ query ->expr ()->eq ('f.parent ' , $ query ->createNamedParameter ($ parentId , IQueryBuilder::PARAM_INT )))
136
+ ->andWhere ($ query ->expr ()->eq ('f.storage ' , $ query ->createNamedParameter ($ storageId , IQueryBuilder::PARAM_INT )))
136
137
->andWhere (
137
138
$ query ->expr ()->orX (
138
139
$ query ->expr ()->andX (
139
- $ query ->expr ()->isNull ('mapping_type ' ),
140
- $ query ->expr ()->isNull ('mapping_id ' )
140
+ $ query ->expr ()->isNull ('a. mapping_type ' ),
141
+ $ query ->expr ()->isNull ('a. mapping_id ' )
141
142
),
142
143
...array_map (function (IUserMapping $ userMapping ) use ($ query ) {
143
144
return $ query ->expr ()->andX (
144
- $ query ->expr ()->eq ('mapping_type ' , $ query ->createNamedParameter ($ userMapping ->getType ())),
145
- $ query ->expr ()->eq ('mapping_id ' , $ query ->createNamedParameter ($ userMapping ->getId ()))
145
+ $ query ->expr ()->eq ('a. mapping_type ' , $ query ->createNamedParameter ($ userMapping ->getType ())),
146
+ $ query ->expr ()->eq ('a. mapping_id ' , $ query ->createNamedParameter ($ userMapping ->getId ()))
146
147
);
147
148
}, $ userMappings )
148
149
)
@@ -185,11 +186,11 @@ public function getAllRulesForPaths(int $storageId, array $filePaths): array {
185
186
return md5 (trim ($ path , '/ ' ));
186
187
}, $ filePaths );
187
188
$ query = $ this ->connection ->getQueryBuilder ();
188
- $ query ->select (['f.fileid ' , 'mapping_type ' , 'mapping_id ' , 'mask ' , 'a.permissions ' , 'path ' ])
189
+ $ query ->select (['f.fileid ' , 'mapping_type ' , 'mapping_id ' , 'mask ' , 'a.permissions ' , 'f. path ' ])
189
190
->from ('group_folders_acl ' , 'a ' )
190
191
->innerJoin ('a ' , 'filecache ' , 'f ' , $ query ->expr ()->eq ('f.fileid ' , 'a.fileid ' ))
191
- ->where ($ query ->expr ()->in ('path_hash ' , $ query ->createNamedParameter ($ hashes , IQueryBuilder::PARAM_STR_ARRAY )))
192
- ->andWhere ($ query ->expr ()->eq ('storage ' , $ query ->createNamedParameter ($ storageId , IQueryBuilder::PARAM_INT )));
192
+ ->where ($ query ->expr ()->in ('f. path_hash ' , $ query ->createNamedParameter ($ hashes , IQueryBuilder::PARAM_STR_ARRAY )))
193
+ ->andWhere ($ query ->expr ()->eq ('f. storage ' , $ query ->createNamedParameter ($ storageId , IQueryBuilder::PARAM_INT )));
193
194
194
195
$ rows = $ query ->executeQuery ()->fetchAll ();
195
196
@@ -219,14 +220,14 @@ private function rulesByPath(array $rows, array $result = []): array {
219
220
*/
220
221
public function getAllRulesForPrefix (int $ storageId , string $ prefix ): array {
221
222
$ query = $ this ->connection ->getQueryBuilder ();
222
- $ query ->select (['f.fileid ' , 'mapping_type ' , 'mapping_id ' , 'mask ' , 'a.permissions ' , 'path ' ])
223
+ $ query ->select (['f.fileid ' , 'mapping_type ' , 'mapping_id ' , 'mask ' , 'a.permissions ' , 'f. path ' ])
223
224
->from ('group_folders_acl ' , 'a ' )
224
225
->innerJoin ('a ' , 'filecache ' , 'f ' , $ query ->expr ()->eq ('f.fileid ' , 'a.fileid ' ))
225
226
->where ($ query ->expr ()->orX (
226
- $ query ->expr ()->like ('path ' , $ query ->createNamedParameter ($ this ->connection ->escapeLikeParameter ($ prefix ) . '/% ' )),
227
- $ query ->expr ()->eq ('path_hash ' , $ query ->createNamedParameter (md5 ($ prefix )))
227
+ $ query ->expr ()->like ('f. path ' , $ query ->createNamedParameter ($ this ->connection ->escapeLikeParameter ($ prefix ) . '/% ' )),
228
+ $ query ->expr ()->eq ('f. path_hash ' , $ query ->createNamedParameter (md5 ($ prefix )))
228
229
))
229
- ->andWhere ($ query ->expr ()->eq ('storage ' , $ query ->createNamedParameter ($ storageId , IQueryBuilder::PARAM_INT )));
230
+ ->andWhere ($ query ->expr ()->eq ('f. storage ' , $ query ->createNamedParameter ($ storageId , IQueryBuilder::PARAM_INT )));
230
231
231
232
$ rows = $ query ->executeQuery ()->fetchAll ();
232
233
@@ -243,14 +244,14 @@ public function getRulesForPrefix(IUser $user, int $storageId, string $prefix):
243
244
$ userMappings = $ this ->userMappingManager ->getMappingsForUser ($ user );
244
245
245
246
$ query = $ this ->connection ->getQueryBuilder ();
246
- $ query ->select (['f.fileid ' , 'mapping_type ' , 'mapping_id ' , 'mask ' , 'a.permissions ' , 'path ' ])
247
+ $ query ->select (['f.fileid ' , 'mapping_type ' , 'mapping_id ' , 'mask ' , 'a.permissions ' , 'f. path ' ])
247
248
->from ('group_folders_acl ' , 'a ' )
248
249
->innerJoin ('a ' , 'filecache ' , 'f ' , $ query ->expr ()->eq ('f.fileid ' , 'a.fileid ' ))
249
250
->where ($ query ->expr ()->orX (
250
- $ query ->expr ()->like ('path ' , $ query ->createNamedParameter ($ this ->connection ->escapeLikeParameter ($ prefix ) . '/% ' )),
251
- $ query ->expr ()->eq ('path_hash ' , $ query ->createNamedParameter (md5 ($ prefix )))
251
+ $ query ->expr ()->like ('f. path ' , $ query ->createNamedParameter ($ this ->connection ->escapeLikeParameter ($ prefix ) . '/% ' )),
252
+ $ query ->expr ()->eq ('f. path_hash ' , $ query ->createNamedParameter (md5 ($ prefix )))
252
253
))
253
- ->andWhere ($ query ->expr ()->eq ('storage ' , $ query ->createNamedParameter ($ storageId , IQueryBuilder::PARAM_INT )))
254
+ ->andWhere ($ query ->expr ()->eq ('f. storage ' , $ query ->createNamedParameter ($ storageId , IQueryBuilder::PARAM_INT )))
254
255
->andWhere ($ query ->expr ()->orX (...array_map (function (IUserMapping $ userMapping ) use ($ query ) {
255
256
return $ query ->expr ()->andX (
256
257
$ query ->expr ()->eq ('mapping_type ' , $ query ->createNamedParameter ($ userMapping ->getType ())),
0 commit comments