Documentation

SystemConfig
in package

Tags
copyright

Cloudrexx AG

author

Thomas Wirz thomas.wirz@cloudrexx.com

subpackage

core_config

Table of Contents

Properties

$baseConfig  : ConfigArray
$dbConfig  : ConfigArray
$source  : string

Methods

__construct()  : mixed
If $configFilePath is not given, the configuration in the same codebase as this file is loaded.
getBaseConfig()  : string|int
getBaseConfigInt()  : int
getBaseConfigString()  : string
getDbConfig()  : string
getFullBaseConfig()  : ConfigArray
getFullDbConfig()  : ConfigArray
getSource()  : string
Returns the config path
detectSystemPaths()  : void
Sets/overwrites $documentRoot to the document root of the php-fpm environment and $rootOffset to the web offset path
fixPathConfig()  : void
Ensures that $_PATHCONFIG is set correctly.
loadConfig()  : void
Load global configuration from configuration.php
loadLegacyGlobals()  : void
Load {@see static::$baseConfig} and {@see static::$dbConfig} from globals $_CONFIG and $_DBCONFIG if the globals are already set.
setLegacyGlobals()  : void
Add legacy wrappers for {@see static::$baseConfig} and {@see static::$dbConfig} as globals $_CONFIG and $_DBCONFIG. Note that the config actually gets loaded through those global wrappers in configuration.php and settings.php.

Properties

$source

protected string $source = ''

Config file name, empty if no config file was loaded

Methods

__construct()

If $configFilePath is not given, the configuration in the same codebase as this file is loaded.

public __construct([string $configFilePath = '' ]) : mixed

If globals $_CONFIG or $_DBCONFIG are set, they are used to initialize the configuration.

Parameters
$configFilePath : string = ''

(optional) Absolute path to the configuration.php file to load

getBaseConfig()

public getBaseConfig(string $key) : string|int

Use static::getBaseConfigString() or static::getBaseConfigInt() instead.

Parameters
$key : string
Return values
string|int

Base configuration option identified by key $key from $CONFIG in configuration.php and settings.php or overwritten by an associated environment variable of the form CLX_CONFIG<KEY>. See ConfigArray::offsetGet() for a complete reference of the format of environment variables.

getBaseConfigInt()

public getBaseConfigInt(string $key) : int
Parameters
$key : string
Return values
int

Base configuration option identified by key $key from $CONFIG in configuration.php and settings.php or overwritten by an associated environment variable of the form CLX_CONFIG<KEY>. See ConfigArray::offsetGet() for a complete reference of the format of environment variables.

getBaseConfigString()

public getBaseConfigString(string $key) : string
Parameters
$key : string
Return values
string

Base configuration option identified by key $key from $CONFIG in configuration.php and settings.php or overwritten by an associated environment variable of the form CLX_CONFIG<KEY>. See ConfigArray::offsetGet() for a complete reference of the format of environment variables.

getDbConfig()

public getDbConfig(string $key) : string
Parameters
$key : string
Return values
string

Database configuration option identified by key $key from $DBCONFIG in configuration.php or overwritten by an associated environment variable of the form CLX_DBCONFIG<KEY>. See ConfigArray::offsetGet() for a complete reference of the format of environment variables.

getFullBaseConfig()

public getFullBaseConfig() : ConfigArray
Return values
ConfigArray

Complete base configuration set by $CONFIG in configuration.php and settings.php or overwritten by associated environment variables of the form CLX_CONFIG<KEY>. See ConfigArray::offsetGet() for a complete reference of the format of environment variables.

getFullDbConfig()

public getFullDbConfig() : ConfigArray
Return values
ConfigArray

Complete database configuration set by $DBCONFIG in configuration.php or overwritten by associated environment variables of the form CLX_DBCONFIG<KEY>. See ConfigArray::offsetGet() for a complete reference of the format of environment variables.

getSource()

Returns the config path

public getSource() : string
Return values
string

Config file path or empty string if no config file was loaded

detectSystemPaths()

Sets/overwrites $documentRoot to the document root of the php-fpm environment and $rootOffset to the web offset path

protected detectSystemPaths(string &$documentRoot, string &$rootOffset) : void
Parameters
$documentRoot : string
$rootOffset : string

fixPathConfig()

Ensures that $_PATHCONFIG is set correctly.

protected fixPathConfig() : void

See CLX-4284

loadConfig()

Load global configuration from configuration.php

protected loadConfig([string $configFilePath = '' ]) : void

Load static::$baseConfig (through wrapper $_CONFIG), static::$dbConfig (through wrapper $_DBCONFIG) & $_PATHCONFIG. Note that $_PATHCONFIG is not handled by this class for the following reason:

  • $_PATHCONFIG is obsolete. See CLX-4284
Parameters
$configFilePath : string = ''

loadLegacyGlobals()

Load {@see static::$baseConfig} and {@see static::$dbConfig} from globals $_CONFIG and $_DBCONFIG if the globals are already set.

protected loadLegacyGlobals() : void

This is a work-around for sites that load two different config files with one depending on the other. Important: Do not rely on this feature as it will be dropped in the future.

setLegacyGlobals()

Add legacy wrappers for {@see static::$baseConfig} and {@see static::$dbConfig} as globals $_CONFIG and $_DBCONFIG. Note that the config actually gets loaded through those global wrappers in configuration.php and settings.php.

protected setLegacyGlobals() : void

        
On this page

Search results