Kernel::System::SysConfig::DB

NAME

Kernel::System::SysConfig::DB – Functions to manage system configuration settings interactions with the database

METHODS

new()

Create an object. Do not use it directly, instead use:

    use Kernel::System::ObjectManager;
    local $Kernel::OM = Kernel::System::ObjectManager->new();
    my $SysConfigDBObject = $Kernel::OM->Get('Kernel::System::SysConfig::DB');

DefaultSettingAdd()

Add a new SysConfig default entry.

    my $DefaultID = $SysConfigDBObject->DefaultSettingAdd(
        Name                     => "ProductName",                 # (required)
        Description              => "Setting description",         # (required)
        Navigation               => "ASimple::Path::Structure",    # (required)
        IsInvisible              => 1,                             # (optional) 1 or 0, default 0
        IsReadonly               => 0,                             # (optional) 1 or 0, default 0
        IsRequired               => 1,                             # (optional) 1 or 0, default 0
        IsValid                  => 1,                             # (optional) 1 or 0, default 0
        HasConfigLevel           => 200,                           # (optional) default 0
        XMLContentRaw            => $XMLString,                    # (required) the setting XML structure as it is on the config file
        XMLContentParsed         => $XMLParsedToPerl,              # (required) the setting XML structure converted into a Perl structure
        XMLFilename              => 'Framework.xml'                # (required) the name of the XML file
        EffectiveValue           => $SettingEffectiveValue,        # (required) the value as will be stored in the Perl configuration file
        ExclusiveLockExpiryTime  => '2017-02-01 12:23:13',         # (optional) If not provided, method will calculate it.
        UserID                   => 123,
        NoCleanup                => 0,                             # (optional) Default 0. If enabled, system WILL NOT DELETE CACHE. In this case, it must be done manually.
                                                                   #    USE IT CAREFULLY.
    );

Returns:

    my $DefaultID = 123;  # false in case of an error

DefaultSettingBulkAdd()

Add new SysConfig default entries.

    my $Success = $SysConfigDBObject->DefaultSettingBulkAdd(
        Settings => {                                                 # (required) Hash of settings
            "ACL::CacheTTL" => {
                "EffectiveValue" => "--- '3600'\n",
                "XMLContentParsed" => {
                    "Description" => [
                        {
                            "Content" => "Cache time in ...",
                            "Translatable" => 1
                        },
                    ],
                    "Name" => "ACL::CacheTTL",
                    "Navigation" => [
                        {
                            "Content" => "Core::Ticket::ACL"
                        },
                    ],
                    "Required" => 1,
                    "Valid" => 1,
                    "Value" => [
                        {
                            "Item" => [
                                {
                                    "Content" => 3600,
                                    "ValueRegex" => "^\\d+\$",
                                    "ValueType" => "String"
                                },
                            ],
                        },
                    ],
                },
                "XMLContentParsedYAML" => "---\nDescription:\n- Content: Cache...",
                "XMLContentRaw" => "<Setting Name=\"ACL::CacheTTL\" Required=\"1\" ...",
                "XMLFilename" => "Ticket.xml"
            },
            ...
        },
        SettingList => [                                                # list of current settings in DB
            {
                DefaultID         => '123',
                Name              => 'SettingName1',
                IsDirty           => 1,
                ExclusiveLockGUID => 0,
            },
            # ...
        ],
        UserID => 1,                                                    # (required) UserID
    );

DefaultSettingVersionBulkAdd()

    my $Success = $SysConfigDBObject->DefaultSettingVersionBulkAdd(
        Settings => {                                                 # (required) Hash of settings
            "ACL::CacheTTL" => {
                "EffectiveValue" => "--- '3600'\n",
                "XMLContentParsed" => {
                    "Description" => [
                        {
                            "Content" => "Cache time in ...",
                            "Translatable" => 1
                        },
                    ],
                    "Name" => "ACL::CacheTTL",
                    "Navigation" => [
                        {
                            "Content" => "Core::Ticket::ACL"
                        },
                    ],
                    "Required" => 1,
                    "Valid" => 1,
                    "Value" => [
                        {
                            "Item" => [
                                {
                                    "Content" => 3600,
                                    "ValueRegex" => "^\\d+\$",
                                    "ValueType" => "String"
                                },
                            ],
                        },
                    ],
                },
                "XMLContentParsedYAML" => "---\nDescription:\n- Content: Cache...",
                "XMLContentRaw" => "<Setting Name=\"ACL::CacheTTL\" Required=\"1\" ...",
                "XMLFilename" => "Ticket.xml"
            },
            ...
        },
        SettingList => [                                                # list of current settings in DB
            {
                DefaultID         => '123',
                Name              => 'SettingName1',
                IsDirty           => 1,
                ExclusiveLockGUID => 0,
            },
            # ...
        ],
        UserID => 1,                                                    # (required) UserID
    );

