command line config utility, get set system configuration values

This commit is contained in:
friendica 2013-01-14 14:25:34 -08:00
parent 3a5fea516a
commit 1259a6e753
2 changed files with 35 additions and 1 deletions

View File

@ -1264,7 +1264,7 @@ function profile_load(&$a, $nickname, $profile = 0) {
$r = null;
//TODO needs avatar_date !!
if($profile) {
$profile_int = intval($profile);

34
util/config Executable file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env php
<?php
// Red config utility
require_once('include/cli_startup.php');
cli_startup();
if($argc > 3) {
set_config($argv[1],$argv[2],$argv[3]);
echo "config[{$argv[1]}][{$argv[2]}] = " . get_config($argv[1],$argv[2]) . "\n";
}
if($argc == 3) {
echo "config[{$argv[1]}][{$argv[2]}] = " . get_config($argv[1],$argv[2]) . "\n";
}
if($argc == 2) {
load_config($argv[1]);
foreach($a->config[$argv[1]] as $k => $x) {
echo "config[{$argv[1]}][{$k}] = " . $x . "\n";
}
}
if($argc == 1) {
$r = q("select * from config where 1");
if($r) {
foreach($r as $rr) {
echo "config[{$rr['cat']}][{$rr['k']}] = " . $rr['v'] . "\n";
}
}
}