| @@ -64,13 +64,41 @@ | ||
| 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; |
| 72 | 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 | + } | |
| 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 | |
| 76 | 104 | if($GLOBALS['WS_PLUGIN__']['s2member']['c']['configured']) // If we are re-activating. |
| @@ -264,22 +292,6 @@ | ||
| 264 | 292 | } |
| 265 | 293 | do_action('ws_plugin__s2member_after_uninstall', get_defined_vars()); |
| 266 | 294 | } |
| 267 | 295 | |
| 268 | - /** | |
| 269 | - * Disallow automatic updates of s2Member w/ Pro is installed. | |
| 270 | - * | |
| 271 | - * @package s2Member\Installation | |
| 272 | - * @since 150717 | |
| 273 | - * | |
| 274 | - * @attaches-to `auto_update_plugin` filter. | |
| 275 | - */ | |
| 276 | - public static function auto_update_filter($update = NULL, $item = NULL) | |
| 277 | - { | |
| 278 | - if(is_object($item) && !empty($item->slug) && $item->slug === 's2member') | |
| 279 | - if(c_ws_plugin__s2member_utils_conds::pro_is_installed()) | |
| 280 | - $update = FALSE; // Disallow. | |
| 281 | - | |
| 282 | - return $update; // Filter through. | |
| 283 | - } | |
| 284 | 296 | } |
| 285 | 297 | } |