DefaultSettingGet()

Get SysConfig default entry.

    my %DefaultSetting = $SysConfigDBObject->DefaultSettingGet(
        Name        => "TheName", # (required) Setting name - prefered parameter.
                                  # or
        DefaultID   => 4,         # (required) DefaultID. Slightly slower execution.
        NoCache     => 0,         # (optional) Default 0. If 1, cache will not be created.
    );

Returns:

    %DefaultSetting = (
        DefaultID                => "123",
        Name                     => "ProductName",
        Description              => "Defines the name of the application ...",
        Navigation               => "ASimple::Path::Structure",
        IsInvisible              => 1,         # 1 or 0
        IsReadonly               => 0,         # 1 or 0
        IsRequired               => 1,         # 1 or 0
        IsValid                  => 1,         # 1 or 0
        HasConfigLevel           => 200,
        XMLContentRaw            => "The XML structure as it is on the config file",
        XMLContentParsed         => "XML parsed to Perl",
        XMLFilename              => "Framework.xml",
        EffectiveValue           => "Product 6",
        IsDirty                  => 1,         # 1 or 0
        ExclusiveLockGUID        => 'A32CHARACTERLONGSTRINGFORLOCKING',
        ExclusiveLockUserID      => 1,
        ExclusiveLockExpiryTime  => '2016-05-29 11:09:04',
        CreateTime               => "2016-05-29 11:04:04",
        CreateBy                 => 1,
        ChangeTime               => "2016-05-29 11:04:04",
        ChangeBy                 => 1,
        SettingUID               => 'Default12320160529110404',
    );

DefaultSettingLookup()

Default setting lookup.

    my %Result = $SysConfigDBObject->DefaultSettingLookup(
        Name        => "TheName", # (required)
                                  # or
        DefaultID   => 4,         # (required)
    );

Returns:

    %Result = (
        DefaultID      => 4,
        Name           => 'TheName',
    );

DefaultSettingDelete()

Delete a default setting from the database.

    my $Success = $SysConfigDBObject->DefaultSettingDelete(
        DefaultID => 123,
    );

    my $Success = $SysConfigDBObject->DefaultSettingDelete(
        Name => 'Name',
    );

Returns:

    $Success = 1;       # or false in case of an error

DefaultSettingUpdate()

Update SysConfig default entry.

    my $Success = $SysConfigDBObject->DefaultSettingUpdate(
        DefaultID                => 123,
        Name                     => "ProductName",
        Description              => "Defines the name of the application ...",
        Navigation               => "ASimple::Path::Structure",
        IsInvisible              => 1,             # 1 or 0, optional, default 0
        IsReadonly               => 0,             # 1 or 0, optional, default 0
        IsRequired               => 1,             # 1 or 0, optional, default 0
        IsValid                  => 1,             # 1 or 0, optional, default 0
        HasConfigLevel           => 200,           # optional, default 0
        XMLContentRaw            => $XMLString,    # the XML structure as it is on the config file
        XMLContentParsed         => $XMLParsedToPerl,
        XMLFilename              => 'Framework.xml',
        ExclusiveLockGUID        => 1,
        EffectiveValue           => $SettingEffectiveValue,
        UserID                   => 1,
    );

Returns:

    $Success = 1;   # or false in case of an error.

DefaultSettingSearch()

Search for settings which contains given term(Search) in the xml_content_raw column.

    my @Result = $SysConfigDBObject->DefaultSettingSearch(
        Search          => 'Entity',                              # Search term
        SearchType      => 'XMLContent',                          # XMLContent or Metadata
        CategoryFiles   => ['Framework.xml', 'Ticket.xml', ],     # (optional)
        Valid           => 0,                                     # (optional) By default, system returns all Settings (valid and invalid)
                                                                  #   if set to 1, search only for valid,
                                                                  #   if set to 0, search also for invalid.
        IncludeInvisible => 0,                                    # (optional) Default 0
    );

or

    my @Result = $SysConfigDBObject->DefaultSettingSearch(
        Search         => ['Framework.xml' 'Ticket,xml'],
        SearchType     => 'Filename',
        Valid          => 1,
    );

