aboutsummaryrefslogtreecommitdiffstats
path: root/util/service_class
blob: e762d8ad680acf045c7b6fecdaafe0a53a17382c (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
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env php
<?php

// Temporary service class utility - see baseurl/help/service_classes

require_once('include/cli_startup.php');

cli_startup();

if($argc > 3) {
	$d = get_config('service_class', $argv[1]);
	$d[$argv[2]] = $argv[3];
	set_config('service_class', $argv[1], $d);
	echo 'Updated service class "' . $argv[1] . '" service "' . $argv[2] . '" to ' . $argv[3] . "\n";
}

if($argc == 2) {
	$d = get_config('service_class', $argv[1]);
	echo $argv[1] . ":\n";
	foreach($d as $k => $v) {
		echo "$k = $v\n";
	}
}

if($argc == 1) {
	load_config('service_class');
	foreach($a->config['service_class'] as $class=>$props) {
		echo "$class:\n";
		$d = unserialize($props);
		foreach($d as $k => $v) {
			echo "\t$k = $v\n";
		}
	}
}