Просмотр исходного кода

Update v-import-cpanel (#4139)

Users reported that some emails date are being changed to Today, after checking yes after decompression some of the emails lost the date and set to today, the modified code copies the date from the compressed email and sets it after decompression, fixes the problem.
vipxr 2 лет назад
Родитель
Сommit
ee3ea29f7c
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      bin/v-import-cpanel

+ 6 - 1
bin/v-import-cpanel

@@ -268,10 +268,15 @@ for folder in *; do
                 		decompressed_count=0
                 		for mail_file in $(find /home/$new_user/mail/$folder -type f); do
                     			if file "$mail_file" | grep -q "gzip compressed"; then
+				       		original_time=$(stat -c %y "$mail_file" 2>/dev/null)
                         			gunzip -c "$mail_file" > "${mail_file}.decompressed" && mv "${mail_file}.decompressed" "$mail_file"
-                        			let decompressed_count++
+                        			if [ ! -z "$original_time" ]; then
+							touch -d "$original_time" "$mail_file"
+					        fi		
+						let decompressed_count++
                     			fi
                 		done
+
                 		echo "$decompressed_count emails decompressed for $mail_account@$folder"
               
 				find /home/$new_user/mail/$folder -type f -name 'dovecot*' -delete