SystemMaintenance#

NAME#

Kernel::System::SystemMaintenance

DESCRIPTION#

SystemMaintenance backend

PUBLIC INTERFACE#

new()#

create a SystemMaintenance object. Do not use it directly, instead use:

my $SystemMaintenanceObject = $Kernel::OM->Get('Kernel::System::SystemMaintenance');

SystemMaintenanceAdd()#

add new SystemMaintenance

returns the id of the created SystemMaintenance if success or undef otherwise

my $ID = $SystemMaintenance->SystemMaintenanceAdd(
    StartDate        => 1485346000,              # mandatory
    StopDate         => 1485349600,              # mandatory
    Comment          => 'Comment',               # mandatory
    LoginMessage     => 'A login message.',      # optional
    ShowLoginMessage => 1,                       # optional
    NotifyMessage    => 'Notification message.', # optional
    ValidID          => 1,                       # mandatory
    UserID           => 123,                     # mandatory
);

Returns:

$ID = 567;

SystemMaintenanceDelete()#

delete a SystemMaintenance

returns 1 if success or undef otherwise

my $Success = $SystemMaintenanceObject->SystemMaintenanceDelete(
    ID     => 123,
    UserID => 123,
);

SystemMaintenanceGet()#

get SystemMaintenance attributes

my $SystemMaintenance = $SystemMaintenanceObject->SystemMaintenanceGet(
    ID     => 123,          # mandatory
    UserID => 123,          # mandatory
);

Returns:

$SystemMaintenance = {
    ID             => 123,
    StartDate        => 1485346000,
    StopDate         => 1485349600,
    Comment          => 'Comment',
    LoginMessage     => 'A login message.',
    ShowLoginMessage => 1,
    NotifyMessage    => 'Notification message.',
    ValidID          => 1,
    CreateTime       => 1485346000,
    ChangeTime       => 1485347300,
    CreateBy         => 'user_login',
    ChangeBy         => 'user_login',
};

SystemMaintenanceUpdate()#

update SystemMaintenance attributes

returns 1 if success or undef otherwise

my $Success = $SystemMaintenanceObject->SystemMaintenanceUpdate(
    ID               => 123,                        # mandatory
    StartDate        => 1485346000,                 # mandatory
    StopDate         => 1485349600,                 # mandatory
    Comment          => 'Comment',                  # mandatory
    LoginMessage     => 'Description',              # optional
    ShowLoginMessage => 1,                          # optional
    NotifyMessage    => 'Notification for showing', # optional
    ValidID          => 'ValidID',                  # mandatory
    UserID           => 123,                        # mandatory
);

SystemMaintenanceList()#

get an SystemMaintenance list

my $List = $SystemMaintenanceObject->SystemMaintenanceList(
    ValidIDs => ['1','2'],           # optional, to filter SystemMaintenances that match listed valid IDs
    UserID   => 1,
);

Returns a hash with the SystemMaintenance IDs as keys:

$List = {
    42 => 1,
    24 => 1,
}

SystemMaintenanceListGet()#

get an SystemMaintenance list with all SystemMaintenance details

my $List = $SystemMaintenanceObject->SystemMaintenanceListGet(
    UserID   => 1,
    ValidIDs => ['1','2'], # optional, to filter SystemMaintenances that match listed valid IDs
);

Returns:

$List = [
    {
        ID               => 123,
        StartDate        => 1485346000,
        StopDate         => 1485349600,
        Comment          => 'Comment',
        LoginMessage     => 'The message',
        ShowLoginMessage => 1,
        NotifyMessage    => 'The notification',
        ValidID          => 1,
        CreateTime       => 1485342400,
        ChangeTime       => 1485343700,
    },
    {
        ID               => 123,
        StartDate        => 1485346000,
        StopDate         => 1485349600,
        Comment          => 'Other Comment',
        LoginMessage     => 'To be shown on the login screen.',
        ShowLoginMessage => 0,
        NotifyMessage    => 'A different notification',
        ValidID          => 1,
        CreateTime       => 1485342400,
        ChangeTime       => 1485343700,
    },
];

SystemMaintenanceIsActive()#

get a SystemMaintenance active flag

my $ActiveMaintenance = $SystemMaintenanceObject->SystemMaintenanceIsActive();

Returns:

$ActiveMaintenance = 7 # a System Maintenance ID

SystemMaintenanceIsComing()#

Get a upcoming SystemMaintenance start and stop date.

my %SystemMaintenanceIsComing = $SystemMaintenanceObject->SystemMaintenanceIsComing();

Returns:

%SystemMaintenanceIsComing = {
    StartDate => 1515614400,
    StopDate  => 1515607200,
};