Util#

NAME#

Kernel::System::Util

DESCRIPTION#

All Util functions.

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 $UtilObject = $Kernel::OM->Get('Kernel::System::Util');

IsITSMInstalled()#

Checks if ITSM is installed.

my $IsITSMInstalled = $UtilObject->IsITSMInstalled();

Returns 1 if ITSM is installed and 0 otherwise.

IsITSMIncidentProblemManagementInstalled()#

Checks if ITSMIncidentProblemManagement is installed.

my $IsITSMIncidentProblemManagementInstalled = $UtilObject->IsITSMIncidentProblemManagementInstalled();

Returns 1 if ITSMIncidentProblemManagement is installed and 0 otherwise.

IsFrontendContext()#

Checks if current code is being executed in frontend context, e.g. agent frontend.

my $IsFrontendContext = $UtilObject->IsFrontendContext();

Returns 1 if current code is being executed in frontend context.
Returns 0 if otherwise (e.g. console command context).

Base64DeepEncode()#

Base-64 encodes elements of given data for given keys.
If data is an array, all of its child elements will be checked for given keys whose elements
will be encoded recursively.

my $Base64EncodedData = $UtilObject->Base64DeepEncode(
    # Data can be a scalar, hash or array
    Data => {
        Article => {
            # ...
        },
        # ...
    },
    HashKeys => [
        # All 'Body' elements of array $Hash->{Articles} will be base-64 encoded.
        # Also can mean: $Hash->{Articles}->{Body}, if 'Articles' is a hash.
        # Will encode nothing if last key ('Body') cannot be reached or is not a scalar/string.
        'Articles->Body',

        'QueueData->Comment',
        # ...
    ],
);

DataStructureRemoveElements()#

Removes elements of given data for given keys.
If data is an array, all of its child elements will be checked for given keys whose elements
will be removed recursively.

my $Data = $UtilObject->DataStructureRemoveElements(
    # Data can be a scalar, hash or array
    Data => {
        Article => {
            # ...
        },
        # ...
    },
    HashKeys => [
        # All 'Body' elements of array $Hash->{Articles} will be removed.
        # Also can mean: $Hash->{Articles}->{Body}, if 'Articles' is a hash.
        # Will remove nothing if last key ('Body') cannot be reached or is not a scalar/string.
        'Articles->Body',

        'QueueData->Comment',
        # ...
    ],
);

GetInstalledDBCRUDObjects()#

Returns installed DBCRUD objects.

my $DBCRUDObjects = $UtilObject->GetInstalledDBCRUDObjects();

Returns:
my $DBCRUDObjects = [
    # DBCRUD objects as returned by $Kernel::OM->Get('Kernel::System::...')
];