Support » Plugin: Import external attachments » Process selected posts feature?

  • Resolved techsmurfy

    (@techsmurfy)


    I’ve successfully imported the images from the last 3 months, until I got a timeout.
    But I’m importing images from a 7-year old newspaper (over 70k) so right now the plugin is of no use to me, as it now constantly encounters a “PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes)” or “PHP Fatal error: Maximum execution time of 30 seconds exceeded”.

    As it will be impossible for the plugin to work on such a huge database on the specs of a shared server, I think it would be really useful if the author could implement a semi-bulk feature, that is selecting for example which MONTH’s posts you’d like to import images from, rather than loading them all at once.

    I know that IF it starts importing, it goes smoothly with that ‘process 50 posts at a time’, but the problem lies BEFORE processing. It won’t even load the plugin page, and when it finally does, after pressing “Import Attachments Now” nothing happens. If I could just move past these steps and start processing, it will be fine.

Viewing 1 replies (of 1 total)
  • Solved this in import-external-attachments.php by replacing all 3 instances of:

    $posts = get_posts( array( 'numberposts' => -1 ) );

    with

    //$posts = get_posts( array( 'numberposts' => -1 ) );
    $posts = get_posts( array( 'numberposts' => 2500, 'offset'=> 0 ) );

    Basically it checks only the last 2500 posts. If you want it to check the next 2500 after that, you edit the offset value (for example if you enter 2499 instead of 0, it will check posts 2500 to 5000 and so on). Helps with very large databases and media libraries.

    Hopefully a similar solution can be applied to many plugins that can’t process this huge amount of posts/media.

Viewing 1 replies (of 1 total)
  • The topic ‘Process selected posts feature?’ is closed to new replies.