WordPress.org

Forums

Blogger Importer
[resolved] import start action (7 posts)

  1. katazina
    Member
    Posted 1 year ago #

    Hi,

    in the code, there is a do_action('ipmort_done', 'blogger') line.
    It could be great if you would add a do_action('import_start') action too, when the import starting.

    It would be useful, because I'm caching the whole site, and because of that i should purge the blog pages when a new post is created (in this case imported).
    And if I would know when the import started, then I could manage, that purge the cached pages only when the import is done.

    In the wordpress importer, there are these two actions.

    Thanks!
    Kata

    https://wordpress.org/plugins/blogger-importer/

  2. Workshopshed
    Member
    Plugin Author

    Posted 1 year ago #

    Great suggestion.
    There's a slight technical challenge, when you press the button it starts some javascript on your page which is effectively pressing the button multiple times as the importer imports in batches.
    So it it would be easy to report the start of each batch but not so simple to do the "very first" press, will investigate.

  3. katazina
    Member
    Posted 1 year ago #

    I put a do_action('import_start') line into the import_blog() function in the blogger-importer-blog.php, after the $this->importer_started = time(); line and it's work fine for me.
    It doesn't run multiple times. I have logged it and it ran only one time.

  4. Workshopshed
    Member
    Plugin Author

    Posted 1 year ago #

    If you have a lot of posts then it will timeout after 20s (MAX_EXECUTION_TIME) and run more than once. This was done in an early version of the importer so that it could report the feedback of progress. That's changed a lot so perhaps the code could be simplified now?
    There have been suggestions that the importer should be moved across to a wordpress cron job which again might simplify the code regarding the starting and stopping

  5. katazina
    Member
    Posted 1 year ago #

    I'm just testing with a very small blog, so yes, you right, there could be a timeout. Unfortunately I can't test it with a bigger site.

  6. Workshopshed
    Member
    Plugin Author

    Posted 1 year ago #

    the following should do the trick, it checks to see if we've already started processing posts or comments if both are zero then we must be starting.

    if (!$this->posts_done && !$this->comments_done)
                    do_action('import_start', 'blogger');
  7. katazina
    Member
    Posted 1 year ago #

    Thanks, it's works too.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Blogger Importer
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.