lib/ezutils/classes/ezini.php
File containing the eZINI class.
- Copyright
- Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
- License
- eZ Business Use License Agreement Version 2.0
- Package
- lib
- Version
- 4.6.0
\eZINI
File containing the eZINI class.
- Copyright
- Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
- License
- eZ Business Use License Agreement Version 2.0
- Version
- 4.6.0
Constants
Properties


bool
$cacheEnabled= 'true'
Contains whether INI cache is globally enabled.
true
Details- Type
- bool


null|bool
$checkFileMtime= 'null'
Set EZP_INI_FILEMTIME_CHECK constant to false to improve performance by not checking modified time on ini files. You can also set it to a string, the name of a ini file you still want to check modified time on, best example would be to set it to 'site.ini' to make the system still check that but not the rest.
null
Details- Type
- null | bool


bool
$debugEnabled= 'false'
Contains whether internals debugging is enabled.
false
Details- Type
- bool


null|int
$filePermission= 'null'
set EZP_INI_FILE_PERMISSION constant to the permissions you want saved ini and cache files to have.
null
Details- Type
- null | int


\array(eZINI)
$instances= 'array()'
Array of eZINI instances
array()
Details- Type
- \array(eZINI)
Methods


appendOverrideDir(
string $dir, bool $globalDir
=
false, string | false $identifier
=
false, string | null $scope
=
null
)
:
bool
Appends the override directory $dir to the override directory list.
Appends override dir to 'override' scope if scope is not defined, meaning above anything else. See {@link eZINI::defaultOverrideDirs()} for how these parameters are used.
Name | Type | Description |
---|---|---|
$dir | string | |
$globalDir | bool | |
$identifier | string | false | Will overwrite existing directory with same identifier if set |
$scope | string | null |
Type | Description |
---|---|
bool | True if new dir was appended, false if there was a $identifier match and a overwrite |


assign(
$blockName, $varName, $variable
)
:
void
Name | Type | Description |
---|---|---|
$blockName | ||
$varName | ||
$variable |


create(
$fileName
=
'site.ini', $rootDir
=
'settings', $useTextCodec
=
null, $useCache
=
null, $useLocalOverrides
=
null
)
:
void
Name | Type | Description |
---|---|---|
$fileName | ||
$rootDir | ||
$useTextCodec | ||
$useCache | ||
$useLocalOverrides |


defaultOverrideDirs(
)
:
array
Default override directories as raw array data
Type | Description |
---|---|
array | An associated array of associated arrays of arrays.. First level keys are the scope and values are arrays Second level keys are identifier (numberic if not defined by caller) and value is arrays Third level contains (string) override dir, (bool) global flag if false then relative to {@link $RootDir} and (string|false) optional identifier as used by {@link eZINI::prependOverrideDir()} to match and replace values on. |


eZINI(
string $fileName
=
'site.ini', string $rootDir
=
'', null | bool $useTextCodec
=
null, null | bool $useCache
=
null, null | bool $useLocalOverrides
=
null, bool $directAccess
=
false, bool $addArrayDefinition
=
false, bool $load
=
true
)
:
void
Initialization of eZINI object
Enter description here ...
Name | Type | Description |
---|---|---|
$fileName | string | |
$rootDir | string | |
$useTextCodec | null | bool | |
$useCache | null | bool | |
$useLocalOverrides | null | bool | |
$directAccess | bool | |
$addArrayDefinition | bool | |
$load | bool | @since 4.5 Lets you disable automatic loading of ini values in cases where changes on instance will be done first. |


exists(
$fileName
=
"site.ini", $rootDir
=
"settings"
)
:
void
Name | Type | Description |
---|---|---|
$fileName | ||
$rootDir |


fetchFromFile(
$fileName, $useTextCodec
=
null
)
:
void
Name | Type | Description |
---|---|---|
$fileName | ||
$useTextCodec |


