mirror of
https://github.com/anope/anope.git
synced 2026-06-12 19:14:47 +02:00
Require that users have a non-deprecated database module loaded.
This commit is contained in:
+2
-1
@@ -1248,9 +1248,10 @@ public:
|
||||
|
||||
/** Find the first module of a certain type
|
||||
* @param type The module type
|
||||
* @param ignore If non-nullptr then a module to ignore.
|
||||
* @return The module
|
||||
*/
|
||||
static Module *FindFirstOf(ModType type);
|
||||
static Module *FindFirstOf(ModType type, Module *ignore = nullptr);
|
||||
|
||||
/** Checks whether this version of Anope is at least major.minor.patch.build
|
||||
* Throws a ModuleException if not
|
||||
|
||||
@@ -80,6 +80,8 @@ public:
|
||||
DBFlatFile(const Anope::string &modname, const Anope::string &creator)
|
||||
: Module(modname, creator, DATABASE | DEPRECATED | VENDOR)
|
||||
{
|
||||
if (!ModuleManager::FindFirstOf(DATABASE, this))
|
||||
throw ModuleException("db_flatfile is deprecated and can only import old databases.");
|
||||
}
|
||||
|
||||
EventReturn OnLoadDatabase() override
|
||||
|
||||
+4
-2
@@ -552,8 +552,10 @@ bool Anope::Init(int ac, char **av)
|
||||
setuidgid();
|
||||
#endif
|
||||
|
||||
auto *encryption = ModuleManager::FindFirstOf(ENCRYPTION);
|
||||
if (!encryption)
|
||||
if (!ModuleManager::FindFirstOf(DATABASE))
|
||||
throw CoreException("You must load a non-deprecated database module!");
|
||||
|
||||
if (!ModuleManager::FindFirstOf(ENCRYPTION))
|
||||
throw CoreException("You must load a non-deprecated encryption module!");
|
||||
|
||||
if (!IRCD)
|
||||
|
||||
@@ -262,11 +262,11 @@ Module *ModuleManager::FindModule(const Anope::string &name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Module *ModuleManager::FindFirstOf(ModType type)
|
||||
Module *ModuleManager::FindFirstOf(ModType type, Module *ignore)
|
||||
{
|
||||
for (auto *m : Modules)
|
||||
{
|
||||
if (m->type & type)
|
||||
if (m->type & type && m != ignore)
|
||||
return m;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user