PHP Класс Piwik\Config

This class reads and writes to the config/config.ini.php file. If config options are missing from that file, this class will look for their default values in config/global.ini.php. ### Examples **Getting a value:** read the minimum_memory_limit option under the [General] section $minValue = Config::getInstance()->General['minimum_memory_limit']; **Setting a value:** set the minimum_memory_limit option Config::getInstance()->General['minimum_memory_limit'] = 256; Config::getInstance()->forceSave(); **Setting an entire section:** Config::getInstance()->MySection = array('myoption' => 1); Config::getInstance()->forceSave();
Наследование: extends piwik\Singleton
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$doNotWriteConfigInTests boolean
$settings Piwik\Application\Kernel\GlobalSettingsProvider

Открытые методы

Метод Описание
__construct ( Piwik\Application\Kernel\GlobalSettingsProvider $settings )
__get ( string $name ) : string | array Returns a configuration value or section by name.
__set ( string $name, mixed $value ) Sets a configuration value or section.
clear ( ) Clear in-memory configuration so it can be reloaded
deleteLocalConfig ( )
dumpConfig ( ) : string | null Dump config
existsLocalConfig ( )
forceSave ( ) Writes the current configuration to the **config.ini.php** file. Only writes options whose values are different from the default.
forceUsageOfLocalHostnameConfig ( string $hostname ) : string If set, Piwik will use the hostname config no matter if it exists or not. Useful for instance if you want to create a new hostname config:
getByDomainConfigPath ( )
getClientSideOptions ( )
getCommonConfigPath ( ) : string Returns absolute path to the common configuration file.
getCommonPath ( ) : string Returns the path to the common config file used by this instance.
getConfigHostnameIfSet ( )
getConfigNotWritableException ( )
getFromCommonConfig ( $name )
getFromGlobalConfig ( $name )
getFromLocalConfig ( $name )
getGlobalConfigPath ( ) : string Returns absolute path to the global configuration file
getGlobalPath ( ) : string Returns the path to the global config file used by this instance.
getHostname ( ) : string Returns the hostname of the current request (without port number)
getInstance ( ) : Config
getLocalConfigPath ( ) : string Returns absolute path to the local configuration file
getLocalPath ( ) : string Returns the path to the local config file used by this instance.
init ( ) Read configuration from files into memory
isFileWritable ( ) : boolean Returns true if the local configuration file is writable.

Защищенные методы

Метод Описание
reload ( $pathLocal = null, $pathGlobal = null, $pathCommon = null ) Reloads config data from disk.
writeConfig ( boolean $clear = true ) Write user configuration file

Приватные методы

Метод Описание
getDatatableRowLimits ( ) : mixed
getLocalConfigInfoForHostname ( $hostname )

Описание методов

__construct() публичный Метод

public __construct ( Piwik\Application\Kernel\GlobalSettingsProvider $settings )
$settings Piwik\Application\Kernel\GlobalSettingsProvider

__get() публичный Метод

Returns a configuration value or section by name.
public __get ( string $name ) : string | array
$name string The value or section name.
Результат string | array The requested value requested. Returned by reference.

__set() публичный Метод

Sets a configuration value or section.
public __set ( string $name, mixed $value )
$name string This section name or value name to set.
$value mixed

clear() публичный Метод

Clear in-memory configuration so it can be reloaded
Устаревший: since v2.12.0
public clear ( )

deleteLocalConfig() публичный Метод

public deleteLocalConfig ( )

dumpConfig() публичный Метод

Dump config
public dumpConfig ( ) : string | null
Результат string | null

existsLocalConfig() публичный Метод

Устаревший:
public existsLocalConfig ( )

forceSave() публичный Метод

Writes the current configuration to the **config.ini.php** file. Only writes options whose values are different from the default.
public forceSave ( )

forceUsageOfLocalHostnameConfig() публичный Метод

$config = Config::getInstance(); $config->forceUsageOfHostnameConfig('piwik.example.com'); $config->save();
public forceUsageOfLocalHostnameConfig ( string $hostname ) : string
$hostname string eg piwik.example.com
Результат string

getByDomainConfigPath() публичный статический Метод

public static getByDomainConfigPath ( )

getClientSideOptions() публичный Метод

getCommonConfigPath() публичный статический Метод

Returns absolute path to the common configuration file.
public static getCommonConfigPath ( ) : string
Результат string

getCommonPath() публичный Метод

Returns the path to the common config file used by this instance.
public getCommonPath ( ) : string
Результат string

getConfigHostnameIfSet() публичный Метод

getConfigNotWritableException() публичный Метод

getFromCommonConfig() публичный Метод

public getFromCommonConfig ( $name )

getFromGlobalConfig() публичный Метод

public getFromGlobalConfig ( $name )

getFromLocalConfig() публичный Метод

public getFromLocalConfig ( $name )

getGlobalConfigPath() публичный статический Метод

Returns absolute path to the global configuration file
public static getGlobalConfigPath ( ) : string
Результат string

getGlobalPath() публичный Метод

Returns the path to the global config file used by this instance.
public getGlobalPath ( ) : string
Результат string

getHostname() публичный статический Метод

Returns the hostname of the current request (without port number)
public static getHostname ( ) : string
Результат string

getInstance() публичный статический Метод

public static getInstance ( ) : Config
Результат Config

getLocalConfigPath() публичный статический Метод

Returns absolute path to the local configuration file
public static getLocalConfigPath ( ) : string
Результат string

getLocalPath() публичный Метод

Returns the path to the local config file used by this instance.
public getLocalPath ( ) : string
Результат string

init() публичный Метод

Read configuration from files into memory
Устаревший: since v2.12.0
public init ( )

isFileWritable() публичный Метод

Returns true if the local configuration file is writable.
public isFileWritable ( ) : boolean
Результат boolean

reload() защищенный Метод

Reloads config data from disk.
protected reload ( $pathLocal = null, $pathGlobal = null, $pathCommon = null )

writeConfig() защищенный Метод

Write user configuration file
protected writeConfig ( boolean $clear = true )
$clear boolean

Описание свойств

$doNotWriteConfigInTests защищенное свойство

protected bool $doNotWriteConfigInTests
Результат boolean

$settings защищенное свойство

protected GlobalSettingsProvider,Piwik\Application\Kernel $settings
Результат Piwik\Application\Kernel\GlobalSettingsProvider