/** * Update Execution * * @since 4.0 * * @param string $old_version Old version number * * @return void */ private function upgrade_execute($upgrade = false) { global $itsec_old_version, $itsec_globals, $wpdb, $itsec_setup_action; $tables_updated = false; $itsec_setup_action = 'upgrade'; $itsec_old_version = $upgrade; if ($itsec_old_version < 4000) { global $itsec_bwps_options; if (wp_next_scheduled('bwps_backup')) { wp_clear_scheduled_hook('bwps_backup'); } if (is_multisite()) { switch_to_blog(1); $itsec_bwps_options = get_option('bit51_bwps'); delete_option('bit51_bwps'); delete_option('bwps_intrusion_warning'); delete_option('bit51_bwps_data'); delete_site_transient('bit51_bwps_backup'); delete_site_transient('bwps_away'); restore_current_blog(); } else { $itsec_bwps_options = get_option('bit51_bwps'); delete_option('bit51_bwps'); delete_option('bwps_intrusion_warning'); delete_option('bit51_bwps_data'); delete_site_transient('bit51_bwps_backup'); delete_site_transient('bwps_away'); } if ($itsec_bwps_options !== false) { $current_options = get_site_option('itsec_global'); if ($current_options === false) { $current_options = $this->defaults; } $current_options['notification_email'] = array(isset($itsec_bwps_options['ll_emailaddress']) && strlen($itsec_bwps_options['ll_emailaddress']) ? $itsec_bwps_options['ll_emailaddress'] : get_option('admin_email')); $current_options['backup_email'] = array(isset($itsec_bwps_options['backup_emailaddress']) && strlen($itsec_bwps_options['backup_emailaddress']) ? $itsec_bwps_options['backup_emailaddress'] : get_option('admin_email')); $current_options['blacklist'] = isset($itsec_bwps_options['ll_blacklistip']) && $itsec_bwps_options['ll_blacklistip'] == 0 ? false : true; $current_options['blacklist_count'] = isset($itsec_bwps_options['ll_blacklistipthreshold']) && intval($itsec_bwps_options['ll_blacklistipthreshold']) > 0 ? intval($itsec_bwps_options['ll_blacklistipthreshold']) : 3; $current_options['write_files'] = isset($itsec_bwps_options['st_writefiles']) && $itsec_bwps_options['st_writefiles'] == 1 ? true : false; $itsec_globals['settings']['write_files'] = $current_options['write_files']; $current_options['did_upgrade'] = true; if (isset($itsec_bwps_options['id_whitelist']) && !is_array($itsec_bwps_options['id_whitelist']) && strlen($itsec_bwps_options['id_whitelist']) > 1) { $raw_hosts = explode(PHP_EOL, $itsec_bwps_options['id_whitelist']); foreach ($raw_hosts as $host) { if (strlen($host) > 1) { $current_options['lockout_white_list'][] = $host; } } } if ($current_options['write_files'] === false) { set_site_transient('ITSEC_SHOW_WRITE_FILES_TOOLTIP', true, 600); } update_site_option('itsec_global', $current_options); } $wpdb->query("DROP TABLE IF EXISTS `" . $wpdb->base_prefix . "bwps_lockouts`;"); $wpdb->query("DROP TABLE IF EXISTS `" . $wpdb->base_prefix . "bwps_log`;"); $wpdb->query("DROP TABLE IF EXISTS `" . $wpdb->base_prefix . "BWPS_d404`;"); $wpdb->query("DROP TABLE IF EXISTS `" . $wpdb->base_prefix . "BWPS_ll`;"); $wpdb->query("DROP TABLE IF EXISTS `" . $wpdb->base_prefix . "BWPS_lockouts`;"); delete_option('bwps_file_log'); delete_option('bwps_awaymode'); delete_option('bwps_filecheck'); delete_option('BWPS_Login_Slug'); delete_option('BWPS_options'); delete_option('BWPS_versions'); delete_option('bit51_bwps_data'); } $this->do_modules(); $itsec_globals['data']['build'] = ITSEC_Core::get_plugin_build(); update_site_option('itsec_data', $itsec_globals['data']); if ($itsec_old_version < 4030) { ITSEC_Lib::create_database_tables(); //adds username field to lockouts and temp $tables_updated = true; ITSEC_Response::regenerate_server_config(); } if ($itsec_old_version < 4031) { $banned_option = get_site_option('itsec_ban_users'); if (isset($banned_option['white_list'])) { $banned_white_list = $banned_option['white_list']; $options = get_site_option('itsec_global'); $white_list = isset($options['lockout_white_list']) ? $options['lockout_white_list'] : array(); if (!is_array($white_list)) { $white_list = explode(PHP_EOL, $white_list); } if (!is_array($banned_white_list)) { $banned_white_list = explode(PHP_EOL, $banned_white_list); } $new_white_list = array_merge($white_list, $banned_white_list); $options['lockout_white_list'] = $new_white_list; update_site_option('itsec_global', $options); } } if ($itsec_old_version < 4033) { if (get_site_option('itsec_api_nag') === false) { //show the nag to activate an API key add_site_option('itsec_api_nag', true, false); } } //IPv6 support was added in 4039 if ($itsec_old_version < 4039 && !$tables_updated) { ITSEC_Lib::create_database_tables(); $tables_updated = true; } if ($itsec_old_version < 4040) { $options = get_site_option('itsec_global'); if ($options['log_info']) { $new_log_info = substr(sanitize_title(get_bloginfo('name')), 0, 20) . '-' . wp_generate_password(30, false); $old_file = path_join($options['log_location'], 'event-log-' . $options['log_info'] . '.log'); $new_file = path_join($options['log_location'], 'event-log-' . $new_log_info . '.log'); // If the file exists already, don't update the location unless we successfully move it. if (file_exists($old_file) && rename($old_file, $new_file)) { $options['log_info'] = $new_log_info; } } // Make sure we have an index files to block directory listing in logs directory if (is_dir($options['log_location']) && !file_exists(path_join($options['log_location'], 'index.php'))) { file_put_contents(path_join($options['log_location'], 'index.php'), "<?php\n// Silence is golden."); } $backup_options = get_site_option('itsec_backup'); // Make sure we have an index files to block directory listing in backups directory if (is_dir($backup_options['location']) && !file_exists(path_join($backup_options['location'], 'index.php'))) { file_put_contents(path_join($backup_options['location'], 'index.php'), "<?php\n// Silence is golden."); } update_site_option('itsec_global', $options); } $itsec_modules = ITSEC_Modules::get_instance(); $itsec_modules->run_upgrade($itsec_old_version, ITSEC_Core::get_plugin_build()); }
<li><?php _e('Content Directory', 'better-wp-security'); ?> : <strong><?php echo WP_CONTENT_DIR; ?> </strong></li> </ul> </li> <li> <h4><?php echo $itsec_globals['plugin_name'] . __(' variables', 'better-wp-security'); ?> </h4> <ul> <li><?php _e('Build Version', 'better-wp-security'); ?> : <strong><?php echo ITSEC_Core::get_plugin_build(); ?> </strong><br/> <em><?php _e('Note: this is NOT the same as the version number on the plugin page or WordPress.org page and is instead used for support.', 'better-wp-security'); ?> </em> </li> </ul> </li> </ul>