Skip to content

Conversation

@Konamiman
Copy link
Contributor

@Konamiman Konamiman commented Sep 21, 2021

All Submissions:

Changes proposed in this Pull Request:

#30041 introduced a check_lookup_table_exists method that accesses the information_schema.tables table in order to check if the lookup table exists. However it looks like this is causing issues in WPCOM: an automated code checking script is preventing Woo from being installed for this reason.

This pull request changes the mechanism for checking if the table exists to a SHOW TABLES LIKE, which is consistent with how database table existence is checked in other places of the codebase.

How to test the changes in this Pull Request:

Follow the testing instructions of #30041. Specifically, check that the options shown in the tools page and in Settings > Products > Advanced is consistent with the table existing or not.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?

Changelog entry

Fix - Use a more standard way to check if the product attributes lookup table exists.

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

This db table is used to check if the product attributes lookup table
exists, but that makes WooCommerce uninstallable in WP.COM without
a patch. This commit replaces that usage with a "SHOW TABLES LIKE"
statement, which is also consistent with other parts of the code.
@Konamiman Konamiman self-assigned this Sep 21, 2021
@Konamiman Konamiman requested review from a team and jonathansadowski and removed request for a team September 21, 2021 10:19
@jonathansadowski
Copy link
Contributor

@Konamiman could you boil down the testing instructions a little bit? This PR says to follow the testing instructions of #30041, which says to follow the testing instructions of #29190. I just want to make sure I'm understanding the expectations correctly.

Here's how I understand things, correct me if my understanding is off:

  • Settings > Products > Advanced should exist when the table exists (and should be missing when it is missing)
  • "Regenerate the product attributes lookup table" should appear in Status > Tools when the table exists (and should be missing when it is missing)

Is my understanding correct?

@Konamiman
Copy link
Contributor Author

Konamiman commented Sep 21, 2021 via email

@jonathansadowski
Copy link
Contributor

Awesome, thanks for clarifying!

@jonathansadowski jonathansadowski merged commit f7f8a8d into trunk Sep 21, 2021
@jonathansadowski jonathansadowski deleted the fix/usage_of_db_information_schema branch September 21, 2021 16:34
@jonathansadowski jonathansadowski added release: add changelog Mark all PRs that have not had their changelog entries added. [auto] release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] labels Sep 21, 2021
@github-actions github-actions bot added this to the 5.9.0 milestone Sep 21, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Sep 21, 2021

Hi @jonathansadowski, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:

  • Add the status: needs changelog label
  • Add the status: needs testing instructions label

@Konamiman Konamiman added changelog added and removed release: add changelog Mark all PRs that have not had their changelog entries added. [auto] labels Oct 15, 2021
@tammullen tammullen added testing instructions added and removed release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] labels Oct 20, 2021
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.

4 participants