Returns:

    @Result = (
        'ACL::CacheTTL',
        'ACLKeysLevel1Change',
        ...
    );

DefaultSettingListGet()

Get default setting list with complete data.

    my @List = $SysConfigDBObject->DefaultSettingListGet(
        IsInvisible              => 1,                                  # 1 or 0
        IsReadonly               => 0,                                  # 1 or 0
        IsRequired               => 1,                                  # 1 or 0
        IsValid                  => 1,                                  # 1 or 0
        IsDirty                  => 1,                                  # 1 or 0
        HasConfigLevel           => 0,                                  # 1 or 0
        Navigation               => 'ASimple::Path::Structure',
        Locked                   => 1, # check for locked settings
        Category                 => 'OTRS',                         # optional (requires CategoryFiles)
        CategoryFiles            => ['Framework.xml', 'Ticket.xml', ],  # optional (requires Category)
        NoCache                  => 0,                                  # (optional) Default 0. If set, system will not generate cache.
    );

Returns:

    @List = (
        {
            DefaultID                => 123,
            Name                     => "ProductName",
            Description              => "Defines the name of the application ...",
            Navigation               => "ASimple::Path::Structure",
            IsInvisible              => 1,
            IsReadonly               => 0,
            IsRequired               => 1,
            IsValid                  => 1,
            HasConfigLevel           => 200,
            XMLContentRaw            => "The XML structure as it is on the config file",
            XMLContentParsed         => "XML parsed to Perl",
            XMLFilename              => "Framework.xml",
            EffectiveValue           => "Product 6",
            IsDirty                  => 1,       # 1 or 0
            ExclusiveLockGUID        => 'A32CHARACTERLONGSTRINGFORLOCKING',
            ExclusiveLockUserID      => 1,
            ExclusiveLockExpiryTime  => '2016-05-29 11:09:04',
            CreateTime               => "2016-05-29 11:04:04",
            CreateBy                 => 1,
            ChangeTime               => "2016-05-29 11:04:04",
            ChangeBy                 => 1,
            SettingUID               => 'Default4717141789',
        },
        {
            DefaultID => 321,
            Name      => 'FieldName',
            # ...
            ChangeTime => '2011-01-01 01:01:01',
            ChangeBy                 => 1,
            SettingUID               => 'Default4717141781',
        },
        # ...
    );

DefaultSettingList()

Get list of all settings.

    my @DefaultSettings = $SysConfigDBObject->DefaultSettingList(
        IncludeInvisible => 0,   # (optional) Include invisible. Default 0.
        IsDirty          => 0,   # (optional) Filter settings by IsDirty. If not provided, returns all settings.
        Locked           => 0,   # (optional) Filter locked settings.
    );

Returns:

    @DefaultSettings = (
        {
            DefaultID         => '123',
            Name              => 'SettingName1',
            IsDirty           => 1,
            IsVisible         => 1,
            ExclusiveLockGUID => 0,
            XMLFilename       => 'Filename.xml',
        },
        {
            DefaultID         => '124',
            Name              => 'SettingName2',
            IsDirty           => 0,
            IsVisible         => 1,
            ExclusiveLockGUID => 'fjewifjowj...',
            XMLFilename       => 'Filename.xml',
        },
        ...
    );

DefaultSettingLock()

Lock Default setting(s) to the particular user.

    my $ExclusiveLockGUID = $SysConfigDBObject->DefaultSettingLock(
        DefaultID => 1,                     # the ID of the setting that needs to be locked
                                            #    or
        Name      => 'SettingName',         # the Name of the setting that needs to be locked
                                            #    or
        LockAll   => 1,                     # system locks all settings.
        Force     => 1,                     # (optional) Force locking (do not check if it's already locked by another user). Default: 0.
        UserID    => 1,                     # (required)
    );

Returns:

    $ExclusiveLockGUID = 'azzHab72wIlAXDrxHexsI5aENsESxAO7';     # Setting locked

    or

    $ExclusiveLockGUID = undef;     # Not locked

DefaultSettingIsLocked()

Check if particular Default Setting is locked.

    my $Locked = $SysConfigDBObject->DefaultSettingIsLocked(
        DefaultID     => 1,                 # the ID of the setting that needs to be checked
                                        #   or
        Name          => 'SettingName',     # the Name of the setting that needs to be checked
        GetLockUserID => 1,                 # optional, it will return the ExclusiveLockUserID in case it exist
    );

Returns:

    $Locked = 1;    # Locked
    or
    $Locked = 123   # The UserID

