mirror of
https://github.com/anope/anope.git
synced 2026-06-30 20:26:39 +02:00
Don't backup the database and not rewrite a new one (oops?)
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2887 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
@@ -539,6 +539,13 @@ class DBPlain : public Module
|
||||
|
||||
void BackupDatabase()
|
||||
{
|
||||
/* Do not backup a database that doesn't exist */
|
||||
struct stat DBInfo;
|
||||
if (stat(DatabaseFile.c_str(), &DBInfo))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
tm *tm = localtime(&now);
|
||||
|
||||
@@ -887,6 +894,8 @@ class DBPlain : public Module
|
||||
|
||||
EventReturn OnSaveDatabase()
|
||||
{
|
||||
BackupDatabase();
|
||||
|
||||
db.open(DatabaseFile.c_str(), std::ios_base::out | std::ios_base::trunc);
|
||||
|
||||
if (!db.is_open())
|
||||
@@ -1172,8 +1181,6 @@ class DBPlain : public Module
|
||||
|
||||
db.close();
|
||||
|
||||
BackupDatabase();
|
||||
|
||||
return EVENT_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user