Support » Plugins and Hacks » [Resolved] import start action

[Resolved] import start action

  • 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.



Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Workshopshed


    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.

    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.

    Plugin Author Workshopshed


    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

    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.

    Plugin Author Workshopshed


    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');

    Thanks, it’s works too.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] import start action’ is closed to new replies.