3 $cfgfile = __DIR__ . '/config.php';
4 if (!file_exists($cfgfile)) {
5 echo "Copy config.php.dist to config.php and adjust it\n";
10 if (!function_exists('rrd_lastupdate')) {
11 echo "rrd PHP extension is missing\n";
15 if (!is_array($filetemplate)) {
16 $filetemplate = array_combine(
18 array_fill(0, count($names), $filetemplate)
23 foreach ($names as $id => $name) {
24 $data[$id]['name'] = $name;
25 foreach (array('humidity', 'temperature') as $item) {
28 array('{item}', '{id}'),
34 throw new Exception(rrd_error());
37 $data[$id][$item] = reset($lu['data']);
41 foreach (glob(__DIR__ . '/templates/*.php') as $tplfile) {
42 $outfile = $outdir . basename($tplfile, '.php');
45 $content = ob_get_contents();
47 file_put_contents($outfile, $content);