| @@ -19,15 +19,21 @@ | ||
| 19 | 19 | * @return bool Returns true if the site is newly created, false otherwise. |
| 20 | 20 | */ |
| 21 | 21 | public static function maybe_show_onboarding(): bool { |
| 22 | 22 | // First we need to check if the site is newly create. |
| 23 | + global $wpdb; | |
| 23 | 24 | if ( ! is_multisite() ) { |
| 24 | - $res = get_option( 'wp_defender_shown_activator' ); | |
| 25 | + $res = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'wp_defender_shown_activator'" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery | |
| 25 | 26 | } else { |
| 26 | - $res = get_site_option( 'wp_defender_shown_activator' ); | |
| 27 | + $res = $wpdb->get_var( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching | |
| 28 | + $wpdb->prepare( | |
| 29 | + "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = 'wp_defender_shown_activator' AND site_id = %d", | |
| 30 | + get_current_network_id() | |
| 31 | + ) | |
| 32 | + ); | |
| 27 | 33 | } |
| 28 | 34 | // Get '1' for direct SQL request if Onboarding was already. |
| 29 | - if ( empty( $res ) ) { | |
| 35 | + if ( '1' !== $res ) { | |
| 30 | 36 | return true; |
| 31 | 37 | } |
| 32 | 38 | |
| 33 | 39 | return false; |