class Config

Configuration class

Properties

string $default_source
array $default
array $base_settings
array $settings
string $source
int $source_mtime
$default_source_mtime
$set_mtime
boolean $error_config_file
boolean $error_config_default_file
array $default_server
boolean $done

Methods

__construct(string|null $source = null)

constructor

void
checkSystem()

sets system and application settings

void
checkOutputCompression()

whether to use gzip output compression or not

void
checkClient()

Determines platform (OS), browser and version of the user Based on a phpBuilder article:

void
checkGd2()

Whether GD2 is present

void
checkWebServer()

Whether the Web server php is running on is IIS

void
checkWebServerOs()

Whether the os php is running on is windows or not

bool
isGitRevision(string $git_location = null)

detects if Git revision

void
checkGitRevision()

detects Git revision, if running inside repo

bool
loadDefaults()

loads default values from default source

bool
load(string|null $source = null)

loads configuration from $source, usually the config file should be called on object creation

void
loadUserPreferences()

Loads user preferences and merges them with current config must be called after control connection has been established

true|Message
setUserValue(string|null $cookie_name, string $cfg_path, mixed $new_cfg_value, mixed $default_value = null)

Sets config value which is stored in user preferences (if available) or in a cookie.

mixed
getUserValue(string $cookie_name, mixed $cfg_value)

Reads value stored by {@link setUserValue()}

void
setSource(string $source)

set source

bool
checkConfigSource()

check config source

void
checkPermissions()

verifies the permissions on config file (if asked by configuration) (must be called after config.inc.php has been merged)

void
checkErrors()

Checks for errors (must be called after config.inc.php has been merged)

mixed
get(string $setting)

returns specific config setting

void
set(string $setting, mixed $value)

sets configuration variable

string
getSource()

returns source for current config

int
getThemeUniqueValue()

returns a unique value to force a CSS reload if either the config or the theme changes

void
checkUpload()

checks if upload is enabled

void
checkUploadSize()

Maximum upload size as limited by PHP Used with permission from Moodle (https://moodle.org/) by Martin Dougiamas

bool
isHttps()

Checks if protocol is https

string
getRootPath()

Get phpMyAdmin root path

void
enableBc()

enables backward compatibility

bool
removeCookie(string $cookie)

removes cookie

bool
setCookie(string $cookie, mixed $value, string|null $default = null, int|null $validity = null, bool $httponly = true)

sets cookie if value is different from current cookie value, or removes if value is equal to default

static void
fatalErrorHandler()

Error handler to catch fatal errors when loading configuration file

static string
renderFooter()

Renders user configured footer

static string
renderHeader()

Renders user configured footer

string|null
getTempDir(string $name)

Returns temporary dir path

string|null
getUploadTempDir()

Returns temporary directory

int
selectServer()

Selects server based on request parameters.

void
checkServers()

Checks whether Servers configuration is valid and possibly apply fixups.

Details

at line 93
__construct(string|null $source = null)

constructor

Parameters

string|null $source source to read config from

at line 112
void checkSystem()

sets system and application settings

Return Value

void

at line 135
void checkOutputCompression()

whether to use gzip output compression or not

Return Value

void

at line 181
void checkClient()

Determines platform (OS), browser and version of the user Based on a phpBuilder article:

Return Value

void

See also

at line 288
void checkGd2()

Whether GD2 is present

Return Value

void

at line 322
void checkWebServer()

Whether the Web server php is running on is IIS

Return Value

void

at line 341
void checkWebServerOs()

Whether the os php is running on is windows or not

Return Value

void

at line 362
bool isGitRevision(string $git_location = null)

detects if Git revision

Parameters

string $git_location &$git_location (optional) verified git directory

Return Value

bool

at line 420
void checkGitRevision()

detects Git revision, if running inside repo

Return Value

void

at line 750
bool loadDefaults()

loads default values from default source

Return Value

bool success

at line 791
bool load(string|null $source = null)

loads configuration from $source, usually the config file should be called on object creation

Parameters

string|null $source config file

Return Value

bool

at line 899
void loadUserPreferences()

Loads user preferences and merges them with current config must be called after control connection has been established

Return Value

void

at line 1019
true|Message setUserValue(string|null $cookie_name, string $cfg_path, mixed $new_cfg_value, mixed $default_value = null)

Sets config value which is stored in user preferences (if available) or in a cookie.

If user preferences are not yet initialized, option is applied to global config and added to a update queue, which is processed by {@link loadUserPreferences()}

Parameters

string|null $cookie_name can be null
string $cfg_path configuration path
mixed $new_cfg_value new value
mixed $default_value default value

Return Value

true|Message

at line 1055
mixed getUserValue(string $cookie_name, mixed $cfg_value)

Reads value stored by {@link setUserValue()}

Parameters

string $cookie_name cookie name
mixed $cfg_value config value

Return Value

mixed

at line 1078
void setSource(string $source)

set source

Parameters

string $source source

Return Value

void

at line 1088
bool checkConfigSource()

check config source

Return Value

bool whether source is valid or not

at line 1133
void checkPermissions()

verifies the permissions on config file (if asked by configuration) (must be called after config.inc.php has been merged)

Return Value

void

at line 1160
void checkErrors()

Checks for errors (must be called after config.inc.php has been merged)

Return Value

void

at line 1191
mixed get(string $setting)

returns specific config setting

Parameters

string $setting config setting

Return Value

mixed value

at line 1207
void set(string $setting, mixed $value)

sets configuration variable

Parameters

string $setting configuration option
mixed $value new value for configuration option

Return Value

void

at line 1222
string getSource()

returns source for current config

Return Value

string config source

at line 1234
int getThemeUniqueValue()

returns a unique value to force a CSS reload if either the config or the theme changes

Return Value

int Summary of unix timestamps, to be unique on theme parameters change

at line 1250
void checkUpload()

checks if upload is enabled

Return Value

void

at line 1273
void checkUploadSize()

Maximum upload size as limited by PHP Used with permission from Moodle (https://moodle.org/) by Martin Dougiamas

this section generates $max_upload_size in bytes

Return Value

void

at line 1296
bool isHttps()

Checks if protocol is https

This function checks if the https protocol on the active connection.

Return Value

bool

at line 1334
string getRootPath()

Get phpMyAdmin root path

Return Value

string

at line 1381
void enableBc()

enables backward compatibility

Return Value

void

at line 1416
bool removeCookie(string $cookie)

removes cookie

Parameters

string $cookie name of cookie to remove

Return Value

bool result of setcookie()

at line 1446
bool setCookie(string $cookie, mixed $value, string|null $default = null, int|null $validity = null, bool $httponly = true)

sets cookie if value is different from current cookie value, or removes if value is equal to default

Parameters

string $cookie name of cookie to remove
mixed $value new cookie value
string|null $default default value
int|null $validity validity of cookie in seconds (default is one month)
bool $httponly whether cookie is only for HTTP (and not for scripts)

Return Value

bool result of setcookie()

at line 1506
static void fatalErrorHandler()

Error handler to catch fatal errors when loading configuration file

Return Value

void

at line 1556
static string renderFooter()

Renders user configured footer

Return Value

string

at line 1566
static string renderHeader()

Renders user configured footer

Return Value

string

at line 1578
string|null getTempDir(string $name)

Returns temporary dir path

Parameters

string $name Directory name

Return Value

string|null

at line 1608
string|null getUploadTempDir()

Returns temporary directory

Return Value

string|null

at line 1632
int selectServer()

Selects server based on request parameters.

Return Value

int

at line 1688
void checkServers()

Checks whether Servers configuration is valid and possibly apply fixups.

Return Value

void