| @@ -31,8 +31,17 @@ | ||
| 31 | 31 | $this->database = Database::get_instance(); |
| 32 | 32 | $nx_free_version = $this->database->get_option('nx_free_version'); |
| 33 | 33 | $nx_db_version = $this->database->get_option('nx_db_version'); |
| 34 | 34 | |
| 35 | + // Backward compatibility: installs that already ran NotificationX | |
| 36 | + // before the first-activation flag existed must not be treated as a | |
| 37 | + // first-ever activation when they are re-activated, or they would be | |
| 38 | + // pushed into the Setup Wizard again. A stored free version proves the | |
| 39 | + // plugin has run here before, so seed the flag once. | |
| 40 | + if ( $nx_free_version && ! NotificationX::has_activated_before() ) { | |
| 41 | + update_option( NotificationX::FIRST_ACTIVATION_OPTION, time(), 'no' ); | |
| 42 | + } | |
| 43 | + | |
| 35 | 44 | // Show milestone notification only for 3.1.10 |
| 36 | 45 | $force_milstone = get_option('notificationx_force_milestone', ''); |
| 37 | 46 | if ( version_compare( NOTIFICATIONX_VERSION, '3.1.10', '==' ) && empty($force_milstone) ) { |
| 38 | 47 | delete_option('notificationx_milestone_level'); |
| @@ -50,8 +59,9 @@ | ||
| 50 | 59 | Database::get_instance()->Create_DB(); |
| 51 | 60 | $this->database->update_option('nx_db_version', Database::$version, 'no'); |
| 52 | 61 | $_is_table_created = true; |
| 53 | 62 | } catch (\Exception $th) { |
| 63 | + // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- deliberate failure logging, not debug output. | |
| 54 | 64 | error_log('NX: Database Creation Failed'); |
| 55 | 65 | } |
| 56 | 66 | } |
| 57 | 67 | |
| @@ -59,8 +69,9 @@ | ||
| 59 | 69 | try { |
| 60 | 70 | Migration::get_instance(); |
| 61 | 71 | $this->database->update_option('notificationx_2x_upgraded', true, 'no'); |
| 62 | 72 | } catch (\Exception $th) { |
| 73 | + // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- deliberate failure logging, not debug output. | |
| 63 | 74 | error_log('NX: Migration Failed'); |
| 64 | 75 | } |
| 65 | 76 | $this->database->update_option( 'nx_free_version', NOTIFICATIONX_VERSION, 'no' ); |
| 66 | 77 | } elseif(!$nx_free_version && $_is_table_created ){ |