class Config (View source)

Configuration handling

Properties

static self|null $instance
array $default
array $baseSettings
array $settings
int $sourceMtime
Settings $config
int<0, max> $server
array $selectedServer
string $userPreferences

Methods

__construct()

No description

static Config
getInstance() deprecated

No description

void
setSetup(bool $isSetup)

No description

bool
isSetup()

No description

void
loadFromFile(string|null $source = null)

No description

bool
isGd2Available()

No description

bool
isWindows()

No description

void
loadUserPreferences(ThemeManager $themeManager, bool $isMinimumCommon = false)

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

Message
setUserValue(string|null $cookieName, string $cfgPath, mixed $newCfgValue, string|null $defaultValue = null)

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

mixed
getUserValue(string $cookieName, mixed $cfgValue)

Reads value stored by setUserValue()

void
setSource(string $source)

set source

bool
configFileExists()

No description

void
checkPermissions()

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

void
set(string $setting, mixed $value)

sets configuration variable

string
getSource()

returns source for current config

bool
isUploadEnabled()

No description

bool
isHttps()

Checks if protocol is https

string
getRootPath()

Get phpMyAdmin root path

bool
removeCookie(string $cookieName)

removes cookie

bool
setCookie(string $cookie, string $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

mixed
getCookie(string $cookieName)

get cookie

string
getCookieName(string $cookieName)

Get the real cookie name

bool
issetCookie(string $cookieName)

isset cookie

string|null
getTempDir(string $name)

Returns temporary dir path

string|null
getUploadTempDir()

Returns temporary directory

int
selectServer(mixed $serverParamFromRequest)

No description

static Server
getConnectionParams(Server $currentServer, ConnectionType $connectionType)

Return connection parameters for the database server

void
getLoginCookieValidityFromCache(int $server)

Get LoginCookieValidity from preferences cache.

getSettings()

No description

bool
hasSelectedServer()

No description

string
getChangeLogFilePath()

No description

Details

__construct()

No description

static Config getInstance() deprecated

deprecated Use dependency injection instead.

No description

Return Value

Config

void setSetup(bool $isSetup)

No description

Parameters

bool $isSetup

Return Value

void

bool isSetup()

No description

Return Value

bool

void loadFromFile(string|null $source = null)

No description

Parameters

string|null $source

source to read config from

Return Value

void

Exceptions

ConfigException

bool isGd2Available()

No description

Return Value

bool

bool isWindows()

No description

Return Value

bool

void loadUserPreferences(ThemeManager $themeManager, bool $isMinimumCommon = false)

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

Parameters

ThemeManager $themeManager
bool $isMinimumCommon

Return Value

void

Message setUserValue(string|null $cookieName, string $cfgPath, mixed $newCfgValue, string|null $defaultValue = 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 loadUserPreferences()

Parameters

string|null $cookieName

can be null

string $cfgPath

configuration path

mixed $newCfgValue

new value

string|null $defaultValue

default value

Return Value

Message

mixed getUserValue(string $cookieName, mixed $cfgValue)

Reads value stored by setUserValue()

Parameters

string $cookieName

cookie name

mixed $cfgValue

config value

Return Value

mixed

void setSource(string $source)

set source

Parameters

string $source source

Return Value

void

bool configFileExists()

No description

Return Value

bool

Exceptions

ConfigException

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

Exceptions

ConfigException

void set(string $setting, mixed $value)

sets configuration variable

Parameters

string $setting

configuration option

mixed $value

new value for configuration option

Return Value

void

string getSource()

returns source for current config

Return Value

string

config source

bool isUploadEnabled()

No description

Return Value

bool

bool isHttps()

Checks if protocol is https

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

Return Value

bool

string getRootPath()

Get phpMyAdmin root path

Return Value

string

bool removeCookie(string $cookieName)

removes cookie

Parameters

string $cookieName

name of cookie to remove

Return Value

bool

bool setCookie(string $cookie, string $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

string $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

mixed getCookie(string $cookieName)

get cookie

Parameters

string $cookieName

The name of the cookie to get

Return Value

mixed

result of getCookie()

string getCookieName(string $cookieName)

Get the real cookie name

Parameters

string $cookieName

The name of the cookie

Return Value

string

bool issetCookie(string $cookieName)

isset cookie

Parameters

string $cookieName

The name of the cookie to check

Return Value

bool

string|null getTempDir(string $name)

Returns temporary dir path

Parameters

string $name

Directory name

Return Value

string|null

string|null getUploadTempDir()

Returns temporary directory

Return Value

string|null

int selectServer(mixed $serverParamFromRequest)

No description

Parameters

mixed $serverParamFromRequest

Return Value

int

static Server getConnectionParams(Server $currentServer, ConnectionType $connectionType)

Return connection parameters for the database server

Parameters

Server $currentServer
ConnectionType $connectionType

Return Value

Server

void getLoginCookieValidityFromCache(int $server)

Get LoginCookieValidity from preferences cache.

No generic solution for loading preferences from cache as some settings need to be kept for processing in loadUserPreferences().

Parameters

int $server

Return Value

void

See also

loadUserPreferences()

Settings getSettings()

No description

Return Value

Settings

bool hasSelectedServer()

No description

Return Value

bool

string getChangeLogFilePath()

No description

Return Value

string