1
0
Fork 0

Merge pull request #3973 from tobiasd/20171127-utilconfig

config tool needed some touch up to work again
This commit is contained in:
Hypolite Petovan 2017-11-27 13:28:06 -05:00 committed by GitHub
commit f983712269
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,13 +1,38 @@
#!/usr/bin/env php
<?php
// Red config utility
/**
* @brief tool to access the system config from the CLI
*
* With this script you can access the system configuration of your node from
* the CLI. You can do both, reading current values stored in the database and
* set new values to config variables.
*
* Usage:
* If you specify no parameters at the CLI, the script will list all config
* variables defined.
*
* If you specify one parameter, the scipt will list all config variables
* defined in this section of the configuration (e.g. "system").
*
* If you specify two parameters, the scipt will show you the current value
* of the named configuration setting. (e.g. "system loglevel")
*
* If you specify three parameters, the named configuration setting will be
* set to the value of the last parameter. (e.g. "system loglevel 0" will
* disable logging)
**/
use Friendica\Core\Config;
require_once('include/cli_startup.php');
require_once 'boot.php';
require_once 'include/dba.php';
require_once 'include/text.php';
$a = get_app();
require_once '.htconfig.php';
cli_startup();
dba::connect($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
if($argc > 3) {
Config::set($argv[1],$argv[2],$argv[3]);
@ -19,10 +44,14 @@ if($argc == 3) {
}
if($argc == 2) {
load_config($argv[1]);
Config::load($argv[1]);
if (!is_null($a->config[$argv[1]])) {
foreach($a->config[$argv[1]] as $k => $x) {
echo "config[{$argv[1]}][{$k}] = " . $x . "\n";
}
} else {
echo "config section '$argv[1]' returned nothing.\n";
}
}
if($argc == 1) {