There was a need to move the import directory cleaning procedure from catalog import step to the authorization step.
WalkingDexter created an issue. See original summary.
Issue #2796433 by WalkingDexter: Replace clear import directory code to...
Committed, thnx!
Backported patch for Drupal 6.
Issue #2796433 by sin: Fix delete never happened
The code was:
_commerceml_success(session_name() . "\n" . session_id() . "\n"); _commerceml_clear_import_directory();
So _commerceml_clear_import_directory() was never called due to _commerceml_success() call to drupal_exit().
That is why only archive import worked. File by file import was broken due to clear never executed and files always appended.
I fixed it for 7.x swapping these two code lines.
Right now the exchange may fail if file_unmanaged_delete_recursive() returns false, for example if it has no access to delete some files. So pls test before use on production sites.
Moved cleanup to init stage with 'commerceml_need_clear_import_directory' flag check. The flag is set on successful import only.
Comments
Comment #3
sin commentedCommitted, thnx!
Comment #4
walkingdexter commentedBackported patch for Drupal 6.
Comment #5
walkingdexter commentedComment #7
sin commentedThe code was:
So _commerceml_clear_import_directory() was never called due to _commerceml_success() call to drupal_exit().
That is why only archive import worked. File by file import was broken due to clear never executed and files always appended.
I fixed it for 7.x swapping these two code lines.
Comment #8
sin commentedRight now the exchange may fail if file_unmanaged_delete_recursive() returns false, for example if it has no access to delete some files. So pls test before use on production sites.
Comment #9
sin commentedComment #10
sin commentedMoved cleanup to init stage with 'commerceml_need_clear_import_directory' flag check. The flag is set on successful import only.