From e471bf97d751dd78067d562fed436eea7bf97115 Mon Sep 17 00:00:00 2001 From: arunshenoy99 Date: Mon, 1 Apr 2024 16:50:49 +0530 Subject: [PATCH 1/2] Sitegen: Refactor Error State --- includes/Services/FlowService.php | 3 +++ includes/Services/SiteGenService.php | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/includes/Services/FlowService.php b/includes/Services/FlowService.php index 7daefa8..1e8c530 100644 --- a/includes/Services/FlowService.php +++ b/includes/Services/FlowService.php @@ -91,6 +91,9 @@ public static function get_data() { $result = self::get_default_data(); self::update_data_in_wp_option( $result ); } + + $result = SiteGenService::reset_error_status( $result ); + return $result; } diff --git a/includes/Services/SiteGenService.php b/includes/Services/SiteGenService.php index b613e2d..9638962 100644 --- a/includes/Services/SiteGenService.php +++ b/includes/Services/SiteGenService.php @@ -1157,4 +1157,12 @@ public static function sync_flow_data( $updated_data ) { $data['sitegen']['homepages']['data'] = $updated_data; FlowService::update_data_in_wp_option( $data ); } + + public static function reset_error_status( $data ) { + if ( isset( $data['sitegen']['siteGenErrorStatus'] ) && true === $data['sitegen']['siteGenErrorStatus'] ) { + $data['sitegen']['siteGenErrorStatus'] = false; + } + + return $data; + } } From 3949a087c430b12c3f1fc5eab345ac4b4649dd9e Mon Sep 17 00:00:00 2001 From: arunshenoy99 Date: Mon, 1 Apr 2024 16:54:33 +0530 Subject: [PATCH 2/2] Add doc comment for reset error status function --- includes/Services/SiteGenService.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/Services/SiteGenService.php b/includes/Services/SiteGenService.php index 9638962..ac9371f 100644 --- a/includes/Services/SiteGenService.php +++ b/includes/Services/SiteGenService.php @@ -1158,6 +1158,12 @@ public static function sync_flow_data( $updated_data ) { FlowService::update_data_in_wp_option( $data ); } + /** + * Reset the error status in the flow data. + * + * @param array $data The flow data. + * @return array + */ public static function reset_error_status( $data ) { if ( isset( $data['sitegen']['siteGenErrorStatus'] ) && true === $data['sitegen']['siteGenErrorStatus'] ) { $data['sitegen']['siteGenErrorStatus'] = false;