From 78320ee3a611b414dfd685bf36dfb0553bb2f1e3 Mon Sep 17 00:00:00 2001 From: Treer Date: Mon, 25 Apr 2016 19:00:10 +1000 Subject: add commandline help to util/config --- util/config | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/util/config b/util/config index 9e90eca56..5113bd8ec 100755 --- a/util/config +++ b/util/config @@ -7,9 +7,45 @@ require_once('include/cli_startup.php'); cli_startup(); -if($argc > 3) { - +$helpArgs = getopt('h', array('help')); +if (count($helpArgs) === 1) { + echo <<<'EndOfOutput' +Gets, sets, or lists site-wide configuration settings. + +Usage: util/config + util/config + util/config + util/config + + util/config + Displays all config entries + + util/config + Displays all config entries for family (system, database, etc) + + util/config + Displays single config entry for the specified family and key + + util/config + Set config entry for specified family and key to value and display result + +Notes: + Setting config entries which are manually set in .htconfig.php may result + in conflict between database settings and the manual startup settings. + + For channel-specific configuration settings, use util/pconfig + + Details for configuration options can be found at: + +EndOfOutput; + echo ' ' . App::get_baseurl() . '/help/hidden_configs' . PHP_EOL . PHP_EOL; + return; +} + + + +if($argc > 3) { set_config($argv[1],$argv[2],$argv[3]); echo "config[{$argv[1]}][{$argv[2]}] = " . printable_config(get_config($argv[1],$argv[2])) . "\n"; } -- cgit v1.2.3 From 02ee7f17e8b634a9d0e195cce212d838eaaefe9f Mon Sep 17 00:00:00 2001 From: Treer Date: Mon, 25 Apr 2016 19:30:37 +1000 Subject: add commandline help to util/pconfig --- util/pconfig | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/util/pconfig b/util/pconfig index 038fa74c3..802590f7a 100755 --- a/util/pconfig +++ b/util/pconfig @@ -8,6 +8,40 @@ require_once('include/zot.php'); cli_startup(); +$helpArgs = getopt('h', array('help')); +if (count($helpArgs) === 1) { + echo <<<'EndOfOutput' +Gets, sets, or lists personal (per channel) configuration settings. + +Usage: util/pconfig + util/pconfig + util/pconfig + util/pconfig + + util/pconfig + Displays all of the the channel's config entries + + util/pconfig + Displays all of the channel's config entries for the specified family + (system, database, etc) + + util/pconfig + Displays single config entry for the specified family and key + + util/pconfig + Set config entry for specified family and key to value and display result + +Notes: + For site-wide configuration settings, use util/config + + Details for configuration options can be found at: + +EndOfOutput; + echo ' ' . App::get_baseurl() . '/help/hidden_configs' . PHP_EOL . PHP_EOL; + return; +} + + if($argc > 4) { set_pconfig($argv[1],$argv[2],$argv[3],$argv[4]); build_sync_packet($argv[1]); -- cgit v1.2.3 From d67d8b6d6e95025525d11ce42892fb9bf40abf28 Mon Sep 17 00:00:00 2001 From: Treer Date: Mon, 25 Apr 2016 19:46:04 +1000 Subject: util/pconfig can list channel IDs --- util/pconfig | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/util/pconfig b/util/pconfig index 802590f7a..77fcd6d38 100755 --- a/util/pconfig +++ b/util/pconfig @@ -13,11 +13,15 @@ if (count($helpArgs) === 1) { echo <<<'EndOfOutput' Gets, sets, or lists personal (per channel) configuration settings. -Usage: util/pconfig +Usage: util/pconfig + util/pconfig util/pconfig util/pconfig util/pconfig + util/pconfig + List all channel IDs + util/pconfig Displays all of the the channel's config entries @@ -68,3 +72,11 @@ if($argc == 2) { } } +if($argc == 1) { + $r = q("select channel_id, channel_name from channel"); + if($r) { + foreach($r as $rr) { + echo sprintf('%4u %s', $rr['channel_id'], $rr['channel_name']) . PHP_EOL; + } + } +} -- cgit v1.2.3 From f336f38ad505df8cf85cbe7ae9ce3c1d363a1ded Mon Sep 17 00:00:00 2001 From: Treer Date: Mon, 25 Apr 2016 22:09:15 +1000 Subject: improve error message in config and pconfig --- util/config | 5 +++++ util/pconfig | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/util/config b/util/config index 5113bd8ec..d4bcd5da1 100755 --- a/util/config +++ b/util/config @@ -3,6 +3,11 @@ // Red config utility +if(!file_exists('include/cli_startup.php')) { + echo 'Run config from the top level Hubzilla web directory, as util/config ' . PHP_EOL; + exit(1); +} + require_once('include/cli_startup.php'); cli_startup(); diff --git a/util/pconfig b/util/pconfig index 77fcd6d38..1afba8306 100755 --- a/util/pconfig +++ b/util/pconfig @@ -3,6 +3,14 @@ // Red pconfig utility + +if(!file_exists('include/cli_startup.php')) { + echo 'Run pconfig from the top level Hubzilla web directory, as util/pconfig ' . PHP_EOL; + exit(1); +} + + + require_once('include/cli_startup.php'); require_once('include/zot.php'); -- cgit v1.2.3