class ConfigFile (View source)

Config file management class.

Stores its data in $_SESSION

Methods

__construct(array|null $baseConfig = null)

No description

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 setPersistKeys()

void
setAllowedKeys(array|null $keys)

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

void
setCfgUpdateReadMapping(array $mapping)

Sets path mapping for updating config in updateWithGlobalConfig() or reading by 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|null $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 {\PhpMyAdmin\Config\Settings}).

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 {\PhpMyAdmin\Config\Settings} ($cfg).

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
getServers()

Returns server list

string
getServerDSN(int $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)

array
getAllowedValues()

Database with allowed values for configuration stored in the $cfg array, used by setup script and user preferences to generate forms.

Details

__construct(array|null $baseConfig = null)

No description

Parameters

array|null $baseConfig

base configuration read from PhpMyAdmin\Config::$base_config, use only when not in PMA Setup Stores original PMA config, not modified by user preferences

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

array getPersistKeysMap()

Returns flipped array set by setPersistKeys()

Return Value

array

void setAllowedKeys(array|null $keys)

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

Parameters

array|null $keys

array of allowed keys or null to remove filter

Return Value

void

void setCfgUpdateReadMapping(array $mapping)

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

Parameters

array $mapping

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

Return Value

void

void resetConfigData()

Resets configuration data

Return Value

void

void setConfigData(array $cfg)

Sets configuration data (overrides old data)

Parameters

array $cfg

Configuration options

Return Value

void

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

Sets config value

Parameters

string $path
mixed $value
string|null $canonicalPath

Return Value

void

array getFlatDefaultConfig()

Returns default config in a flattened array

Return Value

array

void updateWithGlobalConfig(array $cfg)

Updates config with values read from given array (config will contain differences to defaults from {\PhpMyAdmin\Config\Settings}).

Parameters

array $cfg Configuration

Return Value

void

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

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

Returns default config value or $default it it's not set ie. it doesn't exist in {\PhpMyAdmin\Config\Settings} ($cfg).

Parameters

string $canonicalPath

Canonical path

mixed $default

Default value

Return Value

mixed

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

string getCanonicalPath(string $path)

Returns canonical path

Parameters

string $path Path

Return Value

string

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

int getServerCount()

Returns server count

Return Value

int

array getServers()

Returns server list

Return Value

array

string getServerDSN(int $server)

Returns DSN of given server

Parameters

int $server

server index

Return Value

string

string getServerName(int $id)

Returns server name

Parameters

int $id

server index

Return Value

string

void removeServer(int $server)

Removes server

Parameters

int $server

server index

Return Value

void

array getConfig()

Returns configuration array (full, multidimensional format)

Return Value

array

array getConfigArray()

Returns configuration array (flat format)

Return Value

array

array getAllowedValues()

Database with allowed values for configuration stored in the $cfg array, used by setup script and user preferences to generate forms.

Value meaning: array - select field, array contains allowed values string - type override

Return Value

array