mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 18:22:40 -04:00 
			
		
		
		
	only move unaffected files, regenerate affected files
This commit is contained in:
		
							parent
							
								
									d90080f325
								
							
						
					
					
						commit
						7621e10840
					
				| @ -102,11 +102,17 @@ def move_old_to_new_locations(apps, schema_editor): | ||||
|         old_path = archive_path_old(doc) | ||||
|         new_path = archive_path_new(doc) | ||||
| 
 | ||||
|         if old_path != new_path and not os.path.isfile(new_path): | ||||
|             logger.debug( | ||||
|                 f"Moving {old_path} to {new_path}" | ||||
|             ) | ||||
|             shutil.move(old_path, new_path) | ||||
|         if doc.id in affected_document_ids: | ||||
|             # remove affected archive versions | ||||
|             if os.path.isfile(old_path): | ||||
|                 os.unlink(old_path) | ||||
|         else: | ||||
|             # move unaffected archive versions | ||||
|             if old_path != new_path and os.path.isfile(old_path) and not os.path.isfile(new_path): | ||||
|                 logger.debug( | ||||
|                     f"Moving {old_path} to {new_path}" | ||||
|                 ) | ||||
|                 shutil.move(old_path, new_path) | ||||
| 
 | ||||
|     # regenerate archive documents | ||||
|     for doc_id in affected_document_ids: | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user