Migration#
NAME#
Kernel::System::SysConfig::Migration - System configuration settings migration tools.
PUBLIC INTERFACE#
new()#
Create an object. Do not use it directly, instead use:
use Kernel::System::ObjectManager;
local $Kernel::OM = Kernel::System::ObjectManager->new();
my $SysConfigMigrationObject = $Kernel::OM->Get('Kernel::System::SysConfig::Migration');
MigrateSysConfigSettings()#
Migrates config values from old SysConfig name to a new and updates modified settings with new values if needed. The values are taken from a backed up ZZZAAuto.pm which contains the old config.
# Rename
# changed 'Znuny4OTRSDatabaseBackend###Export###CSV###Separator' to 'DBCRUD###Export###CSV###Separator'
my $Success = $SysConfigMigrationObject->MigrateSysConfigSettings(
FilePath => '/opt/znuny/Kernel/Config/Files/ZZZAAuto.pm',
FileClass => 'Kernel::Config::Files::ZZZAAuto',
Data => {
'Znuny4OTRSDatabaseBackend###Export###CSV###Separator' => {
UpdateName => 'DBCRUD###Export###CSV###Separator',
},
}
);
# String
my $Success = $SysConfigMigrationObject->MigrateSysConfigSettings(
Data => {
'Ticket::Hook' => {
UpdateEffectiveValue => {
'Ticket#' => 'Znuny###',
},
}
}
);
# Array
# Added EffectiveValue, updated old version to new and delete an old EffectiveValue.
my $Success = $SysConfigMigrationObject->MigrateSysConfigSettings(
Data => {
'Loader::Agent::CommonJS###000-Framework' => {
AddEffectiveValue => [
'thirdparty/canvg-1.4/canvg.js',
],
UpdateEffectiveValue => {
'thirdparty/jquery-jstree-3.3.4/jquery.jstree.js' => 'thirdparty/jquery-jstree-3.3.7/jquery.jstree.js',
'thirdparty/jquery-3.2.1/jquery.js' => 'thirdparty/jquery-3.5.1/jquery.js',
},
DeleteEffectiveValue => [
'thirdparty/jquery-3.4.1/jquery.js',
]
}
}
);
# OR
# Set EffectiveValue
my $Success = $SysConfigMigrationObject->MigrateSysConfigSettings(
Data => {
'Loader::Agent::CommonJS###000-Framework' => {
EffectiveValue => [
'thirdparty/canvg-1.4/canvg.js',
],
}
}
);
# Hash
# Added EffectiveValue, updated old version to new and delete an old EffectiveValue.
my $Success = $SysConfigMigrationObject->MigrateSysConfigSettings(
Data => {
'Ticket::InvalidOwner::StateChange' => {
AddEffectiveValue => {
'open' => 'open',
},
UpdateEffectiveValue => {
'pending reminder' => {
Key => 'new reminder',
Value => 'reminder',
},
},
DeleteEffectiveValue => [
'pending auto',
]
}
}
);
Returns:
my $Success = 1;