Skip to content

Make the importer resumable#88

Open
joehoyle wants to merge 11 commits intomasterfrom
resumable
Open

Make the importer resumable#88
joehoyle wants to merge 11 commits intomasterfrom
resumable

Conversation

@joehoyle
Copy link
Member

@joehoyle joehoyle commented Oct 7, 2016

Currently the importer runs a full everytime, which can be a big issue when there is a low execution time limit on the server. Instead, it would be great if the importer resued where it left off so it will function in all environments.

*
* [--disable-fetch-attachments]
* : Disable downloading external attachments.
*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be in a separate PR.

$err = $this->handle_select( wp_unslash( $_REQUEST['id'] ) );

$previous_import = get_post_meta( $this->id, '_importer_state', true );
if ( is_a( $previous_import, 'WXR_Importer' ) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to use instanceof; is_a is deprecated in 5.2.

'node' => $importer->current_node,
) );
exit;
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be 5.2 compatible, I think?

if ( ! empty( $mapping['slug_overrides'] ) ) {
$importer->set_user_slug_overrides( $mapping['slug_overrides'] );
// Try to restore the importer from a previous run.
$importer = get_post_meta( $this->id, '_importer_state', true );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be optional.

Copy link
Member Author

@joehoyle joehoyle Oct 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It essentially is optional, see the "Resume" intermediary screen, however I need to add the delete resume data from that.

if ( $element_count < $this->current_node ) {
continue;
}
$this->current_node = $element_count;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be after the ::ELEMENT check, otherwise you could resume half-way through an attribute.

Copy link
Member

@rmccue rmccue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally forgot to merge this. Changes look good.

Will test it out locally before I merge though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants