Onboarding - Add extra plugin debug to plugin installation (https://github.com/woocommerce/woocommerce-admin/pull/3272)

* Add extra plugin debug to plugin installation

* Add additional debug
This commit is contained in:
Justin Shreve 2019-11-21 10:22:49 -05:00 committed by GitHub
parent 940716d7f5
commit 631ffe240f
1 changed files with 30 additions and 0 deletions

View File

@ -199,7 +199,21 @@ class OnboardingPlugins extends \WC_REST_Data_Controller {
)
);
// Log extra debug for plugin installation.
$logger = wc_get_logger();
$logger_source = array(
'source' => 'woocommerce-admin',
);
if ( is_wp_error( $api ) ) {
$logger->info(
sprintf( 'The requested plugin `%s` could not be installed. plugins_api call failed.', sanitize_key( $slug ) ),
$logger_source
);
$logger->debug(
'api: ' . wc_print_r( $api, true ),
$logger_source
);
return new \WP_Error( 'woocommerce_rest_plugin_install', __( 'The requested plugin could not be installed.', 'woocommerce-admin' ), 500 );
}
@ -207,6 +221,22 @@ class OnboardingPlugins extends \WC_REST_Data_Controller {
$result = $upgrader->install( $api->download_link );
if ( is_wp_error( $result ) || is_null( $result ) ) {
$logger->info(
sprintf( 'The requested plugin `%s` could not be installed. install call failed.', sanitize_key( $slug ) ),
$logger_source
);
$logger->debug(
'upgrader: ' . wc_print_r( $upgrader, true ),
$logger_source
);
$logger->debug(
'api: ' . wc_print_r( $api, true ),
$logger_source
);
$logger->debug(
'result: ' . wc_print_r( $result, true ),
$logger_source
);
return new \WP_Error( 'woocommerce_rest_plugin_install', __( 'The requested plugin could not be installed.', 'woocommerce-admin' ), 500 );
}