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
파일 보기 프로젝트 열기: piwik/piwik 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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