@@ -926,7 +926,7 @@ public function getIncompleteChildrenCount($fileId) {
926
926
->from ('filecache ' )
927
927
->whereParent ($ fileId )
928
928
->whereStorageId ($ this ->getNumericStorageId ())
929
- ->andWhere ($ query ->expr ()->lt ('size ' , $ query ->createNamedParameter (0 , IQueryBuilder::PARAM_INT )));
929
+ ->andWhere ($ query ->expr ()->eq ('size ' , $ query ->createNamedParameter (- 1 , IQueryBuilder::PARAM_INT )));
930
930
931
931
$ result = $ query ->executeQuery ();
932
932
$ size = (int )$ result ->fetchOne ();
@@ -1067,28 +1067,19 @@ public function getAll() {
1067
1067
* @return string|false the path of the folder or false when no folder matched
1068
1068
*/
1069
1069
public function getIncomplete () {
1070
- // we select the fileid here first instead of directly selecting the path since this helps mariadb/mysql
1071
- // to use the correct index.
1072
- // The overhead of this should be minimal since the cost of selecting the path by id should be much lower
1073
- // than the cost of finding an item with size < 0
1074
1070
$ query = $ this ->getQueryBuilder ();
1075
- $ query ->select ('fileid ' )
1071
+ $ query ->select ('path ' )
1076
1072
->from ('filecache ' )
1077
1073
->whereStorageId ($ this ->getNumericStorageId ())
1078
- ->andWhere ($ query ->expr ()->lt ('size ' , $ query ->createNamedParameter (0 , IQueryBuilder::PARAM_INT )))
1074
+ ->andWhere ($ query ->expr ()->eq ('size ' , $ query ->createNamedParameter (- 1 , IQueryBuilder::PARAM_INT )))
1079
1075
->orderBy ('fileid ' , 'DESC ' )
1080
1076
->setMaxResults (1 );
1081
1077
1082
1078
$ result = $ query ->executeQuery ();
1083
- $ id = $ result ->fetchOne ();
1079
+ $ path = $ result ->fetchOne ();
1084
1080
$ result ->closeCursor ();
1085
1081
1086
- if ($ id === false ) {
1087
- return false ;
1088
- }
1089
-
1090
- $ path = $ this ->getPathById ($ id );
1091
- return $ path ?? false ;
1082
+ return $ path === false ? false : (string )$ path ;
1092
1083
}
1093
1084
1094
1085
/**
0 commit comments