diff options
author | DukePyrolator <DukePyrolator@anope.org> | 2013-05-20 06:42:38 +0200 |
---|---|---|
committer | DukePyrolator <DukePyrolator@anope.org> | 2013-05-20 06:42:38 +0200 |
commit | d82391e46d6e9065a73a710e76e7e46cfccd5f4f (patch) | |
tree | 251d2c6671d02554b2ab562c8669080e6fa1a638 | |
parent | 7aa02864d21d75088149abd7b349ac2074471151 (diff) |
made our database backup filenames more readable
-rw-r--r-- | data/example.conf | 10 | ||||
-rw-r--r-- | modules/database/db_flatfile.cpp | 4 | ||||
-rw-r--r-- | modules/database/db_plain.cpp | 4 |
3 files changed, 13 insertions, 5 deletions
diff --git a/data/example.conf b/data/example.conf index 7b5beebd9..baa569ed2 100644 --- a/data/example.conf +++ b/data/example.conf @@ -1085,7 +1085,15 @@ mail * target database to something else. Start Anope then shut down so the new database will be written. * Then unload this and restart Anope, loading from the new database. */ -#module { name = "db_plain" } +#module +{ + name = "db_plain" + + /* + * The database name db_plain should use + */ + database = "anope.db" +} /* * [RECOMMENDED] db_flatfile diff --git a/modules/database/db_flatfile.cpp b/modules/database/db_flatfile.cpp index f7cc3df59..19f263e98 100644 --- a/modules/database/db_flatfile.cpp +++ b/modules/database/db_flatfile.cpp @@ -133,13 +133,13 @@ class DBFlatFile : public Module, public Pipe for (std::set<Anope::string>::const_iterator it = dbs.begin(), it_end = dbs.end(); it != it_end; ++it) { const Anope::string &oldname = Anope::DataDir + "/" + *it; - Anope::string newname = Anope::DataDir + "/backups/" + *it + "." + stringify(tm->tm_year) + "." + stringify(tm->tm_mon) + "." + stringify(tm->tm_mday); + Anope::string newname = Anope::DataDir + "/backups/" + *it + "-" + stringify(tm->tm_year + 1900) + Anope::printf("-%02i-", tm->tm_mon + 1) + Anope::printf("%02i", tm->tm_mday); /* Backup already exists or no database to backup */ if (Anope::IsFile(newname) || !Anope::IsFile(oldname)) continue; - Log(LOG_DEBUG) << "db_flatfile: Attemping to rename " << *it << " to " << newname; + Log(LOG_DEBUG) << "db_flatfile: Attempting to rename " << *it << " to " << newname; if (rename(oldname.c_str(), newname.c_str())) { Log(this) << "Unable to back up database " << *it << "!"; diff --git a/modules/database/db_plain.cpp b/modules/database/db_plain.cpp index 809fcc2e5..fe95e06bb 100644 --- a/modules/database/db_plain.cpp +++ b/modules/database/db_plain.cpp @@ -607,13 +607,13 @@ class DBPlain : public Module if (tm->tm_mday != LastDay) { LastDay = tm->tm_mday; - Anope::string newname = BackupFile + "." + stringify(tm->tm_year) + stringify(tm->tm_mon) + stringify(tm->tm_mday); + Anope::string newname = BackupFile + "-" + stringify(tm->tm_year + 1900) + Anope::printf("-%02i-", tm->tm_mon + 1) + Anope::printf("%02i", tm->tm_mday); /* Backup already exists */ if (IsFile(newname)) return; - Log(LOG_DEBUG) << "db_plain: Attemping to rename " << DatabaseFile << " to " << newname; + Log(LOG_DEBUG) << "db_plain: Attempting to rename " << DatabaseFile << " to " << newname; if (rename(DatabaseFile.c_str(), newname.c_str())) { Log() << "Unable to back up database!"; |