aboutsummaryrefslogtreecommitdiffstats
path: root/src/Main.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-17 20:57:56 +0100
committerMax Kellermann <max@duempel.org>2014-02-19 23:24:17 +0100
commit150443b014e3df20d9fcac0de88ff32574e4c471 (patch)
tree188ed2e936b6727f0c432ccb8d24871f125bb0cd /src/Main.cxx
parent9e36af791615eb8adcaee956808421271cb1ddff (diff)
downloadmpd-150443b014e3df20d9fcac0de88ff32574e4c471.tar.gz
mpd-150443b014e3df20d9fcac0de88ff32574e4c471.tar.xz
mpd-150443b014e3df20d9fcac0de88ff32574e4c471.zip
DatabasePlugin: add FLAG_REQUIRE_STORAGE
Ignore the storage configuration if FLAG_REQUIRE_STORAGE is not set in the DatabasePlugin.
Diffstat (limited to 'src/Main.cxx')
-rw-r--r--src/Main.cxx26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/Main.cxx b/src/Main.cxx
index 8fe90fc6f..368f54caa 100644
--- a/src/Main.cxx
+++ b/src/Main.cxx
@@ -67,6 +67,7 @@
#ifdef ENABLE_DATABASE
#include "db/update/Service.hxx"
#include "db/Configured.hxx"
+#include "db/DatabasePlugin.hxx"
#include "db/plugins/SimpleDatabasePlugin.hxx"
#include "storage/Configured.hxx"
#include "storage/CompositeStorage.hxx"
@@ -177,16 +178,23 @@ glue_db_init_and_load(void)
return true;
}
- if (!InitStorage(error))
- FatalError(error);
+ if (instance->database->GetPlugin().flags & DatabasePlugin::FLAG_REQUIRE_STORAGE) {
+ if (!InitStorage(error))
+ FatalError(error);
- if (instance->storage == nullptr) {
- delete instance->database;
- instance->database = nullptr;
- LogDefault(config_domain,
- "Found database setting without "
- "music_directory - disabling database");
- return true;
+ if (instance->storage == nullptr) {
+ delete instance->database;
+ instance->database = nullptr;
+ LogDefault(config_domain,
+ "Found database setting without "
+ "music_directory - disabling database");
+ return true;
+ }
+ } else {
+ if (IsStorageConfigured())
+ LogDefault(config_domain,
+ "Ignoring the storage configuration "
+ "because the database does not need it");
}
if (!instance->database->Open(error))