mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-31 10:37:12 -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) |         old_path = archive_path_old(doc) | ||||||
|         new_path = archive_path_new(doc) |         new_path = archive_path_new(doc) | ||||||
| 
 | 
 | ||||||
|         if old_path != new_path and not os.path.isfile(new_path): |         if doc.id in affected_document_ids: | ||||||
|             logger.debug( |             # remove affected archive versions | ||||||
|                 f"Moving {old_path} to {new_path}" |             if os.path.isfile(old_path): | ||||||
|             ) |                 os.unlink(old_path) | ||||||
|             shutil.move(old_path, new_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 |     # regenerate archive documents | ||||||
|     for doc_id in affected_document_ids: |     for doc_id in affected_document_ids: | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user