-
Notifications
You must be signed in to change notification settings - Fork 143
Back up edited full image sources when restoring the original image
#314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ff1616a
ee8d1cb
577ea64
10e09b7
8cfb0e4
e1e0368
d64771e
d00cb2f
178cdba
849c6fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -244,6 +244,7 @@ function webp_uploads_update_attachment_metadata( $data, $attachment_id ) { | |
| return webp_uploads_backup_sources( $attachment_id, $data ); | ||
| case 'wp_restore_image': | ||
| // When an image has been restored. | ||
| $data = webp_uploads_backup_sources( $attachment_id, $data ); | ||
| return webp_uploads_restore_image( $attachment_id, $data ); | ||
| } | ||
| } | ||
|
|
@@ -387,9 +388,8 @@ function webp_uploads_get_next_full_size_key_from_backup( $attachment_id ) { | |
| */ | ||
| function webp_uploads_restore_image( $attachment_id, $data ) { | ||
| $backup_sources = get_post_meta( $attachment_id, '_wp_attachment_backup_sources', true ); | ||
|
|
||
| if ( ! is_array( $backup_sources ) ) { | ||
| return $data; | ||
| $backup_sources = array(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have the same question as Felix and would like to explore that edge case. I tried this edge case in which the After this snippet, we have another snippet that checks two things if In this edge case the function return Please let me know if I'm getting anything wrong.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From what I can tell it doesn't really matter though which way to go about this line of code, for the following reason:
cc @mitogh |
||
| } | ||
|
|
||
| if ( ! isset( $backup_sources['full-orig'] ) || ! is_array( $backup_sources['full-orig'] ) ) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.