class ConfigFile

Config file management class.

Stores its data in $_SESSION

Methods

__construct(array|null $baseConfig = null)

Constructor

void
setPersistKeys(array $keys)

Sets names of config options which will be placed in config file even if they are set to their default values (use only full paths)

array
getPersistKeysMap()

Returns flipped array set by {@link setPersistKeys()}

void
setAllowedKeys(array|null $keys)

By default ConfigFile allows setting of all configuration keys, use this method to set up a filter on {@link set()} method

void
setCfgUpdateReadMapping(array $mapping)

Sets path mapping for updating config in {@link updateWithGlobalConfig()} or reading by {@link getConfig()} or {@link getConfigArray()}

void
resetConfigData()

Resets configuration data

void
setConfigData(array $cfg)

Sets configuration data (overrides old data)

void
set(string $path, mixed $value, string $canonicalPath = null)

Sets config value

array
getFlatDefaultConfig()

Returns default config in a flattened array

void
updateWithGlobalConfig(array $cfg)

Updates config with values read from given array (config will contain differences to defaults from config.defaults.php).

mixed
get(string $path, mixed $default = null)

Returns config value or $default if it's not set

mixed
getDefault(string $canonicalPath, mixed $default = null)

Returns default config value or $default it it's not set ie. it doesn't exist in config.default.php ($cfg) and config.values.php ($_cfg_db['_overrides'])

mixed
getValue(string $path, mixed $default = null)

Returns config value, if it's not set uses the default one; returns $default if the path isn't set and doesn't contain a default value

string
getCanonicalPath(string $path)

Returns canonical path

mixed
getDbEntry(string $path, mixed $default = null)

Returns config database entry for $path

int
getServerCount()

Returns server count

array|null
getServers()

Returns server list

string
getServerDSN(integer $server)

Returns DSN of given server

string
getServerName(int $id)

Returns server name

void
removeServer(int $server)

Removes server

array
getConfig()

Returns configuration array (full, multidimensional format)

array
getConfigArray()

Returns configuration array (flat format)

Details

at line 85
__construct(array|null $baseConfig = null)

Constructor

Parameters

array|null $baseConfig base configuration read from {@link PhpMyAdmin\Config::$base_config}, use only when not in PMA Setup

at line 117
void setPersistKeys(array $keys)

Sets names of config options which will be placed in config file even if they are set to their default values (use only full paths)

Parameters

array $keys the names of the config options

Return Value

void

at line 129
array getPersistKeysMap()

Returns flipped array set by {@link setPersistKeys()}

Return Value

array

at line 142
void setAllowedKeys(array|null $keys)

By default ConfigFile allows setting of all configuration keys, use this method to set up a filter on {@link set()} method

Parameters

array|null $keys array of allowed keys or null to remove filter

Return Value

void

at line 163
void setCfgUpdateReadMapping(array $mapping)

Sets path mapping for updating config in {@link updateWithGlobalConfig()} or reading by {@link getConfig()} or {@link getConfigArray()}

Parameters

array $mapping Contains the mapping of "Server/config options" to "Server/1/config options"

Return Value

void

at line 173
void resetConfigData()

Resets configuration data

Return Value

void

at line 185
void setConfigData(array $cfg)

Sets configuration data (overrides old data)

Parameters

array $cfg Configuration options

Return Value

void

at line 199
void set(string $path, mixed $value, string $canonicalPath = null)

Sets config value

Parameters

string $path Path
mixed $value Value
string $canonicalPath Canonical path

Return Value

void

at line 270
array getFlatDefaultConfig()

Returns default config in a flattened array

Return Value

array

at line 287
void updateWithGlobalConfig(array $cfg)

Updates config with values read from given array (config will contain differences to defaults from config.defaults.php).

Parameters

array $cfg Configuration

Return Value

void

at line 314
mixed get(string $path, mixed $default = null)

Returns config value or $default if it's not set

Parameters

string $path Path of config file
mixed $default Default values

Return Value

mixed

at line 329
mixed getDefault(string $canonicalPath, mixed $default = null)

Returns default config value or $default it it's not set ie. it doesn't exist in config.default.php ($cfg) and config.values.php ($_cfg_db['_overrides'])

Parameters

string $canonicalPath Canonical path
mixed $default Default value

Return Value

mixed

at line 343
mixed getValue(string $path, mixed $default = null)

Returns config value, if it's not set uses the default one; returns $default if the path isn't set and doesn't contain a default value

Parameters

string $path Path
mixed $default Default value

Return Value

mixed

at line 360
string getCanonicalPath(string $path)

Returns canonical path

Parameters

string $path Path

Return Value

string

at line 373
mixed getDbEntry(string $path, mixed $default = null)

Returns config database entry for $path

Parameters

string $path path of the variable in config db
mixed $default default value

Return Value

mixed

at line 383
int getServerCount()

Returns server count

Return Value

int

at line 395
array|null getServers()

Returns server list

Return Value

array|null

at line 409
string getServerDSN(integer $server)

Returns DSN of given server

Parameters

integer $server server index

Return Value

string

at line 443
string getServerName(int $id)

Returns server name

Parameters

int $id server index

Return Value

string

at line 463
void removeServer(int $server)

Removes server

Parameters

int $server server index

Return Value

void

at line 488
array getConfig()

Returns configuration array (full, multidimensional format)

Return Value

array

at line 506
array getConfigArray()

Returns configuration array (flat format)

Return Value

array