Skip to content

Commit

Permalink
release ready for 0.1.0.32
Browse files Browse the repository at this point in the history
  • Loading branch information
jaedm97 committed May 2, 2024
1 parent 272d0b0 commit 71837aa
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 348 deletions.
27 changes: 14 additions & 13 deletions includes/class-instawp-rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,15 @@ public function handle_post_migration_cleanup( WP_REST_Request $request ) {
return $this->throw_error( $response );
}

if ( ! function_exists( 'deactivate_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}

if ( ! function_exists( 'request_filesystem_credentials' ) ) {
require_once ABSPATH . 'wp-admin/includes/file.php';
}

$plugin_slug = INSTAWP_PLUGIN_SLUG . '/' . INSTAWP_PLUGIN_SLUG . '.php';
$response = array(
'success' => true,
'sso_login_url' => site_url(),
Expand All @@ -254,17 +263,6 @@ public function handle_post_migration_cleanup( WP_REST_Request $request ) {

Option::update_option( 'instawp_last_migration_details', $migration_details );

// reset everything and remove connection
instawp_reset_running_migration( 'hard', true );

if ( ! function_exists( 'deactivate_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}

if ( ! function_exists( 'request_filesystem_credentials' ) ) {
require_once ABSPATH . 'wp-admin/includes/file.php';
}

// Install the plugins if there is any in the request
$post_installs = $request->get_param( 'post_installs' );

Expand All @@ -287,8 +285,10 @@ public function handle_post_migration_cleanup( WP_REST_Request $request ) {
error_log( esc_html__( 'sso_url_class_not_found: This class NewfoldLabs\WP\Module\Migration\Services\MigrationSSO not found.', 'instawp-connect' ) );
}

$plugin_slug = INSTAWP_PLUGIN_SLUG . '/' . INSTAWP_PLUGIN_SLUG . '.php';
// reset everything and remove connection
instawp_reset_running_migration( 'hard', true );

// deactivate plugin
deactivate_plugins( $plugin_slug );

$is_deleted = delete_plugins( array( $plugin_slug ) );
Expand Down Expand Up @@ -529,7 +529,7 @@ public function get_customers( WP_REST_Request $request ) {
$response = array();
$customers = get_users( array( 'role' => array( 'customer' ) ) );
foreach ( $customers as $customer ) {
$customer = new \WC_Customer( $customer->ID );
$customer = new \WC_Customer( $customer->ID );
$response[] = $this->get_formatted_item_data( $customer );
}

Expand All @@ -540,6 +540,7 @@ protected function get_formatted_item_data( $object ) {
$formatted_data = $this->get_formatted_item_data_core( $object );
$formatted_data['orders_count'] = $object->get_order_count();
$formatted_data['total_spent'] = $object->get_total_spent();

return $formatted_data;
}

Expand Down
Loading

0 comments on commit 71837aa

Please sign in to comment.