From 3a2ff87ff31f40d98ab547615dab6054792f04d2 Mon Sep 17 00:00:00 2001 From: arunshenoy99 Date: Mon, 20 Mar 2023 07:16:37 +0530 Subject: [PATCH] sunset setting of mm_install_date and use nfd_module_onboarding_start_date --- includes/Data/Options.php | 47 +++++++++++++------------ includes/RestApi/SettingsController.php | 2 +- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/includes/Data/Options.php b/includes/Data/Options.php index df9826886..d8ccdb2ee 100644 --- a/includes/Data/Options.php +++ b/includes/Data/Options.php @@ -5,19 +5,19 @@ * Stores all the WordPress Options used in the module. */ final class Options { - /** - * Prefix for options in the module. - * - * @var string - */ + /** + * Prefix for options in the module. + * + * @var string + */ protected static $prefix = 'nfd_module_onboarding_'; - /** - * List of all the options. - * - * @var array - */ + /** + * List of all the options. + * + * @var array + */ protected static $options = array( 'redirect' => 'redirect', @@ -28,6 +28,7 @@ final class Options { 'close_comments_days_old' => 'close_comments_days_old', 'comments_per_page' => 'comments_per_page', 'install_date' => 'mm_install_date', + 'start_date' => 'start_date', 'allow_major_auto_core_updates' => 'allow_major_auto_core_updates', 'allow_minor_auto_core_updates' => 'allow_minor_auto_core_updates', 'auto_update_plugin' => 'auto_update_plugin', @@ -76,21 +77,21 @@ final class Options { * @return string|boolean */ public static function get_option_name( $option_key, $attach_prefix = true ) { - return isset( self::$options[ $option_key ] ) - ? ( $attach_prefix - ? self::$prefix . self::$options[ $option_key ] - : self::$options[ $option_key ] - ) - : false; + return isset( self::$options[ $option_key ] ) + ? ( $attach_prefix + ? self::$prefix . self::$options[ $option_key ] + : self::$options[ $option_key ] + ) + : false; } - /** - * Get the list of all options. - * - * @return array - */ + /** + * Get the list of all options. + * + * @return array + */ public static function get_all_options() { - return self::$options; + return self::$options; } /** @@ -99,6 +100,6 @@ public static function get_all_options() { * @return array */ public static function get_initialization_options() { - return self::$initialization_options; + return self::$initialization_options; } } diff --git a/includes/RestApi/SettingsController.php b/includes/RestApi/SettingsController.php index 6280bd095..a59456c11 100644 --- a/includes/RestApi/SettingsController.php +++ b/includes/RestApi/SettingsController.php @@ -255,7 +255,7 @@ public function initialize() { \update_option( Options::get_option_name( $option_key, false ), $option_value ); } // Can't be part of initialization constants as they are static. - \update_option( Options::get_option_name( 'install_date', false ), gmdate( 'M d, Y' ) ); + \update_option( Options::get_option_name( 'start_date' ), gmdate( 'U' ) ); // Flush permalinks flush_rewrite_rules();