| @@ -64,9 +64,9 @@ | ||
| 64 | 64 | return false; |
| 65 | 65 | } |
| 66 | 66 | $initial_body = wp_remote_retrieve_body( $initial_response ); |
| 67 | 67 | $initial_data = json_decode( $initial_body, true ); |
| 68 | - $total_pages = isset( $initial_data['articles']['pages'] ) ? $initial_data['articles']['pages'] : 0; | |
| 68 | + $total_pages = $initial_data['articles']['pages']; | |
| 69 | 69 | update_option( 'betterdocs_helpscout_total_pages', $total_pages ); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $current_page = get_option( 'betterdocs_helpscout_current_page', 1 ); |
| @@ -157,11 +157,15 @@ | ||
| 157 | 157 | delete_option( 'betterdocs_helpscout_total_pages' ); |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | } catch ( \WP_Error $wp_error ) { |
| 161 | - return false; | |
| 161 | + // Handle WP_Error exceptions | |
| 162 | + //error_log('WP_Error occurred during migration: ' . $wp_error->get_error_message()); | |
| 163 | + return false; // Indicate failure to process the current item | |
| 162 | 164 | } catch ( \Exception $e ) { |
| 163 | - return false; | |
| 165 | + // Handle other exceptions | |
| 166 | + //error_log('Error occurred during migration: ' . $e->getMessage()); | |
| 167 | + return false; // Indicate failure to process the current item | |
| 164 | 168 | } |
| 165 | 169 | |
| 166 | 170 | return true; // Indicate success |
| 167 | 171 | } |