| @@ -64,12 +64,40 @@ | ||
| 64 | 64 | if(is_dir($logs_dir) && is_writable($logs_dir)) |
| 65 | 65 | if(!is_file($htaccess = $logs_dir.'/.htaccess') || !apply_filters('ws_plugin__s2member_preserve_logs_dir_htaccess', !is_writable($logs_dir.'/.htaccess'), get_defined_vars())) |
| 66 | 66 | file_put_contents($htaccess, trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir_htaccess'])))); |
| 67 | 67 | |
| 68 | + //260916.2137 Detect a genuinely fresh activation before creating the options row; missing options on any prior installation must retain legacy EOT demotion behavior. | |
| 69 | + $fresh_install = !get_option('ws_plugin__s2member_activated_version') && !is_array(get_option('ws_plugin__s2member_options')); | |
| 70 | + | |
| 68 | 71 | (!is_array(get_option('ws_plugin__s2member_cache'))) ? update_option('ws_plugin__s2member_cache', array()) : NULL; |
| 69 | 72 | (!is_array(get_option('ws_plugin__s2member_notices'))) ? update_option('ws_plugin__s2member_notices', array()) : NULL; |
| 70 | 73 | (!is_array(get_option('ws_plugin__s2member_options'))) ? update_option('ws_plugin__s2member_options', array()) : NULL; |
| 71 | 74 | (!is_numeric(get_option('ws_plugin__s2member_configured'))) ? update_option('ws_plugin__s2member_configured', '0') : NULL; |
| 75 | + | |
| 76 | + $options = (array)get_option('ws_plugin__s2member_options'); | |
| 77 | + if(!array_key_exists('eot_demotion_from', $options)) | |
| 78 | + { | |
| 79 | + $options['eot_demotion_from'] = $fresh_install ? 's2member_level' : 'all'; | |
| 80 | + update_option('ws_plugin__s2member_options', $options); | |
| 81 | + if(is_multisite() && is_main_site()) | |
| 82 | + update_site_option('ws_plugin__s2member_options', $options); | |
| 83 | + } | |
| 84 | + unset($fresh_install, $options); | |
| 85 | + | |
| 86 | + //260902.0420 A Framework activation/update invalidates cached Pro update availability; the next admin request will refresh it in the background. | |
| 87 | + if($reactivation_reason === '' || $reactivation_reason === 'version') | |
| 88 | + { | |
| 89 | + $options = (array)get_option('ws_plugin__s2member_options'); | |
| 90 | + if(isset($options['pro_latest_version'])) | |
| 91 | + { | |
| 92 | + unset($options['pro_latest_version']); | |
| 93 | + $options = ws_plugin__s2member_configure_options_and_their_defaults($options); | |
| 94 | + update_option('ws_plugin__s2member_options', $options); | |
| 95 | + if(is_multisite() && is_main_site()) | |
| 96 | + update_site_option('ws_plugin__s2member_options', $options); | |
| 97 | + } | |
| 98 | + unset($options); | |
| 99 | + } | |
| 72 | 100 | |
| 73 | 101 | //260809 Seed hashed Defuse key mappings on activation after installation or updates; migration is idempotent. |
| 74 | 102 | c_ws_plugin__s2member_utils_defuse::migrate_legacy_defuse_key_mappings(); |
| 75 | 103 | |