FOSSology
4.4.0
Open Source License Compliance by Open Source Software
|
System configuration functions. More...
Go to the source code of this file.
Functions | |
ConfigInit ($sysconfdir, &$SysConf, $exitOnDbFail=true) | |
Initialize the fossology system after bootstrap(). More... | |
get_pg_conn ($sysconfdir, &$SysConf, $exitOnDbFail=true) | |
populate_from_sysconfig ($conn, &$SysConf) | |
Populate_sysconfig () | |
Populate the sysconfig table with core variables. | |
check_boolean ($value) | |
Validation function check_boolean(). More... | |
check_fossology_url ($url) | |
Validation function check_fossology_url(). More... | |
check_logo_url ($url) | |
Validation function check_logo_url(). More... | |
check_logo_image_url ($url) | |
Validation function check_logo_image_url(). More... | |
check_email_address ($email_address) | |
Validation function check_email_address(). More... | |
is_available ($url, $timeout=2, $tries=2) | |
Check if the URL is available. More... | |
check_url ($url) | |
Check if the url is valid. More... | |
check_IP ($ip) | |
Check if the ip address is valid. More... | |
set_python_path () | |
get_system_load_average () | |
Get system load average. More... | |
Variables | |
const | CONFIG_TYPE_INT 1 |
const | CONFIG_TYPE_TEXT 2 |
const | CONFIG_TYPE_TEXTAREA 3 |
const | CONFIG_TYPE_PASSWORD 4 |
const | CONFIG_TYPE_DROP 5 |
const | CONFIG_TYPE_BOOL 6 |
System configuration functions.
Definition in file common-sysconfig.php.
check_boolean | ( | $value | ) |
Validation function check_boolean().
Check if the value format is valid, only true/false is valid
string | $value | The value which will be checked |
Definition at line 624 of file common-sysconfig.php.
check_email_address | ( | $email_address | ) |
Validation function check_email_address().
Check if the email address is valid.
string | $email_address | The email address which will be checked |
Definition at line 728 of file common-sysconfig.php.
check_fossology_url | ( | $url | ) |
Validation function check_fossology_url().
Check if the URL is valid.
string | $url | The URL which will be checked |
Definition at line 642 of file common-sysconfig.php.
check_IP | ( | $ip | ) |
Check if the ip address is valid.
string | $ip | IP address |
Definition at line 790 of file common-sysconfig.php.
check_logo_image_url | ( | $url | ) |
Validation function check_logo_image_url().
Check if the URL is available.
string | $url | The url which will be checked |
Definition at line 701 of file common-sysconfig.php.
check_logo_url | ( | $url | ) |
Validation function check_logo_url().
Check if the URL is available.
string | $url | The URL which will be checked |
Definition at line 678 of file common-sysconfig.php.
check_url | ( | $url | ) |
Check if the url is valid.
string | $url | The url which will be checked |
Definition at line 774 of file common-sysconfig.php.
ConfigInit | ( | $sysconfdir, | |
& | $SysConf, | ||
$exitOnDbFail = true |
|||
) |
Initialize the fossology system after bootstrap().
This function also opens a database connection (global PG_CONN).
System configuration variables are in four places:
VERSION and fossology.conf variables are organized by group. For example,
But the sysconfig table and Db.conf are not. So all the table values will be put in a made up "SYSCONFIG" group. And all the Db.conf values will be put in a "DBCONF" group.
string | $sysconfdir | Path to SYSCONFDIR | |
[out] | array | &$SysConf | Configuration variable array (updated by this function) |
boolean | $exitOnDbFail | Do an exit() if can't connect to DB? |
The first array dimension of $SysConf is the group, the second is the variable name. For example:
Definition at line 65 of file common-sysconfig.php.
get_pg_conn | ( | $sysconfdir, | |
& | $SysConf, | ||
$exitOnDbFail = true |
|||
) |
Parse the VERSION file and Db.conf and initialize respective keys in SysConf
The function also opens the connection to Postgres DB and return the object.
string | $sysconfdir | Path to SYSCONFDIR | |
[in,out] | array | $SysConf | Configuration variable array |
boolean | $exitOnDbFail | Do an exit() if can't connect to DB? |
Definition at line 85 of file common-sysconfig.php.
get_system_load_average | ( | ) |
Get system load average.
Get no of cores using nproc command. Get load using sys_getloadavg
Definition at line 815 of file common-sysconfig.php.
is_available | ( | $url, | |
$timeout = 2 , |
|||
$tries = 2 |
|||
) |
Check if the URL is available.
string | $url | URL |
int | $timeout | Timeout interval, default 2 seconds |
int | $tries | If unavailable, will try several times, default 2 times |
Definition at line 742 of file common-sysconfig.php.
populate_from_sysconfig | ( | $conn, | |
& | $SysConf | ||
) |
Populate SysConf array with sysconfig DB table.
resource | $conn | Connection to Postgres | |
[in,out] | array | $SysConf | Configuration variable array |
Definition at line 139 of file common-sysconfig.php.
set_python_path | ( | ) |
Set PYTHONPATH to appropriate location
Definition at line 800 of file common-sysconfig.php.
const CONFIG_TYPE_BOOL 6 |
Checkbox type config
Definition at line 27 of file common-sysconfig.php.
const CONFIG_TYPE_DROP 5 |
Dropdown type config
Definition at line 25 of file common-sysconfig.php.
const CONFIG_TYPE_INT 1 |
Integer type config
Definition at line 17 of file common-sysconfig.php.
const CONFIG_TYPE_PASSWORD 4 |
Password type config
Definition at line 23 of file common-sysconfig.php.
const CONFIG_TYPE_TEXT 2 |
Text type config
Definition at line 19 of file common-sysconfig.php.
const CONFIG_TYPE_TEXTAREA 3 |
Textarea type config
Definition at line 21 of file common-sysconfig.php.