@@ -926,7 +926,7 @@ public function getIncompleteChildrenCount($fileId) {
926926				->from ('filecache ' )
927927				->whereParent ($ fileId
928928				->whereStorageId ($ this getNumericStorageId ())
929- 				->andWhere ($ queryexpr ()->lt ('size ' , $ querycreateNamedParameter (0 , IQueryBuilder::PARAM_INT )));
929+ 				->andWhere ($ queryexpr ()->eq ('size ' , $ querycreateNamedParameter (- 1 , IQueryBuilder::PARAM_INT )));
930930
931931			$ result$ queryexecuteQuery ();
932932			$ sizeint )$ resultfetchOne ();
@@ -1067,27 +1067,18 @@ public function getAll() {
10671067	 * @return string|false the path of the folder or false when no folder matched 
10681068	 */ 
10691069	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 
10741070		$ query$ this getQueryBuilder ();
1075- 		$ queryselect ('fileid ' )
1071+ 		$ queryselect ('path ' )
10761072			->from ('filecache ' )
10771073			->whereStorageId ($ this getNumericStorageId ())
1078- 			->andWhere ($ queryexpr ()->lt ('size ' , $ querycreateNamedParameter (0 , IQueryBuilder::PARAM_INT )))
1074+ 			->andWhere ($ queryexpr ()->eq ('size ' , $ querycreateNamedParameter (- 1 , IQueryBuilder::PARAM_INT )))
10791075			->orderBy ('fileid ' , 'DESC ' )
10801076			->setMaxResults (1 );
10811077
10821078		$ result$ queryexecuteQuery ();
1083- 		$ id $ resultfetchOne ();
1079+ 		$ path $ resultfetchOne ();
10841080		$ resultcloseCursor ();
10851081
1086- 		if  ($ idfalse ) {
1087- 			return  false ;
1088- 		}
1089- 
1090- 		$ path$ this getPathById ($ id
10911082		return  $ pathfalse ;
10921083	}
10931084
0 commit comments