-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathforumDBsettings.bash
More file actions
executable file
·79 lines (58 loc) · 2.5 KB
/
forumDBsettings.bash
File metadata and controls
executable file
·79 lines (58 loc) · 2.5 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
set -e
function getConfIPB(){
# $1 - PHP File (conf_global.php) with full enought path.
# $2 - index in $INFO array. (Ex: sql_user)
# Fields are: sql_user, sql_host, sql_pass, sql_database
php -r "include_once('$1'); echo \$INFO['$2'];"
}
#getConfIPB $FROM_phpConf sql_user
function getConfVB(){
# $1 - PHP File (conf_global.php) with full enought path.
# $2 - index in $INFO array. (Ex: sql_user)
# Fields are: servername, port, username, password, usepconnect
local opt=$2
# This was written after getConf[IPB]. So, for compatability provide IPB0names translation
case $2 in
sql_user ) opt='username';;
sql_host ) opt='servername';;
sql_pass ) opt='password';;
sql_database ) php -r "include_once('$1'); echo \$config['Database']['dbname'];"; return 0;;
* ) echo "Выбран недопустимый ключ.";; # ПО-УМОЛЧАНИЮ
esac
php -r "include_once('$1'); echo \$config['MasterServer']['$opt'];"
}
#getConfIPB $FROM_phpConf sql_user
function getConfXcart(){
# $1 - PHP File (conf_global.php) with full enought path.
# $2 - index in $INFO array. (Ex: sql_user)
# Fields are: servername, port, username, password, usepconnect
local opt=$2
# This was written after getConf[IPB]. So, for compatability provide IPB0names translation
case $2 in
sql_pass ) opt='sql_password';;
sql_database ) opt='sql_db';;
* ) echo "Выбран недопустимый ключ.";; # ПО-УМОЛЧАНИЮ
esac
php -r "define('XCART_START', 1); error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING); include_once('$1'); echo \$$opt;"
}
#getConfXcart $FROM_phpConf sql_user
function getConfSugarCRM(){
# $1 - PHP File (conf_global.php) with full enought path.
# $2 - index in $INFO array. (Ex: sql_user)
# Fields are: servername, port, username, password, usepconnect
local opt=$2
# This was written after getConf[IPB]. So, for compatability provide IPB0names translation
case $2 in
sql_user ) opt='db_user_name';;
sql_host ) opt='db_host_name';;
sql_pass ) opt='db_password';;
sql_database ) opt='db_name';;
* ) echo "Выбран недопустимый ключ.";; # ПО-УМОЛЧАНИЮ
esac
php -r "include_once('$1'); echo \$sugar_config['dbconfig']['$opt'];"
}
#getConfSugarCRM $FROM_phpConf sql_user
#Common use:
# DBType=$DBType
#mysqldump --opt -q -u"$( getConf$DBType $FROM_phpConf sql_user )" -h"$( getConf$DBType $FROM_phpConf sql_host )" -p"$( getConf$DBType $FROM_phpConf sql_pass )" "$( getConf$DBType $FROM_phpConf sql_database )" > amurforumDB.dump.sql