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

$foofoo = function($machineUuid) {
	$res = Database::queryFirst('SELECT module, modeid, modedata FROM runmode WHERE machineuuid = :uuid',
		array('uuid' => $machineUuid));
	if ($res === false)
		return;
	$config = RunMode::getModuleConfig($res['module']);
	if ($config === false)
		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, $machineUuid, $res['modeid'], $res['modedata']);
	}
	if ($config->systemdDefaultTarget !== false) {
		ConfigHolder::add('SLX_SYSTEMD_TARGET', $config->systemdDefaultTarget, 10000);
	}
	ConfigHolder::add('SLX_RUNMODE_MODULE', $res['module']);
};

$foofoo($uuid);