PerlDoc

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview


Parent package: Foswiki::Configure
Child packages:

    internal package Foswiki::Configure::Load

    Handling for loading configuration information (Foswiki.spec, Config.spec and LocalSite.cfg) as efficiently and flexibly as possible.

    This reads values from these files and does not parse the structured comments or build a spec database. For that, see LoadSpec.pm

    StaticMethod readConfig([$noexpand][,$nospec][,$config_spec][,$noLocal)

    In normal Foswiki operations as a web server this method is called by the BEGIN block of Foswiki.pm. However, when benchmarking/debugging it can be replaced by custom code which sets the configuration hash. To prevent us from overriding the custom code again, we use an "unconfigurable" key $cfg{ConfigurationFinished} as an indicator.

    Note that this method is called by Foswiki and configure, and normally reads Foswiki.spec to get defaults. Other spec files (those for extensions) are not read unless the $config_spec flag is set.

    The assumption is that configure will be run when an extension is installed, and that will add the config values to LocalSite.cfg, so no defaults are needed. Foswiki.spec is still read because so much of the core code doesn't provide defaults, and it would be silly to have them in two places anyway.

    • $noexpand - suppress expansion of $Foswiki vars embedded in values.
    • $nospec - can be set when the caller knows that Foswiki.spec has already been read.
    • $config_spec - if set, will also read Config.spec files located using the standard methods (iff !$nospec). Slow.
    • $noLocal - if set, Load will not re-read an existing LocalSite.cfg. this is needed when testing the bootstrap. If it rereads an existing config, it overlays all the bootstrapped settings.

    StaticMethod expanded($value) → $expanded

    Given a value of a configuration item, expand references to $Foswiki::cfg configuration items within strings in the value.

    If an embedded $Foswiki::cfg reference is not defined, it will be expanded as 'undef'.

    StaticMethod expandValue($datum [, $mode])

    Expands references to Foswiki configuration items which occur in the values configuration items contained within the datum, which may be a hash or array reference, or a scalar value. The replacement is done in-place.

    $mode - How to handle undefined values:
    • false: 'undef' (string) is returned when an undefined value is encountered.
    • 1 : return if any undefined value is encountered.
    • 2 : return '' for any undefined value (including embedded)
    • 3 : die if an undefined value is encountered.

    StaticMethod findDependencies(\%cfg) → \%deps

    • \%cfg configuration hash to scan; defaults to %Foswiki::cfg

    Recursively locate references to other keys in the values of keys. Returns a hash containing two keys:
    • forward => a hash mapping keys to a list of the keys that depend on their value
    • reverse => a hash mapping keys to a list of keys whose value they depend on.

    StaticMethod specChanged -> @list

    Find all the Spec files (Config.spec and Foswiki.spec) and return a list of extensions with Spec files newer than LocalSite.cfg.

    Topic revision: r1 - 06 Aug 2023, UnknownUser
    This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
    Ideas, requests, problems regarding Foswiki? Send feedback