get('wcgateway.settings');
assert($settings instanceof Settings);
// TODO: This is a flag only present in the #legacy-ui. Should we change this to a filter, or remove the DB reset code?
$should_clear_db = $settings->has('uninstall_clear_db_on_uninstall') && $settings->get('uninstall_clear_db_on_uninstall');
if (!$should_clear_db) {
return;
}
$clear_db = $app_container->get('uninstall.clear-db');
assert($clear_db instanceof ClearDatabaseInterface);
$option_names = $app_container->get('uninstall.ppcp-all-option-names');
$scheduled_action_names = $app_container->get('uninstall.ppcp-all-scheduled-action-names');
$clear_db->delete_options($option_names);
$clear_db->clear_scheduled_actions($scheduled_action_names);
} catch (\WooCommerce\PayPalCommerce\Throwable $throwable) {
$message = sprintf('Error: %s
%s', $throwable->getMessage(), $throwable->getTraceAsString()); add_action('all_admin_notices', static function () use ($message) { $class = 'notice notice-error'; printf('
%2$s