awesomemotive / one-click-demo-import

One Click Demo Import plugin
https://www.awesomemotive.com/
195 stars 84 forks source link

Keep track of failed media imports and skip on next AJAX calls #286

Closed donmhico closed 1 year ago

donmhico commented 1 year ago

Description

This PR keeps track of the failed media imports via transient named ocdi_importer_data_failed_attachment_imports and skip them on the next AJAX calls to prevent an infinite loop.

Motivation

Fixes #216.

Testing procedure

  1. Create an export the has multiple attachments.
  2. Edit the content xml and change the attachment URLs to anything that would be invalid.
  3. Use this snippet
    function ocdi_change_time_of_single_ajax_call() {
    return 1;
    }
    add_filter( 'ocdi/time_for_one_ajax_call', 'ocdi_change_time_of_single_ajax_call' );
  4. Perform the OCDI import.
  5. The import should complete with failed media imports.
Screenshot 2023-11-14 at 20 10 55