findInputFiles(
$inputFiles, $iniFile
)
:
void
Name | Type | Description |
---|---|---|
$inputFiles | ||
$iniFile |


findSettingPlacement(
string $path
)
:
string
Gives you the location of a ini file based on it's path, format is same as used internally
for $identifer for override dirs-
Eg: default / ext-siteaccess:
Name | Type | Description |
---|---|---|
$path | string |
Type | Description |
---|---|
string |


getSiteAccessIni(
string $siteAccess, string $iniFile
)
:
\eZINI
Get ini file for a specific siteaccess (not incl extesnions or overrides) use {@link eZSiteAccess::getIni()} instead if you want to have full ini env.
Name | Type | Description |
---|---|---|
$siteAccess | string | |
$iniFile | string |
Type | Description |
---|---|
\eZINI |


globalOverrideDirs(
string | false | null $scope
=
null
)
:
array
Return the global override directories witch raw override dir data, or within a scope if $scope is set, see {@link eZINI::defaultOverrideDirs()} for how the raw data looks like.
Name | Type | Description |
---|---|---|
$scope | string | false | null | See {@link eZINI::defaultOverrideDirs()} for possible scope values If false then you'll get raw override dir structure, null (default) is a simplified variant withouth scopes that is easy to iterate over. |
Type | Description |
---|---|
array |


instance(
string $fileName
=
'site.ini', string $rootDir
=
'settings', null | bool $useTextCodec
=
null, null | bool $useCache
=
null, null | bool $useLocalOverrides
=
null, bool $directAccess
=
false, bool $addArrayDefinition
=
false
)
:
\eZINI
Returns a shared instance of the eZINI class pr $fileName, $rootDir and $useLocalOverrides param combinations.
If $useLocalOverrides is set to true you will get a copy of the current overrides, but changes to the override settings will not be global. Direct access is for accessing the filename directly in the specified path. .append and .append.php is automaticly added to filename note: Use create() if you need to get a unique copy which you can alter.
Name | Type | Description |
---|---|---|
$fileName | string | |
$rootDir | string | |
$useTextCodec | null | bool | Default system setting if null (instance not used if not null!) |
$useCache | null | bool | Default system setting if null (instance not used if not null!) |
$useLocalOverrides | null | bool | Default system setting if null |
$directAccess | bool | Direct access to specific file instead of values from several (instance not used if true!) |
$addArrayDefinition | bool | @deprecated since version 4.5, use "new eZINI()" (instance not used if true!) |
Type | Description |
---|---|
\eZINI |


isCacheEnabled(
)
:
bool
Returns whether INI cache is enabled globally, by default it is true.
Type | Description |
---|---|
bool |
- See
- \setIsCacheEnabled().


isDebugEnabled(
)
:
bool
Returns whether debugging of internals is enabled.
This will display which files are loaded an when cache files are created.
Type | Description |
---|---|
bool |
- See
- \setIsDebugEnabled()


isLoaded(
string $fileName
=
'site.ini', string $rootDir
=
'settings', null | bool $useLocalOverrides
=
null
)
:
bool
Returns whether the mentioned ini file has been loaded.
Name | Type | Description |
---|---|---|
$fileName | string | |
$rootDir | string | |
$useLocalOverrides | null | bool | default system setting if null |
Type | Description |
---|---|
bool |


isSettingReadOnly(
$fileName
=
false, $blockName
=
false, $settingName
=
false
)
:
void
Name | Type | Description |
---|---|---|
$fileName | ||
$blockName | ||
$settingName |


isTextCodecEnabled(
)
:
bool
Returns whether textcodecs is to be used, this will use the eZTextCodec class in the eZI18N library for text conversion.
Type | Description |
---|---|
bool |
- See
- \setIsTextCodecEnabled()


isVariableModified(
$blockName, $varName
)
:
void
Name | Type | Description |
---|---|---|
$blockName | ||
$varName |


