@@ -257,17 +257,10 @@ private int updateUploadInternal(Cursor c, UploadStatus status, UploadResult res
257
257
* Update upload status of file uniquely referenced by id.
258
258
*
259
259
* @param id upload id.
260
- * @param status new status.
261
- * @param result new result of upload operation
262
- * @param remotePath path of the file to upload in the ownCloud storage
263
- * @param localPath path of the file to upload in the device storage
264
- * @return 1 if file status was updated, else 0.
265
260
*/
266
- private int updateUploadStatus (long id , UploadStatus status , UploadResult result , String remotePath ,
267
- String localPath ) {
261
+ private void updateUploadStatus (long id ) {
268
262
//Log_OC.v(TAG, "Updating "+filepath+" with uploadStatus="+status +" and result="+result);
269
263
270
- int returnValue = 0 ;
271
264
Cursor c = getDB ().query (
272
265
ProviderTableMeta .CONTENT_URI_UPLOADS ,
273
266
null ,
@@ -280,15 +273,12 @@ private int updateUploadStatus(long id, UploadStatus status, UploadResult result
280
273
if (c .getCount () != SINGLE_RESULT ) {
281
274
Log_OC .e (TAG , c .getCount () + " items for id=" + id
282
275
+ " available in UploadDb. Expected 1. Failed to update upload db." );
283
- } else {
284
- returnValue = updateUploadInternal (c , status , result , remotePath , localPath );
285
276
}
286
277
c .close ();
287
278
} else {
288
279
Log_OC .e (TAG , "Cursor is null" );
289
280
}
290
281
291
- return returnValue ;
292
282
}
293
283
294
284
/**
@@ -733,7 +723,7 @@ private ContentResolver getDB() {
733
723
return contentResolver ;
734
724
}
735
725
736
- public long clearFailedButNotDelayedUploads () {
726
+ public void clearFailedButNotDelayedUploads () {
737
727
User user = currentAccountProvider .getUser ();
738
728
final long deleted = getDB ().delete (
739
729
ProviderTableMeta .CONTENT_URI_UPLOADS ,
@@ -753,7 +743,6 @@ public long clearFailedButNotDelayedUploads() {
753
743
if (deleted > 0 ) {
754
744
notifyObserversNow ();
755
745
}
756
- return deleted ;
757
746
}
758
747
759
748
public void clearCancelledUploadsForCurrentAccount () {
@@ -770,7 +759,7 @@ public void clearCancelledUploadsForCurrentAccount() {
770
759
}
771
760
}
772
761
773
- public long clearSuccessfulUploads () {
762
+ public void clearSuccessfulUploads () {
774
763
User user = currentAccountProvider .getUser ();
775
764
final long deleted = getDB ().delete (
776
765
ProviderTableMeta .CONTENT_URI_UPLOADS ,
@@ -782,7 +771,6 @@ public long clearSuccessfulUploads() {
782
771
if (deleted > 0 ) {
783
772
notifyObserversNow ();
784
773
}
785
- return deleted ;
786
774
}
787
775
788
776
/**
@@ -803,39 +791,19 @@ public void updateDatabaseUploadResult(RemoteOperationResult uploadResult, Uploa
803
791
804
792
if (uploadResult .isSuccess ()) {
805
793
updateUploadStatus (
806
- upload .getOCUploadId (),
807
- UploadStatus .UPLOAD_SUCCEEDED ,
808
- UploadResult .UPLOADED ,
809
- upload .getRemotePath (),
810
- localPath
811
- );
794
+ upload .getOCUploadId ());
812
795
} else if (uploadResult .getCode () == RemoteOperationResult .ResultCode .SYNC_CONFLICT &&
813
796
new FileUploadHelper ().isSameFileOnRemote (
814
797
upload .getUser (), new File (upload .getStoragePath ()), upload .getRemotePath (), upload .getContext ())) {
815
798
816
799
updateUploadStatus (
817
- upload .getOCUploadId (),
818
- UploadStatus .UPLOAD_SUCCEEDED ,
819
- UploadResult .SAME_FILE_CONFLICT ,
820
- upload .getRemotePath (),
821
- localPath
822
- );
800
+ upload .getOCUploadId ());
823
801
} else if (uploadResult .getCode () == RemoteOperationResult .ResultCode .LOCAL_FILE_NOT_FOUND ) {
824
802
updateUploadStatus (
825
- upload .getOCUploadId (),
826
- UploadStatus .UPLOAD_SUCCEEDED ,
827
- UploadResult .FILE_NOT_FOUND ,
828
- upload .getRemotePath (),
829
- localPath
830
- );
803
+ upload .getOCUploadId ());
831
804
} else {
832
805
updateUploadStatus (
833
- upload .getOCUploadId (),
834
- UploadStatus .UPLOAD_FAILED ,
835
- UploadResult .fromOperationResult (uploadResult ),
836
- upload .getRemotePath (),
837
- localPath
838
- );
806
+ upload .getOCUploadId ());
839
807
}
840
808
}
841
809
}
@@ -848,12 +816,7 @@ public void updateDatabaseUploadStart(UploadFileOperation upload) {
848
816
? upload .getStoragePath () : null ;
849
817
850
818
updateUploadStatus (
851
- upload .getOCUploadId (),
852
- UploadStatus .UPLOAD_IN_PROGRESS ,
853
- UploadResult .UNKNOWN ,
854
- upload .getRemotePath (),
855
- localPath
856
- );
819
+ upload .getOCUploadId ());
857
820
}
858
821
859
822
/**
@@ -890,9 +853,9 @@ public int failInProgressUploads(UploadResult fail) {
890
853
}
891
854
892
855
@ VisibleForTesting
893
- public int removeAllUploads () {
856
+ public void removeAllUploads () {
894
857
Log_OC .v (TAG , "Delete all uploads!" );
895
- return getDB ().delete (
858
+ getDB ().delete (
896
859
ProviderTableMeta .CONTENT_URI_UPLOADS ,
897
860
"" ,
898
861
new String []{});
0 commit comments