summaryrefslogtreecommitdiffstats
path: root/modules-available/runmode/baseconfig/getconfig.inc.php
blob: a5de10538a9553f6b52afeb1f2c6c876ffe92e21 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

/** @var ?string $uuid */
/** @var ?string $ip */

if ($uuid !== null) {
	$res = Database::queryFirst('SELECT module, modeid, modedata FROM runmode WHERE machineuuid = :uuid',
		array('uuid' => $uuid));
	if ($res === false)
		return;
	$config = RunMode::getModuleConfig($res['module']);
	if ($config === null)
		return;
	if (!Module::isAvailable($res['module']))
		return; // Not really possible because getModuleConfig would have failed but we should make sure
	if ($config->configHook !== false) {
		call_user_func($config->configHook, $uuid, $res['modeid'], $res['modedata']);
	}
	if ($config->systemdDefaultTarget !== false) {
		ConfigHolder::add('SLX_SYSTEMD_TARGET', $config->systemdDefaultTarget, 10000);
	}
	ConfigHolder::add('SLX_RUNMODE_MODULE', $res['module']);
}