config cli will also work with Friendica without change - so bringing it over

This commit is contained in:
friendica 2013-01-14 15:50:39 -08:00
parent 449b44fe4c
commit 66a6970bb8
4 changed files with 245 additions and 183 deletions

View file

@ -12,7 +12,7 @@ require_once('library/Mobile_Detect/Mobile_Detect.php');
require_once('include/features.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '3.1.1586' );
define ( 'FRIENDICA_VERSION', '3.1.1588' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1158 );

34
util/config Normal 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";
}
}
}

26
util/config.md Normal file
View file

@ -0,0 +1,26 @@
CLI config utility
==================
Usage:
config
displays all config entries
config family
displays all config entries for family (system, database, etc)
config family key
displays single config entry for specified family and key
config family key value
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.

File diff suppressed because it is too large Load diff