@@ -78,8 +78,8 @@ public function classifyFiles(string $model, array $queueFiles, int $timeout): \
7878 if ($ this ->maxExecutionTime > 0 && time () - $ startTime > $ this ->maxExecutionTime ) {
7979 return ;
8080 }
81- $ files = $ this ->rootFolder ->getById ($ queueFile ->getFileId ());
82- if (count ( $ files ) === 0 ) {
81+ $ file = $ this ->rootFolder ->getFirstNodeById ($ queueFile ->getFileId ());
82+ if ($ file === null ) {
8383 try {
8484 $ this ->logger ->debug ('removing ' .$ queueFile ->getFileId ().' from ' .$ model .' queue because it couldn \'t be found ' );
8585 $ this ->queue ->removeFromQueue ($ model , $ queueFile );
@@ -89,8 +89,8 @@ public function classifyFiles(string $model, array $queueFiles, int $timeout): \
8989 continue ;
9090 }
9191 try {
92- if ($ files [ 0 ] ->getSize () == 0 ) {
93- $ this ->logger ->debug ('File is empty: ' . $ files [ 0 ] ->getPath ());
92+ if ($ file ->getSize () == 0 ) {
93+ $ this ->logger ->debug ('File is empty: ' . $ file ->getPath ());
9494 try {
9595 $ this ->logger ->debug ('removing ' . $ queueFile ->getFileId () . ' from ' . $ model . ' queue ' );
9696 $ this ->queue ->removeFromQueue ($ model , $ queueFile );
@@ -99,14 +99,14 @@ public function classifyFiles(string $model, array $queueFiles, int $timeout): \
9999 }
100100 continue ;
101101 }
102- $ path = $ this ->getConvertedFilePath ($ files [ 0 ] );
102+ $ path = $ this ->getConvertedFilePath ($ file );
103103 if (in_array ($ model , [ImagenetClassifier::MODEL_NAME , LandmarksClassifier::MODEL_NAME , ClusteringFaceClassifier::MODEL_NAME ], true )) {
104104 // Check file data size
105105 $ filesize = filesize ($ path );
106106 if ($ filesize !== false ) {
107107 $ filesizeMb = $ filesize / (1024 * 1024 );
108108 if ($ filesizeMb > 8 ) {
109- $ this ->logger ->debug ('File is too large for classifier: ' . $ files [ 0 ] ->getPath ());
109+ $ this ->logger ->debug ('File is too large for classifier: ' . $ file ->getPath ());
110110 try {
111111 $ this ->logger ->debug ('removing ' . $ queueFile ->getFileId () . ' from ' . $ model . ' queue ' );
112112 $ this ->queue ->removeFromQueue ($ model , $ queueFile );
@@ -119,7 +119,7 @@ public function classifyFiles(string $model, array $queueFiles, int $timeout): \
119119 // Check file dimensions
120120 $ dimensions = @getimagesize ($ path );
121121 if (isset ($ dimensions ) && $ dimensions !== false && ($ dimensions [0 ] > 1024 || $ dimensions [1 ] > 1024 )) {
122- $ this ->logger ->debug ('File dimensions are too large for classifier: ' . $ files [ 0 ] ->getPath ());
122+ $ this ->logger ->debug ('File dimensions are too large for classifier: ' . $ file ->getPath ());
123123 try {
124124 $ this ->logger ->debug ('removing ' . $ queueFile ->getFileId () . ' from ' . $ model . ' queue ' );
125125 $ this ->queue ->removeFromQueue ($ model , $ queueFile );
@@ -131,7 +131,7 @@ public function classifyFiles(string $model, array $queueFiles, int $timeout): \
131131 }
132132 $ paths [] = $ path ;
133133 $ processedFiles [] = $ queueFile ;
134- $ fileNames [] = $ files [ 0 ] ->getPath ();
134+ $ fileNames [] = $ file ->getPath ();
135135 } catch (NotFoundException |InvalidPathException $ e ) {
136136 $ this ->logger ->warning ('Could not find file ' , ['exception ' => $ e ]);
137137 try {
0 commit comments