Skip to content

Commit

Permalink
Update v-import-cpanel (#4139)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vipxr committed Nov 8, 2023
1 parent bbcc402 commit ee3ea29
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bin/v-import-cpanel
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ee3ea29

Please sign in to comment.