summaryrefslogtreecommitdiff
path: root/modules/database/db_flatfile.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2014-06-23 09:45:15 -0400
committerAdam <Adam@anope.org>2014-06-23 09:45:15 -0400
commitfd9bb0ea7e3c8a39f1632c2ebbdc25d0fac192a0 (patch)
tree1d68e86065e0b012aee41533d4f9b289ee0707ac /modules/database/db_flatfile.cpp
parent148b26f687ce85dc01e852a2358b03d493757ada (diff)
parent9a947fa4359c667be58ebae4634d9ac0e53d5db4 (diff)
Merge branch '2.0' into 2.1
Conflicts: cmake/Anope.cmake cmake/FindGettext.cmake include/access.h include/messages.h include/modes.h include/modules.h include/users.h modules/CMakeLists.txt modules/commands/bs_bot.cpp modules/commands/cs_access.cpp modules/commands/cs_ban.cpp modules/commands/cs_clone.cpp modules/commands/cs_flags.cpp modules/commands/cs_info.cpp modules/commands/cs_list.cpp modules/commands/cs_log.cpp modules/commands/cs_mode.cpp modules/commands/cs_status.cpp modules/commands/cs_suspend.cpp modules/commands/cs_updown.cpp modules/commands/cs_xop.cpp modules/commands/ms_check.cpp modules/commands/ns_access.cpp modules/commands/ns_cert.cpp modules/commands/ns_group.cpp modules/commands/ns_register.cpp modules/commands/ns_set.cpp modules/commands/ns_suspend.cpp modules/commands/os_session.cpp modules/commands/os_svs.cpp modules/extra/m_ldap_authentication.cpp modules/extra/m_regex_pcre.cpp modules/extra/m_sql_authentication.cpp modules/extra/stats/m_chanstats.cpp modules/protocol/bahamut.cpp modules/protocol/hybrid.cpp modules/protocol/inspircd12.cpp modules/protocol/inspircd20.cpp modules/protocol/unreal.cpp modules/pseudoclients/chanserv.cpp modules/pseudoclients/chanserv/channel.cpp modules/pseudoclients/nickserv/nickserv.cpp modules/webcpanel/pages/chanserv/access.cpp src/access.cpp src/bots.cpp src/channels.cpp src/language.cpp src/modes.cpp src/modulemanager.cpp src/process.cpp src/users.cpp src/version.sh
Diffstat (limited to 'modules/database/db_flatfile.cpp')
-rw-r--r--modules/database/db_flatfile.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/modules/database/db_flatfile.cpp b/modules/database/db_flatfile.cpp
index 266b79379..a2226a0ef 100644
--- a/modules/database/db_flatfile.cpp
+++ b/modules/database/db_flatfile.cpp
@@ -128,7 +128,7 @@ class DBFlatFile : public Module, public Pipe
const std::vector<Anope::string> &type_order = Serialize::Type::GetTypeOrder();
std::set<Anope::string> dbs;
- dbs.insert(Config->GetModule(this)->Get<const Anope::string>("database"));
+ dbs.insert(Config->GetModule(this)->Get<const Anope::string>("database", "anope.db"));
for (unsigned i = 0; i < type_order.size(); ++i)
{
@@ -151,10 +151,14 @@ class DBFlatFile : public Module, public Pipe
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 << "!";
+ Anope::string err = Anope::LastError();
+ Log(this) << "Unable to back up database " << *it << " (" << err << ")!";
if (!Config->GetModule(this)->Get<bool>("nobackupok"))
+ {
Anope::Quitting = true;
+ Anope::QuitReason = "Unable to back up database " + *it + " (" + err + ")";
+ }
continue;
}
@@ -350,7 +354,7 @@ class DBFlatFile : public Module, public Pipe
for (std::map<Module *, std::fstream *>::iterator it = databases.begin(), it_end = databases.end(); it != it_end; ++it)
{
std::fstream *f = it->second;
- const Anope::string &db_name = Anope::DataDir + "/" + (it->first ? (it->first->name + ".db") : Config->GetModule(this)->Get<const Anope::string>("database"));
+ const Anope::string &db_name = Anope::DataDir + "/" + (it->first ? (it->first->name + ".db") : Config->GetModule(this)->Get<const Anope::string>("database", "anope.db"));
if (!f->is_open() || !f->good())
{