Kernel::System::SysConfig - Functions to manage system configuration settings.
All functions to manage system configuration settings.
Don't use the constructor directly, use the ObjectManager instead:
my $SysConfigObject = $Kernel::OM->Get('Kernel::System::SysConfig');
Get SysConfig setting attributes.
my %Setting = $SysConfigObject->SettingGet( Name => 'Setting::Name', # (required) Setting name Default => 1, # (optional) Returns the default setting attributes only ModifiedID => '123', # (optional) Get setting value for given ModifiedID. TargetUserID => 1, # (optional) Get setting value for specific user. Deployed => 1, # (optional) Get deployed setting value. Default 0. OverriddenInXML => 1, # (optional) Consider changes made in perl files. Default 0. Translate => 1, # (optional) Translate translatable strings in EffectiveValue. Default 0. NoLog => 1, # (optional) Do not log error if a setting does not exist. NoCache => 1, # (optional) Do not create cache. UserID => 1, # Required only if OverriddenInXML is set. );
Returns:
%Setting = ( DefaultID => 123, ModifiedID => 456, # optional 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 IsModified => 1, # 1 or 0 IsValid => 1, # 1 or 0 HasConfigLevel => 200, UserModificationPossible => 0, # 1 or 0 UserModificationActive => 0, # 1 or 0 UserPreferencesGroup => 'Advanced', # optional 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, DefaultValue => 'Old default value', OverriddenFileName => '/opt/otrs/Kernel/Config/Files/ZZZ.pm', );
Update an existing SysConfig Setting.
my %Result = $SysConfigObject->SettingUpdate( Name => 'Setting::Name', # (required) setting name IsValid => 1, # (optional) 1 or 0, modified 0 EffectiveValue => $SettingEffectiveValue, # (optional) UserModificationActive => 0, # (optional) 1 or 0, modified 0 TargetUserID => 2, # (optional) ID of the user for which the modified setting is meant, # leave it undef for global changes. ExclusiveLockGUID => $LockingString, # the GUID used to locking the setting UserID => 1, # (required) UserID NoValidation => 1, # (optional) no value type validation. );
Returns:
%Result = ( Success => 1, # or false in case of an error Error => undef, # error message );
Lock setting(s) to the particular user.
my $ExclusiveLockGUID = $SysConfigObject->SettingLock( 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
Unlock particular or all Setting(s).
my $Success = $SysConfigObject->SettingUnlock( 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;
Check setting lock status.
my %Result = $SysConfigObject->SettingLockCheck( DefaultID => 1, # the ID of the setting that needs to be checked ExclusiveLockGUID => 1, # lock GUID ExclusiveLockUserID => 1, # UserID );
Returns:
%Result = ( Locked => 1, # lock status; # 0 - unlocked # 1 - locked to another user # 2 - locked to provided user User => { # User data, provided only if Locked = 1 UserLogin => ..., UserFirstname => ..., UserLastname => ..., ... }, );
Calculate effective value for a given parsed XML structure.
my $Result = $SysConfigObject->SettingEffectiveValueGet( Translate => 1, # (optional) Translate translatable strings. Default 0. Value => [ # (required) parsed XML structure { 'Item' => [ { 'ValueType' => 'String', 'Content' => '3600', 'ValueRegex' => '' }, ], }, Objects => { Select => { ... }, PerlModule => { ... }, # ... } ]; );
Returns:
$Result = '3600';
Wrapper for Kernel::Output::HTML::SysConfig::SettingRender() - Returns the specific HTML for the setting.
my $HTMLStr = $SysConfigObject->SettingRender( Setting => { Name => 'Setting Name', XMLContentParsed => $XMLParsedToPerl, EffectiveValue => "Product 6", # or a complex structure DefaultValue => "Product 5", # or a complex structure IsAjax => 1, # (optional) is AJAX request. Default 0. # ... }, RW => 1, # (optional) Allow editing. Default 0. );
Returns:
$HTMLStr = '<div class="Setting"><div class "Field"...</div></div>' # or false in case of an error
Wrapper for Kernel::Output::HTML::SysConfig::SettingAddItem() - Returns response that is sent when user adds new array/hash item.
my %Result = $SysConfigObject->SettingAddItem( SettingStructure => [], # (required) array that contains structure # where a new item should be inserted (can be empty) Setting => { # (required) Setting hash (from SettingGet()) 'DefaultID' => '8905', 'DefaultValue' => [ 'Item 1', 'Item 2' ], 'Description' => 'Simple array item(Min 1, Max 3).', 'Name' => 'TestArray', ... }, Key => 'HashKey', # (optional) hash key IDSuffix => '_Array3, # (optional) suffix that will be added to all input/select fields # (it is used in the JS on Update, during EffectiveValue calculation) Value => [ # (optional) Perl structure { 'Array' => [ 'Item' => [ { 'Content' => 'Item 1', }, ... ], ], }, ], AddSettingContent => 0, # (optional) if enabled, result will be inside of div with class "SettingContent" );
Returns:
%Result = ( 'Item' => '<div class=\'SettingContent\'> <input type=\'text\' id=\'TestArray_Array4\' value=\'Default value\' name=\'TestArray\' class=\' Entry\'/></div>', ); or %Result = ( 'Error' => 'Error description', );
Checks which settings has been updated from provided Setting list and returns updated values.
my @List = $SysConfigObject->SettingsUpdatedList( Settings => [ # (required) List of settings that needs to be checked { SettingName => 'SettingName', ChangeTime => '2017-01-13 11:23:07', IsLockedByAnotherUser => 0, }, ... ], UserID => 1, # (required) Current user id );
Returns:
@List = [ { ChangeTime => '2017-01-07 11:29:38', IsLockedByAnotherUser => 1, IsModified => 1, SettingName => 'SettingName', }, ... ];
Check if provided EffectiveValue matches structure defined in DefaultSetting. Also returns EffectiveValue that might be changed.
my %Result = $SysConfigObject->SettingEffectiveValueCheck( EffectiveValue => 'open', # (optional) XMLContentParsed => { # (required) Value => [ { 'Item' => [ { 'Content' => "Scalar value", }, ], }, ], }, StoreCache => 1, # (optional) Store result in the Cache. Default 0. SettingUID => 'Default1234' # (required if StoreCache) NoValidation => 1, # (optional) no value type validation. CurrentSystemTime => 1507894796935, # (optional) Use provided 1507894796935, otherwise calculate ExpireTime => 1507894896935, # (optional) Use provided ExpireTime for cache, otherwise calculate UserID => 1, # (required) UserID );
Returns:
%Result = ( EffectiveValue => 'closed', # Note that resulting effective value can be different Success => 1, Error => undef, );
Reset the modified value to the default value.
my $Result = $SysConfigObject->SettingReset( Name => 'Setting Name', # (required) Setting name TargetUserID => 2, # (optional) UserID for settings in AgentPreferences # or ExclusiveLockGUID => $LockingString, # (optional) the GUID used to locking the setting UserID => 1, # (required) UserID that creates modification );
Returns:
$Result = 1; # or false in case of an error
Returns a hash with all settings and translated metadata.
my %Result = $SysConfigObject->ConfigurationTranslatedGet();
Returns:
%Result = ( 'ACL::CacheTTL' => { 'Category' => 'OTRS', 'IsInvisible' => '0', 'Metadata' => "ACL::CacheTTL--- '3600' Cache-Zeit in Sekunden f\x{fc}r Datenbank ACL-Backends.", ... );
Returns path structure for given navigation group.
my @Path = $SysConfigObject->SettingNavigationToPath( Navigation => 'Frontend::Agent::ToolBarModule', # (optional) );
Returns:
@Path = ( { 'Value' => 'Frontend', 'Name' => 'Frontend', }, { 'Value' => 'Frontend::Agent', 'Name' => 'Agent', }, ... );
Returns a unique list of all translatable strings from the default settings.
my @TranslatableStrings = $SysConfigObject->ConfigurationTranslatableStrings();
Get all entities that are referred in any enabled Setting in complete SysConfig.
my %Result = $SysConfigObject->ConfigurationEntitiesGet();
Returns:
%Result = ( 'Priority' => { '3 normal' => [ 'Ticket::Frontend::AgentTicketNote###PriorityDefault', 'Ticket::Frontend::AgentTicketPhone###Priority', ... ], }, 'Queue' => { 'Postmaster' => [ 'Ticket::Frontend::CustomerTicketMessage###QueueDefault', ], 'Raw' => [ 'PostmasterDefaultQueue', ], }, ... );
Check if there are any enabled settings that refers to the provided Entity.
my @Result = $SysConfigObject->ConfigurationEntityCheck( EntityType => 'Priority', EntityName => '3 normal', );
Returns:
@Result = ( 'Ticket::Frontend::AgentTicketNote###PriorityDefault', 'Ticket::Frontend::AgentTicketPhone###Priority', 'Ticket::Frontend::AgentTicketBulk###PriorityDefault', ... );
Load Settings defined in XML files to the database.
my $Success = $SysConfigObject->ConfigurationXML2DB( UserID => 1, # UserID Directory => '/some/folder', # (optional) Provide directory where XML files are stored (default: Kernel/Config/Files/XML). Force => 1, # (optional) Force Setting update, even if it's locked by another user. Default: 0. CleanUp => 1, # (optional) Remove all settings that are not present in XML files. Default: 0. );
Returns:
$Success = 1; # or false in case of an error.
Returns navigation tree in the hash format.
my %Result = $SysConfigObject->ConfigurationNavigationTree( RootNavigation => 'Parent', # (optional) If provided only sub groups of the root navigation are returned. UserModificationActive => 1, # (optional) Return settings that can be modified on user level only. IsValid => 1, # (optional) By default, display all settings. Category => 'OTRS' # (optional) );
Returns:
%Result = ( 'Core' => { 'Core::Cache' => {}, 'Core::CustomerCompany' => {}, 'Core::CustomerUser' => {}, 'Core::Daemon' => { 'Core::Daemon::ModuleRegistration' => {}, }, ... 'Crypt' =>{ ... }, ... );
Returns list of settings that matches provided parameters.
my @List = $SysConfigObject->ConfigurationListGet( Navigation => 'SomeNavigationGroup', # (optional) limit to the settings that have provided navigation TargetUserID => 2, # (optional) if provided, system returns setting for particular user only, # otherwise, returns global setting list IsValid => 1, # (optional) by default returns valid and invalid settings. Invisible => 0, # (optional) Include Invisible settings. By default, not included. UserPreferencesGroup => 'Advanced', # (optional) filter list by group. Translate => 0, # (optional) Translate translatable string in EffectiveValue. Default 0. OverriddenInXML => 1, # (optional) Consider changes made in Perl files. Default 0. Use it in modules only! UserID => 1, # Required if OverriddenInXML is set. );
Returns:
@List = ( { DefaultID => 123, ModifiedID => 456, # if modified Name => "ProductName", Description => "Defines the name of the application ...", Navigation => "ASimple::Path::Structure", IsInvisible => 1, IsReadonly => 0, IsRequired => 1, IsValid => 1, HasConfigLevel => 200, UserModificationPossible => 0, # 1 or 0 UserModificationActive => 0, # 1 or 0 UserPreferencesGroup => 'Advanced', # optional XMLContentRaw => "The XML structure as it is on the config file", XMLContentParsed => "XML parsed to Perl", XMLFilename => "Daemon.xml", EffectiveValue => "Product 6", DefaultValue => "Product 5", IsModified => 1, # 1 or 0 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", OverriddenFileName => 'ZZZDefauls.pm' }, { DefaultID => 321, Name => 'FieldName', # ... CreateTime => '2010-09-11 10:08:00', ChangeTime => '2011-01-01 01:01:01', }, # ... );
Wrapper of Kernel::System::SysConfig::DB::DefaultSettingList() - Get list of all settings.
my @SettingList = $SysConfigObject->ConfigurationList();
Returns:
@SettingList = ( { DefaultID => '123', Name => 'SettingName1', IsDirty => 1, }, { DefaultID => '124', Name => 'SettingName2', IsDirty => 0 }, ... );
Returns list of enabled settings that have invalid effective value.
my @List = $SysConfigObject->ConfigurationInvalidList( CachedOnly => 0, # (optional) Default 0. If enabled, system will return cached value. # If there is no cache yet, system will return empty list, but # it will also trigger async call to generate cache. Undeployed => 1, # (optional) Default 0. Check settings that are not deployed as well. NoCache => 1, # (optional) Default 0. If enabled, system won't check the cached value. );
Returns:
@List = ( "Setting1", "Setting5", ... );
Write configuration items from database into a perl module file.
my %Result = $SysConfigObject->ConfigurationDeploy( Comments => "Some comments", # (optional) NoValidation => 0, # (optional) 1 or 0, default 0, skips settings validation UserID => 123, # if ExclusiveLockGUID is used, UserID must match the user that creates the lock Force => 1, # (optional) proceed even if lock is set to another user NotDirty => 1, # (optional) do not use any values from modified dirty settings AllSettings => 1, # (optional) use dirty modified settings from all users DirtySettings => [ # (optional) use only this dirty modified settings from the current user 'SettingOne', 'SettingTwo', ], );
Returns:
%Result = ( Success => 1, # Deployment successful. ); or %Result = ( Success => 0, # Deployment failed. Error => 'Error...', # Error message (if available) );
Get deployment list with complete data.
my @List = $SysConfigObject->ConfigurationDeployList();
Returns:
@List = ( { DeploymentID => 123, 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, 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, }, # ... );
ZZZAAuto.pm
to the latest deployment found in the database.my $Success = $SysConfigObject->ConfigurationDeploySync();
Cleanup old deployments from the database.
my $Success = $SysConfigObject->ConfigurationDeployCleanup();
Returns:
$Success = 1; # or false in case of an error
Wrapper of Kernel::System::SysConfig::DB::DeploymentGet() - Get deployment information.
my %Deployment = $SysConfigObject->ConfigurationDeployGet( DeploymentID => 123, );
Returns:
%Deployment = ( DeploymentID => 123, 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, );
Wrapper of Kernel::System::SysConfig::DBDeploymentGetLast() - Get last deployment information.
my %Deployment = $SysConfigObject->ConfigurationDeployGetLast();
Returns:
%Deployment = ( DeploymentID => 123, 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, );
Gets full modified settings information contained on a given deployment.
my @List = $SysConfigObject->ConfigurationDeploySettingsListGet( DeploymentID => 123, );
Returns:
@List = ( { DefaultID => 123, ModifiedID => 456, ModifiedVersionID => 789, Name => "ProductName", Description => "Defines the name of the application ...", Navigation => "ASimple::Path::Structure", IsInvisible => 1, IsReadonly => 0, IsRequired => 1, IsValid => 1, HasConfigLevel => 200, UserModificationPossible => 0, # 1 or 0 XMLContentRaw => "The XML structure as it is on the config file", XMLContentParsed => "XML parsed to Perl", EffectiveValue => "Product 6", DefaultValue => "Product 5", IsModified => 1, # 1 or 0 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", }, { DefaultID => 321, ModifiedID => 654, ModifiedVersionID => 987, Name => 'FieldName', # ... CreateTime => '2010-09-11 10:08:00', ChangeTime => '2011-01-01 01:01:01', }, # ... );
Check if there are not deployed changes on system configuration.
my $Result = $SysConfigObject->ConfigurationIsDirtyCheck( UserID => 123, # optional, the user that changes a modified setting );
Returns:
$Result = 1; # or 0 if configuration is not dirty.
Creates a YAML file with the system configuration settings.
my $ConfigurationDumpYAML = $SysConfigObject->ConfigurationDump( OnlyValues => 0, # optional, default 0, dumps only the setting effective value instead of the whole setting attributes. SkipDefaultSettings => 0, # optional, default 0, do not include default settings SkipModifiedSettings => 0, # optional, default 0, do not include modified settings SkipUserSettings => 0, # optional, default 0, do not include user settings DeploymentID => 123, # optional, if it is provided the modified settings are retrieved from versions );
Returns:
my $ConfigurationDumpYAML = '--- Default: Setting1: DefaultID: 23766 Name: Setting1 # ... Setting2: # ... Modified: Setting1 DefaultID: 23776 ModifiedID: 1250 Name: Setting1 # ... # ... JDoe: Setting2 DefaultID: 23777 ModifiedID: 1251 Name: Setting2 # ... # ... # ...
or
my $ConfigurationDumpYAML = $SysConfigObject->ConfigurationDump( OnlyValues => 1, );
Returns:
my $ConfigurationDumpYAML = '--- Default: Setting1: Test Setting2: Test # ... Modified: Setting1: TestUpdate # ... JDoe: Setting2: TestUser # ... # ... ';
Takes a YAML file with settings definition and try to import it into the system.
my $Success = $SysConfigObject->ConfigurationLoad( ConfigurationYAML => $YAMLString, # a YAML string in the format of L<ConfigurationDump()> UserID => 123, );
Returns a list of setting names that are dirty.
my @Result = $SysConfigObject->ConfigurationDirtySettingsList( ChangeBy => 123, );
Returns:
$Result = ['SettingA', 'SettingB', 'SettingC'];
Returns a list of setting names that are locked in general or by user.
my @Result = $SysConfigObject->ConfigurationLockedSettingsList( ExclusiveLockUserID => 2, # Optional, ID of the user for which the default setting is locked );
Returns:
$Result = ['SettingA', 'SettingB', 'SettingC'];
Returns a list of setting names.
my @Result = $SysConfigObject->ConfigurationSearch( Search => 'The search string', # (optional) Category => 'OTRS' # (optional) IncludeInvisible => 1, # (optional) Default 0. );
Returns:
$Result = ['SettingA', 'SettingB', 'SettingC'];
Returns a list of categories with their filenames.
my %Categories = $SysConfigObject->ConfigurationCategoriesGet();
Returns:
%Categories = ( All => { DisplayName => 'All Settings', Files => [], }, OTRS => { DisplayName => 'OTRS', Files => ['Calendar.xml', CloudServices.xml', 'Daemon.xml', 'Framework.xml', 'GenericInterface.xml', 'ProcessManagement.xml', 'Ticket.xml' ], }, # ... );
Returns a hash of forbidden value types.
my %ForbiddenValueTypes = $SysConfigObject->ForbiddenValueTypesGet();
Returns:
%ForbiddenValueType = ( String => [], Select => ['Option'], ... );
Returns a hash of forbidden value types.
my @ValueAttributeList = $SysConfigObject->ValueAttributeList();
Returns:
@ValueAttributeList = ( "Content", "SelectedID", );
This method locks provided settings(by force), updates them and deploys the changes (by force).
my $Success = $SysConfigObject->SettingsSet( UserID => 1, # (required) UserID Comments => 'Deployment comment', # (optional) Comment Settings => [ # (required) List of settings to update. { Name => 'Setting::Name', # (required) EffectiveValue => 'Value', # (optional) IsValid => 1, # (optional) UserModificationActive => 1, # (optional) }, ... ], );
Returns:
$Success = 1;
Returns file name which overrides setting Effective value.
my $FileName = $SysConfigObject->OverriddenFileNameGet( SettingName => 'Setting::Name', # (required) UserID => 1, # (required) EffectiveValue => '3', # (optional) EffectiveValue stored in the DB. );
Returns:
$FileName = 'ZZZUpdate.pm';
Returns global effective value for provided setting name.
my $EffectiveValue = $SysConfigObject->GlobalEffectiveValueGet( SettingName => 'Setting::Name', # (required) );
Returns:
$EffectiveValue = 'test';
Helper method to check if setting is overridden in specific module.
my $Overridden = $SysConfigObject->_IsOverriddenInModule( Module => "Kernel::Config::Files::ZZZAAuto", SettingStructure => [ 'DashboardBackend', '0000-ProductNotify' ], LoadedEffectiveValue => 'Value', );
Writes a file in an atomic operation. This is achieved by creating a temporary file, filling and renaming it. This avoids inconsistent states when the file is updated.
my $Success = $SysConfigObject->_FileWriteAtomic( Filename => "$Self->{Home}/Kernel/Config/Files/ZZZAAuto.pm", Content => \$NewContent, );
Gathers strings marked as translatable from a setting XML parsed content and saves it on ConfigurationTranslatableStrings global variable.
$SysConfigObject->_ConfigurationTranslatableStrings( Data => $Data, # could be SCALAR, ARRAY or HASH );
Removes all settings defined in the database (including default and modified) that are not included in the settings parameter
my $Success = $SysConfigObject->_DBCleanUp( Settings => { 'ACL::CacheTTL' => { XMLContentParsed => ' <Setting Name="SettingName" Required="1" Valid="1"> <Description Translatable="1">Test.</Description> # ... </Setting>', XMLContentRaw => { Description => [ { Content => 'Test.', Translatable => '1', }, ], Name => 'Test', # ... }, # ... }; );
Returns:
$Success = 1; # or false in case of a failure
Returns navigation as a tree (in a hash).
my %Result = $SysConfigObject->_NavigationTree( 'Array' => [ # Array of setting navigation items 'Core', 'Core::CustomerUser', 'Frontend', ], 'Tree' => { # Result from previous recursive call 'Core' => { 'Core::CustomerUser' => {}, }, }, );
Returns:
%Result = ( 'Core' => { 'Core::CustomerUser' => {}, }, 'Frontend' => {}, );
Returns hash of used entities for provided Setting value.
my %Result = $SysConfigObject->_ConfigurationEntitiesGet( 'Name' => 'Ticket::Frontend::AgentTicketPriority###Entity', # setting name 'Result' => {}, # result from previous recursive call 'Value' => [ # setting Value { 'Item' => [ { 'Content' => '3 medium', 'ValueEntityType' => 'Priority', 'ValueRegex' => '', 'ValueType' => 'Entity', }, ], }, ], );
Returns:
%Result = { 'Priority' => { '3 medium' => [ 'Ticket::Frontend::AgentTicketPriority###Entity', ], }, };
Converts effective values from settings into a combined perl hash ready to write into a file.
my $FileString = $SysConfigObject->_EffectiveValues2PerlFile( Settings => [ { Name => 'SettingName', IsValid => 1, EffectiveValue => $ValueStructure, }, { Name => 'AnotherSettingName', IsValid => 0, EffectiveValue => $AnotherValueStructure, }, # ... ], TargetPath => 'Kernel/Config/Files/ZZZAAuto.pm', );
Recursive helper for SettingEffectiveValueCheck().
my %Result = $SysConfigObject->_SettingEffectiveValueCheck( EffectiveValue => 'open', # (optional) The EffectiveValue to be checked, # (could be also a complex structure). XMLContentParsed => { # (required) The XMLContentParsed value from Default Setting. Value => [ { 'Item' => [ { 'Content' => "Scalar value", }, ], }, ], }, NoValidation => $Param{NoValidation}, # (optional), skip validation CurrentSystemTime => 1507894796935, # (optional) Use provided 1507894796935, otherwise calculate ExpireTime => 1507894896935, # (optional) Use provided ExpireTime for cache, otherwise calculate UserID => 1, # (required) UserID );
Returns:
%Result = ( EffectiveValue => 'closed', # Note that EffectiveValue can be changed. Success => 1, # or false in case of fail Error => undef, # or error string );
$SysConfigObject->_SettingEffectiveValueCheckCacheSet( Value => { (required) Default180920170714165331 => { Success => 1, }, ... }, NoValidation => 0, (optional) );
Returns the correct list of settings for a deployment taking the settings from different sources:
NotDirty: fetch default settings plus already deployed modified settings. AllSettings: fetch default settings plus all modified settings already deployed or not. DirtySettings: fetch default settings plus already deployed settings plus all not deployed settings in the list. my @SettingList = $SysConfigObject->_GetSettingsToDeploy( NotDirty => 1, # optional - exclusive (1||0) All => 1, # optional - exclusive (1||0) DirtySettings => [ 'SettingName1', 'SettingName2' ], # optional - exclusive ); @SettingList = ( { 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, UserModificationPossible => 0, # 1 or 0 UserModificationActive => 0, # 1 or 0 UserPreferencesGroup => 'Advanced', # optional XMLContentRaw => "The XML structure as it is on the config file", XMLContentParsed => "XML parsed to Perl", EffectiveValue => "Product 6", DefaultValue => "Product 5", IsModified => 1, # 1 or 0 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", }, { DefaultID => 321, Name => 'FieldName', # ... CreateTime => '2010-09-11 10:08:00', ChangeTime => '2011-01-01 01:01:01', }, # ... );
Creates modified versions of dirty settings to deploy and removed the dirty flag.
NotDirty: Removes dirty flag just for default settings AllSettings: Create a version for all dirty settings and removed dirty flags for all default and modified settings DirtySettings: Create a version and remove dirty fag for the modified settings in the list, remove dirty flag for all default settings my $Success = $SysConfigObject->_HandleSettingsToDeploy( NotDirty => 1, # optional - exclusive (1||0) AllSettings => 1, # optional - exclusive (1||0) DirtySettings => [ 'SettingName1', 'SettingName2' ], # optional - exclusive DeploymentTimeStamp => 2017-12-12 12:00:00' UserID => 123, );
Returns:
$Success = 1; # or false in case of a failure
Helper method for ConfigurationTranslatedGet().
my %Result = $SysConfigObject->_SettingTranslatedGet( Language => 'de', # (required) User language Name => 'SettingName', # (required) Setting name Silent => 1, # (optional) Default 1 );
Returns:
%Result = ( 'ACL::CacheTTL' => { 'Category' => 'OTRS', 'IsInvisible' => '0', 'Metadata' => "ACL::CacheTTL--- '3600' Cache-Zeit in Sekunden f\x{fc}r Datenbank ACL-Backends.", );
Returns a hash of forbidden value types.
my @ValueTypes = $SysConfigObject->_ValueTypesList();
Returns:
@ValueTypes = ( "Checkbox", "Select", ... );
Helper method for ConfigurationXML2DB() - bulk insert.
my $Success = $SysConfigObject->_DefaultSettingAddBulk( Settings => { # (required) Hash of settings to insert 'SettingName' => { }, ... }, SettingList => [ # (required) List of settings ... ], UserID => 1, # (required) UserID );
This software is part of the OTRS project (https://otrs.org/).
This software comes with ABSOLUTELY NO WARRANTY. For details, see the enclosed file COPYING for license information (GPL). If you did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.