Skip to content

Commit fdb8521

Browse files
authored
Merge pull request #686 from newfold-labs/fix/onboarding-restart-tests
Fix 2.6.7 failing restart tests
2 parents b83212e + a450cad commit fdb8521

File tree

1 file changed

+3
-27
lines changed

1 file changed

+3
-27
lines changed

includes/Services/StatusService.php

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -58,39 +58,12 @@ private static function is_site_created_within_last_9_months(): bool {
5858
return $install_date_timestamp >= $nine_months_ago;
5959
}
6060

61-
/**
62-
* Checks if the request is a page refresh/reload.
63-
*
64-
* @return bool True if the page is a page refresh, false otherwise.
65-
*/
66-
private static function is_page_refresh(): bool {
67-
if ( isset( $_SERVER['HTTP_CACHE_CONTROL'] ) && 'max-age=0' === $_SERVER['HTTP_CACHE_CONTROL'] ) {
68-
return true;
69-
}
70-
71-
if ( ! isset( $_SERVER['HTTP_REFERER'] ) ) {
72-
return true;
73-
}
74-
75-
$referer = wp_parse_url( $_SERVER['HTTP_REFERER'] );
76-
if ( isset( $referer['query'] ) && strpos( $referer['query'], 'page=nfd-onboarding' ) !== false ) {
77-
return true;
78-
}
79-
80-
return false;
81-
}
82-
8361
/**
8462
* Checks if the user is eligible to restart onboarding based on brand configuration and AI SiteGen capability.
8563
*
8664
* @return bool True if eligible, false otherwise.
8765
*/
8866
public static function is_onboarding_restart_eligible(): bool {
89-
// If request is a page refresh, we either installing the theme or a user-invoked page refresh
90-
if ( self::is_page_refresh() ) {
91-
return false;
92-
}
93-
9467
// Check if the brand is eligible for Restarting Onboarding
9568
$brand_config = Brands::get_brands()[ NFD_ONBOARDING_PLUGIN_BRAND ]['config'] ?? array();
9669
if ( empty( $brand_config['canRestartOnboarding'] ) || ! $brand_config['canRestartOnboarding'] ) {
@@ -111,6 +84,9 @@ public static function is_onboarding_restart_eligible(): bool {
11184
* @return void
11285
*/
11386
public static function update_onboarding_restart_status(): void {
87+
if ( isset( $_GET['page'] ) && \sanitize_text_field( wp_unslash( $_GET['page'] ) ) === 'nfd-onboarding' ) {
88+
return;
89+
}
11490

11591
// Don't do anything if the customer is not eligible
11692
if ( ! self::is_onboarding_restart_eligible() ) {

0 commit comments

Comments
 (0)