-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed SQL errors if allowed IDs are empty. #20
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice 👍
src/CliCommand.php
Outdated
} | ||
if ($allowedOrderItemIds) { | ||
$tableWheres["{$wpdb->prefix}woocommerce_order_itemmeta"] = "order_item_id IN ({$allowedOrderItemIds})"; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move these in the WooCommerce group/block below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean here, but we can refactor later on.
Not sure how there can be empty user IDs though. Every site needs at least one administrator account, so this is technically not possible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can move forward with this. But as mentioned before, this case most likely does not result in a functional website, because too much data is omitted in the dump. Therefore I added a warning message to inform the user about this problem.
If you are experiencing the issue of empty $allowedUserIds
in one of our current sites, then you will have to dig deeper than this PR. If you only faced the WooCommerce related query errors, and you only added the same condition for the user IDs for consistency in the code, then everything is okay.
@sun — you are right, I only experienced empty order ids, so a shop with no orders yet, and thought maybe check users while at it. Now that you mentioned it, it doesn't really makes sense to check for admins, if that one is empty, you've got bigger problems than not being able to clean export your database, I will actually remove this to keep the codebase as clean as possible, thanks for the tip. |
No description provided.