@@ -144,9 +144,9 @@ public function startImportDrive(string $userId): array {
144144 }
145145
146146 $ this ->userConfig ->setValueString ($ userId , Application::APP_ID , 'importing_drive ' , '1 ' , lazy: true );
147- $ this ->userConfig ->setValueString ($ userId , Application::APP_ID , 'nb_imported_files ' , ' 0 ' , lazy: true );
148- $ this ->userConfig ->setValueString ($ userId , Application::APP_ID , 'drive_imported_size ' , ' 0 ' , lazy: true );
149- $ this ->userConfig ->setValueString ($ userId , Application::APP_ID , 'last_drive_import_timestamp ' , ' 0 ' , lazy: true );
147+ $ this ->userConfig ->setValueInt ($ userId , Application::APP_ID , 'nb_imported_files ' , 0 , lazy: true );
148+ $ this ->userConfig ->setValueInt ($ userId , Application::APP_ID , 'drive_imported_size ' , 0 , lazy: true );
149+ $ this ->userConfig ->setValueInt ($ userId , Application::APP_ID , 'last_drive_import_timestamp ' , 0 , lazy: true );
150150 $ this ->userConfig ->deleteUserConfig ($ userId , Application::APP_ID , 'directory_progress ' );
151151
152152 $ this ->jobList ->add (ImportDriveJob::class, ['user_id ' => $ userId ]);
@@ -176,16 +176,16 @@ public function importDriveJob(string $userId): void {
176176 $ jobRunning = $ this ->userConfig ->getValueString ($ userId , APPLICATION ::APP_ID , 'drive_import_running ' , '0 ' , lazy:true ) === '1 ' ;
177177 $ nowTs = (new DateTime ())->getTimestamp ();
178178 if ($ jobRunning ) {
179- $ lastJobStart = $ this ->userConfig ->getValueString ($ userId , APPLICATION ::APP_ID , 'drive_import_job_last_start ' , lazy:true );
180- if ($ lastJobStart !== '' && ($ nowTs - intval ($ lastJobStart ) < Application::IMPORT_JOB_TIMEOUT )) {
179+ $ lastJobStart = $ this ->userConfig ->getValueInt ($ userId , APPLICATION ::APP_ID , 'drive_import_job_last_start ' , lazy:true );
180+ if ($ lastJobStart !== 0 && ($ nowTs - intval ($ lastJobStart ) < Application::IMPORT_JOB_TIMEOUT )) {
181181 $ this ->logger ->info ('Last job execution ( ' . strval ($ nowTs - intval ($ lastJobStart )) . ') is less than ' . strval (Application::IMPORT_JOB_TIMEOUT ) . ' seconds ago, delaying execution ' );
182182 // last job has started less than an hour ago => we consider it can still be running
183183 $ this ->jobList ->add (ImportDriveJob::class, ['user_id ' => $ userId ]);
184184 return ;
185185 }
186186 }
187187 $ this ->userConfig ->setValueString ($ userId , Application::APP_ID , 'drive_import_running ' , '1 ' , lazy: true );
188- $ this ->userConfig ->setValueString ($ userId , Application::APP_ID , 'drive_import_job_last_start ' , strval ( $ nowTs) , lazy: true );
188+ $ this ->userConfig ->setValueInt ($ userId , Application::APP_ID , 'drive_import_job_last_start ' , $ nowTs , lazy: true );
189189
190190 // import batch of files
191191 $ targetPath = $ this ->userConfig ->getValueString ($ userId , APPLICATION ::APP_ID , 'drive_output_dir ' , '/Google Drive ' , lazy:true );
@@ -215,7 +215,7 @@ public function importDriveJob(string $userId): void {
215215 }
216216 if (isset ($ result ['error ' ]) || (isset ($ result ['finished ' ]) && $ result ['finished ' ])) {
217217 if (isset ($ result ['finished ' ]) && $ result ['finished ' ]) {
218- $ nbImported = ( int ) $ this ->userConfig ->getValueString ($ userId , APPLICATION ::APP_ID , 'nb_imported_files ' , ' 0 ' , lazy:true );
218+ $ nbImported = $ this ->userConfig ->getValueInt ($ userId , APPLICATION ::APP_ID , 'nb_imported_files ' , lazy:true );
219219 $ this ->googleApiService ->sendNCNotification ($ userId , 'import_drive_finished ' , [
220220 'nbImported ' => $ nbImported ,
221221 'targetPath ' => $ targetPath ,
@@ -225,14 +225,14 @@ public function importDriveJob(string $userId): void {
225225 $ this ->logger ->error ('Google Drive import error: ' . $ result ['error ' ], ['app ' => Application::APP_ID ]);
226226 }
227227 $ this ->userConfig ->setValueString ($ userId , Application::APP_ID , 'importing_drive ' , '0 ' , lazy: true );
228- $ this ->userConfig ->setValueString ($ userId , Application::APP_ID , 'nb_imported_files ' , ' 0 ' , lazy: true );
229- $ this ->userConfig ->setValueString ($ userId , Application::APP_ID , 'drive_imported_size ' , ' 0 ' , lazy: true );
230- $ this ->userConfig ->setValueString ($ userId , Application::APP_ID , 'last_drive_import_timestamp ' , ' 0 ' , lazy: true );
228+ $ this ->userConfig ->setValueInt ($ userId , Application::APP_ID , 'nb_imported_files ' , 0 , lazy: true );
229+ $ this ->userConfig ->setValueInt ($ userId , Application::APP_ID , 'drive_imported_size ' , 0 , lazy: true );
230+ $ this ->userConfig ->setValueInt ($ userId , Application::APP_ID , 'last_drive_import_timestamp ' , 0 , lazy: true );
231231 $ this ->userConfig ->deleteUserConfig ($ userId , Application::APP_ID , 'directory_progress ' );
232232 } else {
233233 $ this ->userConfig ->setValueString ($ userId , Application::APP_ID , 'directory_progress ' , json_encode ($ directoryProgress ), lazy: true );
234234 $ ts = (new DateTime ())->getTimestamp ();
235- $ this ->userConfig ->setValueString ($ userId , Application::APP_ID , 'last_drive_import_timestamp ' , $ ts , lazy: true );
235+ $ this ->userConfig ->setValueInt ($ userId , Application::APP_ID , 'last_drive_import_timestamp ' , $ ts , lazy: true );
236236 $ this ->jobList ->add (ImportDriveJob::class, ['user_id ' => $ userId ]);
237237 }
238238 $ this ->userConfig ->setValueString ($ userId , Application::APP_ID , 'drive_import_running ' , '0 ' , lazy: true );
@@ -844,8 +844,8 @@ private function recursivelyCheckParentOwnership(string $rootId, array $director
844844 */
845845 private function retrieveFiles (string $ userId , string $ dirId , string $ query , bool $ considerSharedFiles , Folder $ rootImportFolder , ?Folder $ rootSharedWithMeImportFolder , array $ directoriesById , array $ sharedDirectoriesById , ?int $ maxDownloadSize , string $ targetPath , bool $ allowParents = true ): ?array {
846846 $ lastCancelCheck = time ();
847- $ alreadyImported = ( int ) $ this ->userConfig ->getValueString ($ userId , APPLICATION ::APP_ID , 'nb_imported_files ' , ' 0 ' , lazy:true );
848- $ alreadyImportedSize = ( int ) $ this ->userConfig ->getValueString ($ userId , APPLICATION ::APP_ID , 'drive_imported_size ' , ' 0 ' , lazy:true );
847+ $ alreadyImported = $ this ->userConfig ->getValueInt ($ userId , APPLICATION ::APP_ID , 'nb_imported_files ' , lazy:true );
848+ $ alreadyImportedSize = $ this ->userConfig ->getValueInt ($ userId , APPLICATION ::APP_ID , 'drive_imported_size ' , lazy:true );
849849
850850 $ conflictingIds = $ this ->getFilesWithNameConflict ($ userId , $ query , $ considerSharedFiles );
851851 $ params = [
@@ -919,9 +919,9 @@ private function retrieveFiles(string $userId, string $dirId, string $query, boo
919919
920920 if (!is_null ($ size )) {
921921 $ alreadyImported ++;
922- $ this ->userConfig ->setValueString ($ userId , Application::APP_ID , 'nb_imported_files ' , strval ( $ alreadyImported) , lazy: true );
922+ $ this ->userConfig ->setValueInt ($ userId , Application::APP_ID , 'nb_imported_files ' , $ alreadyImported , lazy: true );
923923 $ alreadyImportedSize += $ size ;
924- $ this ->userConfig ->setValueString ($ userId , Application::APP_ID , 'drive_imported_size ' , strval ( $ alreadyImportedSize) , lazy: true );
924+ $ this ->userConfig ->setValueInt ($ userId , Application::APP_ID , 'drive_imported_size ' , $ alreadyImportedSize , lazy: true );
925925 if ($ maxDownloadSize !== null && $ alreadyImportedSize > $ maxDownloadSize ) {
926926 return [
927927 'targetPath ' => $ targetPath ,
0 commit comments