DefaultSettingIsLockedByUser()

Check if particular Default Setting is locked.

    my $LockedByUser = $SysConfigDBObject->DefaultSettingIsLockedByUser(
        DefaultID             => 1,                 # the ID of the setting that needs to be checked
                                                    #   or
        Name                  => 'SettingName',     # the name of the setting that needs to be checked
        ExclusiveLockUserID   => 2,                 # the user should have locked the setting
        ExclusiveLockGUID     => 'AGUIDSTRING',     # the GUID used to locking the setting
    );

Returns:

    $LockedByUser = 1;

DefaultSettingUnlock()

Unlock particular or all Default Setting(s).

    my $Success = $SysConfigDBObject->DefaultSettingUnlock(
        DefaultID => 1,                     # the ID of the setting that needs to be unlocked
                                            #   or
        Name      => 'SettingName',         # the name of the setting that needs to be locked
                                            #   or
        UnlockAll => 1,                     # unlock all settings
    );

Returns:

    $Success = 1;

DefaultSettingDirtyCleanUp()

Removes the IsDirty flag from default settings.

    my $Success = $SysConfigDBObject->DefaultSettingDirtyCleanUp(
        AllSettings => 0,   # (default 0) Reset all dirty settings.
    );

Returns:

    $Success = 1;       # or false in case of an error

DefaultSettingVersionAdd()

Add a new SysConfig default version entry.

    my $DefaultVersionID = $SysConfigDBObject->DefaultSettingVersionAdd(
        DefaultID                => 456,
        Name                     => "ProductName",
        Description              => "Defines the name of the application ...",
        Navigation               => "ASimple::Path::Structure",
        IsInvisible              => 1,                             # 1 or 0, optional, default 0
        IsReadonly               => 0,                             # 1 or 0, optional, default 0
        IsRequired               => 1,                             # 1 or 0, optional, default 0
        IsValid                  => 1,                             # 1 or 0, optional, default 0
        HasConfigLevel           => 200,                           # optional, default 0
        XMLContentRaw            => $XMLString,                    # the XML structure as it is on the config file
        XMLContentParsed         => $XMLParsedToPerl,              # the setting XML structure converted into YAML
        XMLFilename              => 'Framework.xml'                # the name of the XML file
        EffectiveValue           => $YAMLEffectiveValue,           # YAML EffectiveValue
        UserID                   => 1,
        NoCleanup                => 0,                             # (optional) Default 0. If enabled, system WILL NOT DELETE CACHE. In this case, it must be done manually.
                                                                   #    USE IT CAREFULLY.
        NoVersionID              => 1,                             # 1 or 0, optional, default 0, prevents the return of DefaultVersionID and returns only 1 in case of success.
    );

Returns:

    my $DefaultVersionID = 123;  # false in case of an error

DefaultSettingVersionGet()

Get SysConfig default version entry.

    my %DefaultSettingVersion = $SysConfigDBObject->DefaultSettingVersionGet(
        DefaultVersionID => 123,
    );

Returns:

    %DefaultSettingVersion = (
        DefaultVersionID         => 123,
        DefaultID                => 456,
        Name                     => "ProductName",
        Description              => "Defines the name of the application ...",
        Navigation               => "ASimple::Path::Structure",
        IsInvisible              => 1,         # 1 or 0
        IsReadonly               => 0,         # 1 or 0
        IsRequired               => 1,         # 1 or 0
        IsValid                  => 1,         # 1 or 0
        HasConfigLevel           => 200,
        XMLContentRaw            => "The XML structure as it is on the config file",
        XMLContentParsed         => "XML parsed to Perl",
        XMLFilename              => 'Framework.xml',
        EffectiveValue           => "Product 6",
        CreateTime               => "2016-05-29 11:04:04",
        CreateBy                 => 44,
        ChangeTime               => "2016-05-29 11:04:04",
        ChangeBy                 => 88,
    );

DefaultSettingVersionDelete()

Delete a default setting version from list based on default version ID or default ID.

    my $Success = $SysConfigDBObject->DefaultSettingVersionDelete(
        DefaultVersionID => 123,
    );

or

    my $Success = $SysConfigDBObject->DefaultSettingVersionDelete(
        DefaultID => 45,
    );

or

    my $Success = $SysConfigDBObject->DefaultSettingVersionDelete(
        Name => 'AnyName',
    );

Returns:

    $Success = 1;       # or false in case of an error

DefaultSettingVersionGetLast()

