File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -981,19 +981,32 @@ public function getAll() {
981981 * @return string|false the path of the folder or false when no folder matched
982982 */
983983 public function getIncomplete () {
984+ // we select the fileid here first instead of directly selecting the path since this helps mariadb/mysql
985+ // to use the correct index.
986+ // The overhead of this should be minimal since the cost of selecting the path by id should be much lower
987+ // than the cost of finding an item with size < 0
984988 $ query = $ this ->getQueryBuilder ();
985- $ query ->select ('path ' )
989+ $ query ->select ('fileid ' )
986990 ->from ('filecache ' )
987991 ->whereStorageId ($ this ->getNumericStorageId ())
988992 ->andWhere ($ query ->expr ()->lt ('size ' , $ query ->createNamedParameter (0 , IQueryBuilder::PARAM_INT )))
989993 ->orderBy ('fileid ' , 'DESC ' )
990994 ->setMaxResults (1 );
991995
992996 $ result = $ query ->execute ();
993- $ path = $ result ->fetchOne ();
997+ $ id = $ result ->fetchOne ();
994998 $ result ->closeCursor ();
995999
996- return $ path ;
1000+ if ($ id === false ) {
1001+ return false ;
1002+ }
1003+
1004+ $ path = $ this ->getPathById ($ id );
1005+ if ($ path === null ) {
1006+ return false ;
1007+ } else {
1008+ return $ path ;
1009+ }
9971010 }
9981011
9991012 /**
You can’t perform that action at this time.
0 commit comments