mirror of
https://github.com/znc/znc.git
synced 2026-08-06 08:52:57 +02:00
Only save a single backup of the znc config file
The ~/.znc/configs/backups/ directory quickly got quite big, so we don't do that but instead only save on backup as ~/.znc/configs/znc.conf-backup git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@975 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -412,7 +412,6 @@ void CZNC::InitDirs(const CString& sArgvPath, const CString& sDataDir) {
|
||||
|
||||
// Other dirs that we use
|
||||
m_sConfPath = m_sZNCPath + "/configs";
|
||||
m_sConfBackupPath = m_sConfPath + "/backups";
|
||||
m_sModPath = m_sZNCPath + "/modules";
|
||||
m_sUserPath = m_sZNCPath + "/users";
|
||||
}
|
||||
@@ -436,10 +435,25 @@ CString CZNC::ExpandConfigPath(const CString& sConfigFile) {
|
||||
return sRetPath;
|
||||
}
|
||||
|
||||
bool CZNC::WriteConfig() {
|
||||
CFile File(m_sConfigFile);
|
||||
bool CZNC::BackupConfig() const {
|
||||
CString sBackup = GetConfigFile() + "-backup";
|
||||
|
||||
if (!File.Copy(GetConfBackupPath() + "/" + File.GetShortName() + "-" + CString(time(NULL)))) {
|
||||
// Create a new backup overwriting an old one we might have
|
||||
if (CFile::Copy(m_sConfigFile, sBackup, true))
|
||||
return true;
|
||||
|
||||
// Don't abort if no config file exists
|
||||
if (!CFile::Exists(m_sConfigFile))
|
||||
// No backup because we got nothing to backup
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CZNC::WriteConfig() {
|
||||
CFile File(GetConfigFile());
|
||||
|
||||
if (!BackupConfig()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user