Get last deployment.

    my %DefaultSettingVersionGetLast = $SysConfigDBObject->DefaultSettingVersionGetLast(
        DefaultID => 456,
    );

Returns:

    %DefaultSettingVersion = (
        DefaultVersionID         => 123,
        DefaultID                => 456,
        Name                     => "ProductName",
        Description              => "Defines the name of the application ...",
        Navigation               => "ASimple::Path::Structure",
        IsInvisible              => 1,         # 1 or 0
        IsReadonly               => 0,         # 1 or 0
        IsRequired               => 1,         # 1 or 0
        IsValid                  => 1,         # 1 or 0
        HasConfigLevel           => 200,
        XMLContentRaw            => "The XML structure as it is on the config file",
        XMLContentParsed         => "XML parsed to Perl",
        XMLFilename              => 'Framework.xml',
        EffectiveValue           => "Product 6",
        CreateTime               => "2016-05-29 11:04:04",
        ChangeTime               => "2016-05-29 11:04:04",
    );

DefaultSettingVersionListGet()

Get version setting list with complete data.

    my @List = $SysConfigDBObject->DefaultSettingVersionListGet(
        Name       => 'SettingName',      # optional
                                          # or
        DefaultID  => 123,                # optional
    );

Returns:

    @List = (
        {
            DefaultVersionID         => 123,
            DefaultID                => 456,
            Name                     => "ProductName",
            Description              => "Defines the name of the application ...",
            Navigation               => "ASimple::Path::Structure",
            IsInvisible              => 1,          # 1 or 0
            IsReadonly               => 0,          # 1 or 0
            IsRequired               => 1,          # 1 or 0
            IsValid                  => 1,          # 1 or 0
            HasConfigLevel           => 200,
            XMLContentRaw            => "The XML structure as it is on the config file",
            XMLContentParsed         => "XML parsed to Perl",
            XMLFilename              => 'Framework.xml',
            EffectiveValue           => "Product 6",
            CreateTime               => "2016-05-29 11:04:04",
            ChangeTime               => "2016-05-29 11:04:04",
        },
        {
            DefaultVersionID => 321,
            DefaultID        => 890,
            Name             => 'FieldName',
            # ...
            CreateTime => '2010-09-11 10:08:00',
            ChangeTime => '2011-01-01 01:01:01',
        },
        # ...
    );

ModifiedSettingAdd()

Add a new SysConfig modified entry.

    my $ModifiedID = $SysConfigDBObject->ModifiedSettingAdd(
        DefaultID                   => 456,
        Name                        => "ProductName",
        IsValid                     => 1,                             # 1 or 0, optional (uses the value from DefaultSetting if not defined)
        ResetToDefault              => 0,                             # 1 or 0, optional, modified 0
        EffectiveValue              => $SettingEffectiveValue,
        ExclusiveLockGUID           => $LockingString,                # the GUID used to lock the setting
        DeploymentExclusiveLockGUID => $LockingString,                # the GUID used to lock the deployment (in case of deployment failure)
        UserID                      => 1,
    );

Returns:

    my $ModifiedID = 123;  # false in case of an error

ModifiedSettingGet()

Get SysConfig modified value.

    my %ModifiedSetting = $SysConfigDBObject->ModifiedSettingGet(
        ModifiedID            => 123,               # ModifiedID or NAME are required.
        Name                  => 'Setting::Name',
    );

Returns:

    %ModifiedSetting = (
        ModifiedID             => "123",
        DefaultID              => 456,
        Name                   => "ProductName",
        IsValid                => 1,     # 1 or 0, optional, modified 0
        IsDirty                => 1,     # 1 or 0, optional, modified 0
        ResetToDefault         => 1,     # 1 or 0, optional, modified 0
        EffectiveValue         => $SettingEffectiveValue,
        CreateTime             => "2016-05-29 11:04:04",
        CreateBy               => 1,
        ChangeTime             => "2016-05-29 11:04:04",
        ChangeBy               => 1,
        SettingUID             => 'Modified12320160529110404',
    );

ModifiedSettingListGet()

Get modified setting list with complete data.

    my @List = $SysConfigDBObject->ModifiedSettingListGet(
        IsInvisible            => 1,                 # 1 or 0
        IsReadonly             => 0,                 # 1 or 0
        IsRequired             => 1,                 # 1 or 0
        IsValid                => 1,                 # 1 or 0
        IsDirty                => 1,                 # 1 or 0
        ResetToDefault         => 1,                 # 1 or 0
        HasConfigLevel         => 0,                 # 1 or 0
        Name                   => 'ACL::CacheTTL',   # setting name
        ChangeBy               => 123,
    );

