EDG::WP4::CCM::Configuration - Configuration class
$cid = $cfg->getConfigurationId(); $elt = $cfg->getElement($path); $elt = $cfg->getElement($string); $val = $cfg->getValue($path); $val = $cfg->getValue($string); $bool = $cfg->elementExists($path); $bool = $cfg->elementExists($string); $cfg->lock(); $cfg->unlock(); $bool = $cfg->isLocked();
Module provides the Configuration class, to manipulate confgurations.
Create Configuration object. It takes three arguments:
cache_manager: the CacheManager object
cid: the configuration id
locked: boolean lock flag
anonymous: boolean anonymous flag
name_template: name template
If a configuration with specified CID does not exists, an exception is thrown.
lockedflag is set (or when the
lockmethod is called to set it), the Configuration instance is bound to the specific CID, even if this is not the CacheManager's current one (e.g. when a new profile is fetched during the lifetime of the process, the CacheManager current CID is updated to the latest one). The locking is relevant when a
CCM::Elementis accessed via a
CCM::Configurationinstance (in particular, when a call to
_prepareElementis made). As a consequence, an unlocked Configuration instance will always use the CacheManager's current CID.
Unless the anonymous flag is set to true, each process that creates a Configuration instance, creates a file named
$cidthe CID and
$pidthe process ID) under the
profile.$ciddirectory in the
CacheManagercache path. The presence of this file protects the process from getting this particular CID removed by the
ccm-purgecommand (e.g. by the daily purge cron job). If the anonymous flag is set to -1, the permissions of the user to create this file are verified, and if the user can write to this file, the anonymous flag is set to false (this is only verified once during initialisation).
Processes that have no permission to create this file (or don't care about long runtimes), can set the
anonymousflag and use the configuration (at their own risk).
Returns configuration id.
Lock configuration (local lock).
Unlock configuration (local unlock).
Returns true if the configuration is locked, otherwise false
Return the name of the Configuration based on the name template set during initialisation.
name) specifies which name format is used. The actual template used is
Following types are defined
- name: (compact) name
The data used for rendering is the
The rendered text is stripped from any leading and/or trailing whitespace and is added to the
nameattribute, the next
getNamecall will return the cached value.
If no template was set, undef is returned. If there was rendering (or any other) failure, undef is returned and the fail attribute is set.
Returns Element object identified by $path (path may be a string or and object of class Path)
returns value of the element identified by $path
returns true if elements identified by $path exists
getTreeof the element identified by
$path. Any other optional arguments are passed to
If the path does not exist, undef is returned. (Any error reason is set as the
failattribute and the error is ignored.)