Changeset

9556:e4c09e335bd9

moduleapi: Prevent loading disabled module as dependency of enabled one Explicitly disabled module should stay disabled.
author Kim Alvefur <zash@zash.se>
date Thu, 25 Oct 2018 17:11:10 +0200
parents 9555:ed5a5ddcef17
children 9557:d7fdd418adf8
files core/moduleapi.lua
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/core/moduleapi.lua	Thu Oct 25 21:59:17 2018 +0200
+++ b/core/moduleapi.lua	Thu Oct 25 17:11:10 2018 +0200
@@ -129,6 +129,9 @@
 
 function api:depends(name)
 	local modulemanager = require"core.modulemanager";
+	if self:get_option_inherited_set("modules_disabled", {}):contains(name) then
+		error("Dependency on disabled module mod_"..name);
+	end
 	if not self.dependencies then
 		self.dependencies = {};
 		self:hook("module-reloaded", function (event)
@@ -145,9 +148,6 @@
 			end
 		end);
 	end
-	if self:get_option_inherited_set("modules_disabled", {}):contains(name) then
-		self:log("warn", "Loading prerequisite mod_%s despite it being disabled", name);
-	end
 	local mod = modulemanager.get_module(self.host, name) or modulemanager.get_module("*", name);
 	if mod and mod.module.host == "*" and self.host ~= "*"
 	and modulemanager.module_has_method(mod, "add_host") then