Returns:

    @List = (
        {
            ModifiedID              => 123,
            Name                    => "ProductName",
            Description             => "Defines the name of the application ...",
            Navigation              => "ASimple::Path::Structure",
            IsInvisible             => 1,
            IsReadonly              => 0,
            IsRequired              => 1,
            IsValid                 => 1,
            ResetToDefault         => 1,                 # 1 or 0
            HasConfigLevel          => 200,
            XMLContentRaw           => "The XML structure as it is on the config file",
            XMLContentParsed        => "XML parsed to Perl",
            EffectiveValue          => "Product 6",
            IsDirty                 => 1,       # 1 or 0
            ExclusiveLockGUID       => 'A32CHARACTERLONGSTRINGFORLOCKING',
            ExclusiveLockUserID     => 1,
            ExclusiveLockExpiryTime => '2016-05-29 11:09:04',
            CreateTime              => "2016-05-29 11:04:04",
            ChangeTime              => "2016-05-29 11:04:04",
        },
        {
            ModifiedID => 321,
            Name       => 'FieldName',
            # ...
            CreateTime => '2010-09-11 10:08:00',
            ChangeTime => '2011-01-01 01:01:01',
        },
        # ...
    );

ModifiedSettingDelete()

Delete a modified setting from list.

    my $Success = $SysConfigDBObject->ModifiedSettingDelete(
        ModifiedID => 123,
    );

Returns:

    $Success = 1;       # or false in case of an error

ModifiedSettingUpdate()

Update SysConfig modified.

    my $Success = $SysConfigDBObject->ModifiedSettingUpdate(
        ModifiedID             => 123,                           # (required)
        DefaultID              => 456,                           # (required)
        Name                   => "ProductName",                 # (required)
        IsValid                => 1,                             # (optional) 1 or 0, optional (uses the value from DefaultSetting if not defined)
        IsDirty                => 1,                             # (optional) Default 1.
        ResetToDefault         => 1,                             # (optional), default 0
        EffectiveValue         => $SettingEffectiveValue,
        ExclusiveLockGUID      => $LockingString,                # the GUID used to locking the setting
        UserID                 => 1,                             # (required)
    );

Returns:

    $Success = 1;   # or false in case of an error

ModifiedSettingDirtyCleanUp()

Removes the IsDirty flag from modified settings.

    my $Success = $SysConfigDBObject->ModifiedSettingDirtyCleanUp(
        ModifiedIDs     => [        # (optional) applies to only this list of settings
            123,
            456,
        ],
    );

Returns:

    $Success = 1;       # or false in case of an error

ModifiedSettingVersionAdd()

Add a new SysConfig modified version entry.

    my $ModifiedVersionID = $SysConfigDBObject->ModifiedSettingVersionAdd(
        DefaultVersionID       => 456,
        Name                   => "ProductName",
        IsValid                => 1,                             # 1 or 0, optional, optional 0
        EffectiveValue         => $SettingEffectiveValue,        # the value as will be stored in the Perl configuration file
        DeploymentTimeStamp    => '2015-12-12 12:00:00',         # unique timestamp per deployment
        ResetToDefault         => 1,                             # optional, default 0
        UserID                 => 1,
    );

Returns:

    my $ModifiedVersionID = 123;  # false in case of an error

ModifiedSettingVersionGet()

Get SysConfig modified version entry.

    my %ModifiedSettingVersion = $SysConfigDBObject->ModifiedSettingVersionGet(
        ModifiedVersionID => 123,
    );

Returns:

    %ModifiedSetting = (
        ModifiedVersionID      => 123,
        DefaultVersionID       => 456,
        Name                   => "ProductName",
        IsValid                => 1,         # 1 or 0
        ResetToDefault         => 1,         # 1 or 0
        EffectiveValue         => "Product 6",
        CreateTime             => "2016-05-29 11:04:04",
        ChangeTime             => "2016-05-29 11:04:04",
    );

ModifiedSettingVersionListGet()

Get version setting list with complete data.

    my @List = $SysConfigDBObject->ModifiedSettingVersionListGet(
        Name              => 1, # optional
        DefaultVersionID  => 230, # optional
    );

