class CRM_Core_Config extends CRM_Core_Config_MagicMerge

Class CRM_Core_Config

Properties

CRM_Utils_System_Base $userSystem
CRM_Core_Permission_Base $userPermissionClass
array $enableComponents
array $languageLimit
bool $debug
bool $doNotResetCache
string $maxFileSize
string $defaultCurrency
string $defaultCurrencySymbol
string $lcMessages
string $fieldSeparator
string $userFramework
string $verpSeparator
string $dateFormatFull
string $resourceBase
string $dsn
string $customTemplateDir
string $defaultContactCountry
string $defaultContactStateProvince
string $monetaryDecimalPoint
string $monetaryThousandSeparator

Methods

__construct()

The constructor. Sets domain id if defined, otherwise assumes single instance installation.

__wakeup()

Set the map to the property map.

static array
getPropertyMap()

Get a list of $config properties and the entities to which they map.

mixed
__get(string $k)

Get value.

__set(string $k, mixed $v)

Set value.

bool
__isset(string $k)

Is value set.

__unset(string $k)

Unset value.

static CRM_Core_Config
singleton(bool $loadFromDB = TRUE, bool $force = FALSE)

Singleton function used to manage this object.

static object
getLog() deprecated

Returns the singleton logger for the application.

static Mail
getMailer() deprecated

Retrieve a mailer to send any mail from the application.

cleanup(int $value, bool $rmdir = TRUE)

Deletes the web server writable directories.

static bool
check(CRM_Core_Config $config, array $required)

Verify that the needed parameters are not null in the config.

reset()

Reset the serialized array and recompute.

authenticate()

This method should initialize auth sources.

static int|null
domainID(int $domainID = NULL, bool $reset = FALSE)

One function to get domain ID.

cleanupCaches(bool $sessionReset = TRUE)

Do general cleanup of caches, temp directories and temp tables CRM-8739

cleanupPermissions()

Do general cleanup of module permissions.

clearModuleList()

Flush information about loaded modules.

static 
clearDBCache()

Clear db cache.

static 
clearTempTables(string|bool $timeInterval = FALSE)

Clear leftover temporary tables.

static bool
isUpgradeMode(string $path = NULL)

Check if running in upgrade mode.

static bool
isEnabledBackOfficeCreditCardPayments()

Is back office credit card processing enabled for this site - ie are there any installed processors that support it? This function is used for determining whether to show the submit credit card link, not for determining which processors to show, hence it is a config var

addressSequence() deprecated

No description

defaultContactCountry() deprecated

No description

defaultContactCountryName() deprecated

No description

string
defaultCurrencySymbol(string $defaultCurrency = NULL) deprecated

No description

free()

Resets the singleton, so that the next call to CRM_Core_Config::singleton() reloads completely.

handleFirstRun()

Conditionally fire an event during the first page run.

Details

at line 88
__construct()

The constructor. Sets domain id if defined, otherwise assumes single instance installation.

__wakeup()

Set the map to the property map.

static array getPropertyMap()

Get a list of $config properties and the entities to which they map.

This is used for two purposes:

  1. Runtime: Provide backward-compatible interface for reading these properties.
  2. Upgrade: Migrate old properties of config_backend into settings.

Return Value

array

mixed __get(string $k)

Get value.

Parameters

string $k

Return Value

mixed

Exceptions

CRM_Core_Exception

__set(string $k, mixed $v)

Set value.

Parameters

string $k
mixed $v

Exceptions

CRM_Core_Exception

bool __isset(string $k)

Is value set.

Parameters

string $k

Return Value

bool

__unset(string $k)

Unset value.

Parameters

string $k

Exceptions

CRM_Core_Exception

protected SettingsBag getSettings()

Return Value

SettingsBag

at line 102
static CRM_Core_Config singleton(bool $loadFromDB = TRUE, bool $force = FALSE)

Singleton function used to manage this object.

Parameters

bool $loadFromDB whether to load from the database.
bool $force whether to force a reconstruction.

Return Value

CRM_Core_Config

at line 140
static object getLog() deprecated

deprecated

Returns the singleton logger for the application.

Return Value

object

See also

Civi::log()

at line 155
static Mail getMailer() deprecated

deprecated

Retrieve a mailer to send any mail from the application.

Return Value

Mail

See also

Civi::service()

at line 166
cleanup(int $value, bool $rmdir = TRUE)

Deletes the web server writable directories.

Parameters

int $value 1: clean templates_c, 2: clean upload, 3: clean both
bool $rmdir

at line 202
static bool check(CRM_Core_Config $config, array $required)

Verify that the needed parameters are not null in the config.

Parameters

CRM_Core_Config $config (reference) the system config object
array $required (reference) the parameters that need a value

Return Value

bool

at line 215
reset()

Reset the serialized array and recompute.

use with care

at line 223
authenticate()

This method should initialize auth sources.

at line 251
static int|null domainID(int $domainID = NULL, bool $reset = FALSE)

One function to get domain ID.

Parameters

int $domainID
bool $reset

Return Value

int|null

at line 269
cleanupCaches(bool $sessionReset = TRUE)

Do general cleanup of caches, temp directories and temp tables CRM-8739

Parameters

bool $sessionReset

at line 286
cleanupPermissions()

Do general cleanup of module permissions.

at line 316
clearModuleList()

Flush information about loaded modules.

at line 326
static clearDBCache()

Clear db cache.

at line 360
static clearTempTables(string|bool $timeInterval = FALSE)

Clear leftover temporary tables.

This is called on upgrade, during tests and site move, from the cron and via clear caches in the UI.

Currently the UI clear caches does not pass a time interval - which may need review as it does risk ripping the tables out from underneath a current action. This was considered but out-of-scope for CRM-16167

Parameters

string|bool $timeInterval Optional time interval for mysql date function.g '2 day'. This can be used to prevent tables created recently from being deleted.

at line 397
static bool isUpgradeMode(string $path = NULL)

Check if running in upgrade mode.

Parameters

string $path

Return Value

bool

at line 439
static bool isEnabledBackOfficeCreditCardPayments()

Is back office credit card processing enabled for this site - ie are there any installed processors that support it? This function is used for determining whether to show the submit credit card link, not for determining which processors to show, hence it is a config var

Return Value

bool

at line 446
addressSequence() deprecated

deprecated

at line 453
defaultContactCountry() deprecated

deprecated

at line 460
defaultContactCountryName() deprecated

deprecated

at line 471
string defaultCurrencySymbol(string $defaultCurrency = NULL) deprecated

deprecated

Parameters

string $defaultCurrency

Return Value

string

at line 484
free()

Resets the singleton, so that the next call to CRM_Core_Config::singleton() reloads completely.

While normally we could call the singleton function with $force = TRUE, this function addresses a very specific use-case in the CiviCRM installer, where we cannot yet force a reload, but we want to make sure that the next call to this object gets a fresh start (ex: to initialize the DAO).

at line 499
handleFirstRun()

Conditionally fire an event during the first page run.

The install system is currently implemented several times, so it's hard to add new installation logic. We use a poor-man's method to detect the first run.

Situations to test: - New installation - Upgrade from an old version (predating first-run tracker) - Upgrade from an old version (with first-run tracking)