VaultPress::upgrade PHP Method

upgrade() public method

public upgrade ( )
    function upgrade()
    {
        $current_db_version = $this->get_option('db_version');
        if ($current_db_version < 1) {
            $this->options['connection'] = get_option('vaultpress_connection');
            $this->options['key'] = get_option('vaultpress_key');
            $this->options['secret'] = get_option('vaultpress_secret');
            $this->options['service_ips'] = get_option('vaultpress_service_ips');
            // remove old options
            $old_options = array('vaultpress_connection', 'vaultpress_hostname', 'vaultpress_key', 'vaultpress_secret', 'vaultpress_service_ips', 'vaultpress_timeout', 'vp_allow_remote_execution', 'vp_debug_request_signing', 'vp_disable_firewall');
            foreach ($old_options as $option) {
                delete_option($option);
            }
            $this->options['db_version'] = $this->db_version;
            $this->update_options();
        }
        if ($current_db_version < 2) {
            $this->delete_option('timeout');
            $this->delete_option('disable_firewall');
            $this->update_option('db_version', $this->db_version);
            $this->clear_connection();
        }
        if ($current_db_version < 3) {
            $this->update_firewall();
            $this->update_option('db_version', $this->db_version);
            $this->clear_connection();
        }
        if ($current_db_version < 4) {
            $this->update_firewall();
            $this->update_option('db_version', $this->db_version);
            $this->clear_connection();
        }
    }
VaultPress