Returns:

    @List = (
        {
            ModifiedVersionID      => 123,
            ModifiedID             => 456,
            Name                   => "ProductName",
            IsValid                => 1,         # 1 or 0
            ResetToDefault         => 1,         # 1 or 0
            EffectiveValue         => "Product 6",
            CreateTime             => "2016-05-29 11:04:04",
            ChangeTime             => "2016-05-29 11:04:04",
        },
        {
            ModifiedVersionID      => 789,
            ModifiedID             => 579,
            Name                   => "ADifferentProductName",
            IsValid                => 1,         # 1 or 0
            ResetToDefault         => 1,         # 1 or 0
            . . .
        },
        # ...
    );

ModifiedSettingVersionGetLast()

Get last deployment.

    my %ModifiedSettingVersion = $SysConfigDBObject->ModifiedSettingVersionGetLast(
        Name => 'ProductName',
    );

Returns:

    %ModifiedSettingVersion = (
        DefaultVersionID       => 123,
        ModifiedID             => 456,
        Name                   => "ProductName",
        IsValid                => 1,         # 1 or 0
        ResetToDefault         => 1,         # 1 or 0
        EffectiveValue         => "Product 6",
        CreateTime             => "2016-05-29 11:04:04",
        ChangeTime             => "2016-05-29 11:04:04",
    );

ModifiedSettingVersionListGetLast()

Get a list of the last deployed version of each modified SysConfig setting

    my @List = $SysConfigDBObject->ModifiedSettingVersionListGetLast();

Returns:

    @List = (
        {
            ModifiedVersionID      => 123,
            ModifiedID             => 456,
            Name                   => "ProductName",
            IsValid                => 1,         # 1 or 0
            ResetToDefault         => 1,         # 1 or 0
            EffectiveValue         => "Product 6",
            CreateTime             => "2016-05-29 11:04:04",
            ChangeTime             => "2016-05-29 11:04:04",
        },
        {
            ModifiedVersionID      => 789,
            ModifiedID             => 579,
            Name                   => "ADifferentProductName",
            IsValid                => 1,         # 1 or 0
            ResetToDefault         => 1,         # 1 or 0
            . . .
        },
        # ...
    );

ModifiedSettingVersionDelete()

Delete a modified setting version from list based on modified version ID or modified ID.

    my $Success = $SysConfigDBObject->ModifiedSettingVersionDelete(
        ModifiedVersionID => 123,
    );

or

    my $Success = $SysConfigDBObject->ModifiedSettingVersionDelete(
        ModifiedID => 45,
    );

or

    my $Success = $SysConfigDBObject->ModifiedSettingVersionDelete(
        Name => 'AnyName',
    );

Returns:

    $Success = 1;       # or false in case of an error

ConfigurationIsDirty()

Check if there are not deployed changes on system configuration.

    my $Result = $SysConfigDBObject->ConfigurationIsDirty(
        UserID => 123,      # optional, the user that changes a modified setting
    );

Returns:

    $Result = 1;    # or 0 if configuration is not dirty.

DeploymentAdd()

Adds a new deployment.

    my $DeploymentID = $SysConfigDBObject->DeploymentAdd(
        Comments            => 'Some Comments',              # optional
        EffectiveValueStrg  => $EffectiveValuesStrgRef,      # string reference with the value of all settings,
                                                             #   to be stored in a Perl cache file
        ExclusiveLockGUID   => $LockingString,               # the GUID used to locking the deployment
        DeploymentTimeStamp => '1977-12-12 12:00:00',
        UserID              => 123,
    );

Returns:

    $DeploymentID = 123;        # or false in case of an error

DeploymentGet()

Gets deployment information.

    my %Deployment = $SysConfigDBObject->DeploymentGet(
        DeploymentID   => 123,
        DeploymentUUID => '14906327941360ed8455f125d0450277',
    );

Returns:

    %Deployment = (
        DeploymentID       => 123,
        DeploymentUUID     => '14906327941360ed8455f125d0450277',
        Comments           => 'Some Comments',
        EffectiveValueStrg => $SettingEffectiveValues,      # string with the value of all settings,
                                                            #   as seen in the Perl configuration file.
        CreateTime         => '2016-05-29 11:04:04',
        CreateBy           => 123,
    );

DeploymentListGet()

Get global deployment list with complete data.

    my @List = $SysConfigDBObject->DeploymentListGet();

