Optionally, also adds a notice in case all db tables are not present. Returns list of tables.
Note that we only check missing tables and don't care about exact table structure because many time tables are modified by merchants to better suit their needs (indexes, collations etc).
This commit creates a new method called
WC_Admin_Status::output_plugins_info() that is used to display the
plugins that are installed on the site in the system status report page.
It is used to display both the active and inactive plugins sections and
it was created to remove code duplication.
I don't think that adding this code as a method to WC_Admin_Status is
an ideal solution but it is the best that I could think and it is better
than duplicating code. Suggestions of other places are welcome.
The check now also tests whether wc admin is active to prevent notice about undefined constant when running on WP 5.2 and older, or with inactive WC Admin.
WooCommerce relies on the constant DB_NAME to display information about the database tables in the system status page. The problem is that this constant is not always defined (e.g., when the plugin HyperDB is used to replace the standard wpdb class). When that is the case, WooCommerce will incorrectly say that its core tables are missing and the following PHP warning will be generated:
```
Use of undefined constant DB_NAME - assumed 'DB_NAME' (this will throw an Error in a future version of PHP)
wp-content/plugins/woocommerce/includes/api/v2/class-wc-rest-system-status-v2-controller.php:708
```
To fix this, this commit checks to see if DB_NAME is defined before using it. When the constant is not set, WooCommerce will display the following message to the users instead of the list of supposedly missing tables:
```
Database information: Unable to retrieve database information. Usually, this is not a problem, and it only means that your install is using a class that replaces the WordPress database class (e.g., HyperDB) and WooCommerce is unable to get database information.
```
This commit introduces a banner that notifies and prompts users to upgrade their WordPress and/or PHP if they are outdated and not part of the minimum required versions going into WooCommerce 3.7.
* Add backward compatible function wp_check_php_version for sites running WP version smaller than 5.1
* Refactor some messaging, move widget to top of WC dashboard widgets, add buttons linking out to WP pages with instructions.
* Add missing variables for adding nag class
* Add styling to dashboard widget
* Rework css to use exclamation instead
* Clean up widget, make sure no widget is registered when dismissed. Add banner that links to widget and make it dismissable.
* Update constant to reflect minimum requirements.
* Don't show banner. Fix undefined variable.
* Remove dashboard widget
* Update banner link to docs site
* Add link to docs page where instructions live for updating
* Change button text
* Add UTM params to docs link
* Moved the msg logic from template to php file.
* Bail out early when PHP and WP versions are ok.
* Added missing translation functiog
* Extracted notice function from reset_admin_notices.
To follow suit with other similar functions in the file.
* Synchronize fetching of WP version.
* Removed unused functions.
* Corrected indent.
* Reduce number of variables and fixed coding standards
* Updated wording of the notice.
The dismiss button in the WC admin notices `legacy_shipping` and `no_shipping_methods` was not fully clickable due to a custom CSS applied to them. This custom CSS was used to add a background image to those notices. More specifically, the problem was caused by the use of `position: relative` applied to `<p>` elements. I couldn't find an easy way to fix this problem keeping the custom background image, so I opted to remove it to make the design of all notices identical (besides the background image, the custom CSS also added a few other differences to those to notices like the font size of the notice title).