Update the uninstall routine to fix review issues.

- PHP version check should not be needed anymore, as WC core requires PHP 7.0+
- The uninstallation/cleanup is not aborted if WC Admin can't be loaded
- Replaced init() call by drop_tables() call, as that's what probably needs to happen
This commit is contained in:
Peter Fabian 2020-02-06 12:02:55 +01:00
parent 805d499649
commit 7c81915d1c
1 changed files with 7 additions and 11 deletions

View File

@ -31,19 +31,15 @@ if ( Constants::is_true( 'WC_REMOVE_ALL_DATA' ) ) {
/**
* Load core packages autoloader.
*/
if ( version_compare( PHP_VERSION, '5.6.0', '>=' ) ) {
if ( ! class_exists( 'Automattic\WooCommerce\Admin\Install' ) ) {
require __DIR__ . '/src/Autoloader.php';
if ( ! class_exists( 'Automattic\WooCommerce\Admin\Install' ) ) {
require __DIR__ . '/src/Autoloader.php';
if ( ! \Automattic\WooCommerce\Autoloader::init() ) {
return;
}
if ( \Automattic\WooCommerce\Autoloader::init() ) {
// Hook in WooCommerce Admin installation code.
// @todo an alternate way to do this is allow FeaturePlugin::has_satisfied_dependencies()
// to work during uninstall - (no WooCommerce instance).
\Automattic\WooCommerce\Admin\Install::drop_tables();
}
// Hook in WooCommerce Admin installation code.
// @todo an alternate way to do this is allow FeaturePlugin::has_satisfied_dependencies()
// to work during uninstall - (no WooCommerce instance).
\Automattic\WooCommerce\Admin\Install::init();
}
include_once dirname( __FILE__ ) . '/includes/class-wc-install.php';