load(
bool $reset
=
true
)
:
void
Tries to load the ini file specified in the constructor or instance() function.
If cache files should be used and a cache file is found it loads that instead.
Name | Type | Description |
---|---|---|
$reset | bool | Reset ini values on instance |


loadPlacement(
bool $reset
=
true
)
:
void
Tries to load the ini file placement specified in the constructor or instance() function.
If cache files should be used and a cache file is found it loads that instead.
Name | Type | Description |
---|---|---|
$reset | bool | Reset ini values on instance |


overrideDirs(
string | null | false $scope
=
null
)
:
array
Return the override directories witch raw override dir data, or within a scope if $scope is set, see {@link eZINI::defaultOverrideDirs()} for how the raw data looks like.
Name | Type | Description |
---|---|---|
$scope | string | null | false | See {@link eZINI::defaultOverrideDirs()} for possible scope values If false then you'll get raw override dir structure, null (default) is a simplified variant withouth scopes that is easy to iterate over. |
Type | Description |
---|---|
array |


overrideDirsByScope(
array $dirs, string | null | false $scope
=
null
)
:
array
Return the override directories witch raw override dir data, or within a scope if $scope is set, see {@link eZINI::defaultOverrideDirs()} for how the raw data looks like.
Name | Type | Description |
---|---|---|
$dirs | array | Directories directly from internal raw structure (see above). |
$scope | string | null | false | See {@link eZINI::defaultOverrideDirs()} for possible scope values If false then you'll get raw override dir structure, null (default) is a simplified variant withouth scopes that is easy to iterate over. |
Type | Description |
---|---|
array |


parameterSet(
string $fileName
=
'site.ini', string $rootDir
=
'settings', string $section, string $parameter
)
:
bool
Check whether a specified parameter in a specified section is set in a specified file
Name | Type | Description |
---|---|---|
$fileName | string | fileName file name (optional) |
$rootDir | string | rootDir directory (optional) |
$section | string | section section name |
$parameter | string | parameter parameter name |
Type | Description |
---|---|
bool | True if the the parameter is set. |
- Deprecated
- Since 4.4


parse(
$inputFiles
=
false, $iniFile
=
false, $reset
=
true, $placement
=
false
)
:
void
Name | Type | Description |
---|---|---|
$inputFiles | ||
$iniFile | ||
$reset | ||
$placement |


prependOverrideDir(
string $dir, bool $globalDir
=
false, string | false $identifier
=
false, string | null $scope
=
null
)
:
bool
Prepends the override directory $dir to the override directory list.
Prepends override dir to 'extension' scope by default, bellow siteaccess and override settings. See {@link eZINI::defaultOverrideDirs()} for how these parameters are used.
Name | Type | Description |
---|---|---|
$dir | string | |
$globalDir | bool | |
$identifier | string | false | Will overwrite existing directory with same identifier if set |
$scope | string | null |
Type | Description |
---|---|
bool | True if new dir was prepended, false if there was a $identifier match and a overwrite |


removeOverrideDir(
string $identifier, string $scope
=
'extension'
)
:
bool
Removes an override dir by identifier See {@link eZINI::defaultOverrideDirs()} for how these parameters are used.
Name | Type | Description |
---|---|---|
$identifier | string | Will remove existing directory with identifier it it exists |
$scope | string | By default 'extension' |
Type | Description |
---|---|
bool | True if new dir was appended, false if there was a $identifier match and a overwrite |


removeSetting(
$blockName, $settingName
)
:
void
Name | Type | Description |
---|---|---|
$blockName | ||
$settingName |


resetAllGlobals(
$resetGlobalOverrideDirs
=
true
)
:
void
Reset all eZINI instances as well override dirs ( optional )
Name | Type | Description |
---|---|---|
$resetGlobalOverrideDirs |
- Deprecated
- since 4.5, use resetAllInstances() instead
- See
- \resetAllInstances()


