//! Backups and restore (docs/server.md, section 7). A backup is one zip in `backups/`: the world folder and //! the server's settings and lists. On a running server the game first saves everything and stops writing //! (`save-off`, `save-all`), and writes again once the zip is done (`save-on`), so players stay online. //! A restore puts the backup's world in place of the current one, which is moved aside, never deleted. use crate::config::Config; use std::{ fs::File, io::{BufWriter, Write}, path::{Path, PathBuf}, time::SystemTime, }; use zip::{CompressionMethod, ZipArchive, ZipWriter, write::SimpleFileOptions}; pub const DIR: &str = "backups"; /// The settings and lists a backup holds beside the world. const FILES: [&str; 6] = [ "server.toml", "server.properties", "ops.json", "whitelist.json", "banned-players.json", "banned-ips.json", ]; /// Automatic backups are named `