Skip to content

Commit f736e47

Browse files
author
Justin Shreve
authored
Onboarding - Add extra plugin debug to plugin installation (woocommerce#3272)
* Add extra plugin debug to plugin installation * Add additional debug
1 parent 0976998 commit f736e47

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/API/OnboardingPlugins.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,44 @@ public function install_plugin( $request ) {
199199
)
200200
);
201201

202+
// Log extra debug for plugin installation.
203+
$logger = wc_get_logger();
204+
$logger_source = array(
205+
'source' => 'woocommerce-admin',
206+
);
207+
202208
if ( is_wp_error( $api ) ) {
209+
$logger->info(
210+
sprintf( 'The requested plugin `%s` could not be installed. plugins_api call failed.', sanitize_key( $slug ) ),
211+
$logger_source
212+
);
213+
$logger->debug(
214+
'api: ' . wc_print_r( $api, true ),
215+
$logger_source
216+
);
203217
return new \WP_Error( 'woocommerce_rest_plugin_install', __( 'The requested plugin could not be installed.', 'woocommerce-admin' ), 500 );
204218
}
205219

206220
$upgrader = new \Plugin_Upgrader( new \Automatic_Upgrader_Skin() );
207221
$result = $upgrader->install( $api->download_link );
208222

209223
if ( is_wp_error( $result ) || is_null( $result ) ) {
224+
$logger->info(
225+
sprintf( 'The requested plugin `%s` could not be installed. install call failed.', sanitize_key( $slug ) ),
226+
$logger_source
227+
);
228+
$logger->debug(
229+
'upgrader: ' . wc_print_r( $upgrader, true ),
230+
$logger_source
231+
);
232+
$logger->debug(
233+
'api: ' . wc_print_r( $api, true ),
234+
$logger_source
235+
);
236+
$logger->debug(
237+
'result: ' . wc_print_r( $result, true ),
238+
$logger_source
239+
);
210240
return new \WP_Error( 'woocommerce_rest_plugin_install', __( 'The requested plugin could not be installed.', 'woocommerce-admin' ), 500 );
211241
}
212242

0 commit comments

Comments
 (0)