resetAllInstances(
$resetGlobalOverrideDirs
=
true
)
:
void
Reset all eZINI instances as well override dirs ( optional )
Name | Type | Description |
---|---|---|
$resetGlobalOverrideDirs |
- Since
- 4.5


resetGlobalOverrideDirs(
)
:
void
Reset the global override directories with data from {@link eZINI::defaultOverrideDirs()}


resetGlobals(
string $fileName
=
'site.ini', string $rootDir
=
'settings', null | bool $useLocalOverrides
=
null
)
:
void
Resets a specific instance of eZINI.
Name | Type | Description |
---|---|---|
$fileName | string | |
$rootDir | string | |
$useLocalOverrides | null | bool | default system setting if null |
- Deprecated
- since 4.5, use resetInstance() instead
- See
- \resetInstance()


resetInstance(
string $fileName
=
'site.ini', string $rootDir
=
'settings', null | bool $useLocalOverrides
=
null
)
:
void
Resets a specific instance of eZINI.
Name | Type | Description |
---|---|---|
$fileName | string | |
$rootDir | string | |
$useLocalOverrides | null | bool | default system setting if null |
- Since
- 4.5


resetOverrideDirs(
)
:
void
Reset the override directories with data from {@link eZINI::defaultOverrideDirs()}


save(
$fileName
=
false, $suffix
=
false, $useOverride
=
false, $onlyModified
=
false, $useRootDir
=
true, $resetArrays
=
false, $encapsulateInPHP
=
true
)
:
void
Name | Type | Description |
---|---|---|
$fileName | ||
$suffix | ||
$useOverride | ||
$onlyModified | ||
$useRootDir | ||
$resetArrays | ||
$encapsulateInPHP |


saveCache(
string $cachedDir, string $cachedFile, array $data, array $inputFiles, string $iniFile
)
:
bool
Stores the content of the INI object to the cache file \a $cachedFile.
Name | Type | Description |
---|---|---|
$cachedDir | string | Cache dir, usually "var/cache/ini/" |
$cachedFile | string | Name of cache file as returned by cacheFileName() |
$data | array | Configuration data as an associative array structure |
$inputFiles | array | List of input files used as basis for cache (for use in load cache to check mtime) |
$iniFile | string | Ini file path string returned by findInputFiles() for main ini file |
Type | Description |
---|---|
bool |


selectOverrideScope(
string | null $scope, string $identifier, string $dir, string $default
)
:
string
Function to handle bc with code from pre 4.4 that does not know about scopes
Name | Type | Description |
---|---|---|
$scope | string | null | |
$identifier | string | |
$dir | string | |
$default | string |
Type | Description |
---|---|
string |
- Since
- 4.4


setIsCacheEnabled(
bool $enabled
)
:
void
Sets whether caching is enabled for INI files or not. This setting is global and can be overriden in the instance() function.
Name | Type | Description |
---|---|---|
$enabled | bool |
- See
- \isCacheEnabled().


setIsDebugEnabled(
bool $enabled
)
:
void
Sets whether internal debugging is enabled or not. This setting is global and can be overriden in the instance() function.
Name | Type | Description |
---|---|---|
$enabled | bool |
- See
- \isDebugEnabled().


setIsTextCodecEnabled(
bool $enabled
)
:
void
Sets whether textcodec conversion is enabled or not.
Name | Type | Description |
---|---|---|
$enabled | bool |
- See
- \isTextCodecEnabled().


setOverrideDirs(
array $newDirs, string | false $scope
=
false
)
:
void
Set the override directories witch raw override dir data, or within a scope if $scope is set, see {@link eZINI::defaultOverrideDirs()} for how the raw data looks like.
Name | Type | Description |
---|---|---|
$newDirs | array | |
$scope | string | false | See {@link eZINI::defaultOverrideDirs()} for possible scope values |


setVariable(
$blockName, $variableName, $variableValue
)
:
void
Name | Type | Description |
---|---|---|
$blockName | ||
$variableName | ||
$variableValue |