Returns:

    @List = (
        {
            DeploymentID       => 123,
            DeploymentUUID     => 14906327941360ed8455f125d0450277,
            Comments           => 'Some Comments',
            EffectiveValueStrg => $SettingEffectiveValues,      # String with the value of all settings,
                                                                #   as seen in the Perl configuration file.
            CreateTime         => "2016-05-29 11:04:04",
            CreateBy           => 123,
        },
        {
            DeploymentID       => 456,
            DeploymentUUID     => 14906327941360ed8455f125d0450288,
            Comments           => 'Some Comments',
            EffectiveValueStrg => $SettingEffectiveValues2,     # String with the value of all settings,
                                                                #   as seen in the Perl configuration file.
            CreateTime         => "2016-05-29 12:00:01",
            CreateBy           => 123,
        },
        # ...
    );

DeploymentGetLast()

Get last global deployment.

    my %Deployment = $SysConfigDBObject->DeploymentGetLast();

Returns:

    %Deployment = (
        DeploymentID       => 123,
        DeploymentUUID     => 14906327941360ed8455f125d0450277,
        Comments           => 'Some Comments',
        EffectiveValueStrg => $SettingEffectiveValues,      # String with the value of all settings,
                                                            #   as seen in the Perl configuration file.
        CreateTime         => "2016-05-29 11:04:04",
        CreateBy           => 123,
    );

DeploymentDelete()

Delete a deployment from the database.

    my $Success = $SysConfigDBObject->DeploymentDelete(
        DeploymentID => 123,
    );

Returns:

    $Success = 1;       # or false in case of an error

DeploymentLock()

Lock global deployment to a particular user.

    my $ExclusiveLockGUID = $SysConfigDBObject->DeploymentLock(
        UserID            => 123,
        ExclusiveLockGUID => $LockingString,    # optional (if specific GUID is needed)
        Force             => 1,                 # Optional, locks the deployment even if is already
                                                #   locked to another user, also removes locks for
                                                #   all settings.
    );

Returns:

    $ExclusiveLockGUID = 'SomeLockingString';   # or false in case of an error or already locked

DeploymentIsLocked()

Check if global deployment is locked.

    my $Locked = $SysConfigDBObject->DeploymentIsLocked();

Returns:

   $Locked = 1;     # or false if it is not locked

DeploymentIsLockedByUser()

Check if global deployment is locked for a determined user.

    my $LockedByUser = $SysConfigDBObject->DeploymentIsLockedByUser(
        ExclusiveLockGUID => $LockingString,    # the GUID used to locking the deployment
        UserID            => 123,               # the user should have locked the deployment
    );

Returns:

    $LockedByUser = 'SomeLockingString';    # or false in case of not locked

DeploymentModifiedVersionList()

Return a list of modified versions for a global deployment based on the deployment time. Limited to a particular deployment or including also all previous deployments

    my %ModifiedVersionList = $SysConfigDBObject->DeploymentModifiedVersionList(
        DeploymentID => 123,        # the deployment id
        Mode         => 'Equals'    # (optional) default 'Equals'
                                    #   Equals: only the settings from the given deployment
                                    #   GreaterThan: only the settings after the given deployment
                                    #   GreaterThanEquals: includes the settings of the given deployment and after
                                    #   SmallerThan: only the settings before the given deployment
                                    #   SmallerThanEquals: includes the settings of the given deployment and before
    );

Returns:

    %ModifiedVersionIDs = (
        123 => 'Setting1',
        124 => 'Setting2',
        125 => 'Setting3'
    );

DeploymentUnlock()

Unlock global deployment.

    my $Success = $SysConfigDBObject->DeploymentUnlock(
        ExclusiveLockGUID => '12ad34f21b',
        UserID            => 123,
    );

or

    my $Success = $SysConfigDBObject->DeploymentUnlock(
        All  => 1,
    );

Returns:

    $Success = 1;       # or false in case of an error

PRIVATE METHODS

_DeploymentLockGet()

Get deployment lock entry.

    my %DeploymentLock = $SysConfigDBObject->_DeploymentLockGet();

Returns:

    %DeploymentLock = (
        DeploymentLoclID        => "123",
        ExclusiveLockGUID       => $LockingString,
        ExclusiveLockUserID     => 1,
        ExclusiveLockExpiryTime => '2016-05-29 11:09:04',
        CreateTime              => "2016-05-29 11:04:04",
    );

_BulkInsert()

Add batch entries to the DB into a given table.

    my $Success = $SysConfigDBObject->_BulkInsert(
        Table   => 'table_name',    # (required) Table name
        Columns => [                # (required) Array of column names
            'column_name',
            ...
        ],
        Data    => [                # (required) AoA with data
            [
                'record 1',
                'record 2',
            ],
            [
                ...
            ],
            ...
        ],
    );
Scroll to Top