NAME
Kernel::System::Package – to manage application packages/modules
DESCRIPTION
All functions to manage application packages/modules.
PUBLIC INTERFACE
new()
create an object
my $PackageObject = $Kernel::OM->Get('Kernel::System::Package');
RepositoryList()
returns a list of repository packages
my @List = $PackageObject->RepositoryList();
my @List = $PackageObject->RepositoryList(
Result => 'short', # will only return name, version, install_status md5sum, vendor and build commit ID
instead of the structure
);
RepositoryGet()
get a package from local repository
my $Package = $PackageObject->RepositoryGet(
Name => 'Application A',
Version => '1.0',
);
my $PackageScalar = $PackageObject->RepositoryGet(
Name => 'Application A',
Version => '1.0',
Result => 'SCALAR',
DisableWarnings => 1, # optional
);
RepositoryAdd()
add a package to local repository
$PackageObject->RepositoryAdd(
String => $FileString,
FromCloud => 0, # optional 1 or 0, it indicates if package came from Cloud or not
);
RepositoryRemove()
remove a package from local repository
$PackageObject->RepositoryRemove(
Name => 'Application A',
Version => '1.0',
);
PackageInstall()
install a package
$PackageObject->PackageInstall(
String => $FileString,
Force => 1, # optional 1 or 0, for to install package even if validation fails
FromCloud => 1, # optional 1 or 0, it indicates if package's origin is Cloud or not
);
PackageReinstall()
reinstall files of a package
$PackageObject->PackageReinstall( String => $FileString );
PackageUpgrade()
upgrade a package
$PackageObject->PackageUpgrade(
String => $FileString,
Force => 1, # optional 1 or 0, for to install package even if validation fails
);
PackageUninstall()
uninstall a package
$PackageObject->PackageUninstall( String => $FileString );
PackageOnlineRepositories()
returns a list of available online repositories
my %List = $PackageObject->PackageOnlineRepositories();
PackageOnlineList()
returns a list of available on-line packages
my @List = $PackageObject->PackageOnlineList(
URL => '',
Lang => 'en',
Cache => 0, # (optional) do not use cached data
FromCloud => 1, # optional 1 or 0, it indicates if a Cloud Service
# should be used for getting the packages list
IncludeSameVersion => 1, # (optional) to also get packages already installed and with the same version
);
PackageOnlineGet()
download of an online package and put it into the local repository
$PackageObject->PackageOnlineGet(
Source => 'http://host.example.com/',
File => 'SomePackage-1.0.opm',
);
DeployCheck()
check if package (files) is deployed, returns true if it's ok
$PackageObject->DeployCheck(
Name => 'Application A',
Version => '1.0',
Log => 1, # Default: 1
);
DeployCheckInfo()
returns the info of the latest DeployCheck(), what's not deployed correctly
my %Hash = $PackageObject->DeployCheckInfo();
PackageVerify()
check if package is verified by the vendor
$PackageObject->PackageVerify(
Package => $Package,
Structure => \%Structure,
);
or
$PackageObject->PackageVerify(
Package => $Package,
Name => 'FAQ',
);
PackageVerifyInfo()
returns the info of the latest PackageVerify()
my %Hash = $PackageObject->PackageVerifyInfo();
PackageVerifyAll()
check if all installed packages are installed by the vendor returns a hash with package names and verification status.
my %VerificationInfo = $PackageObject->PackageVerifyAll();
returns:
%VerificationInfo = (
FAQ => 'verified',
Support => 'verified',
MyHack => 'not_verified',
);
PackageBuild()
build an opm package
my $Package = $PackageObject->PackageBuild(
Name => {
Content => 'SomePackageName',
},
Version => {
Content => '1.0',
},
Vendor => {
Content => 'OTRS AG',
},
URL => {
Content => 'L<http://otrs.org/>',
},
License => {
Content => 'GNU GENERAL PUBLIC LICENSE Version 3, November 2007',
}
Description => [
{
Lang => 'en',
Content => 'english description',
},
{
Lang => 'de',
Content => 'german description',
},
],
Filelist = [
{
Location => 'Kernel/System/Lala.pm'
Permission => '644',
Content => $FileInString,
},
{
Location => 'Kernel/System/Lulu.pm'
Permission => '644',
Content => $FileInString,
},
],
);
PackageParse()
parse a package
my %Structure = $PackageObject->PackageParse( String => $FileString );
PackageExport()
export files of an package
$PackageObject->PackageExport(
String => $FileString,
Home => '/path/to/export'
);
PackageIsInstalled()
returns true if the package is already installed
$PackageObject->PackageIsInstalled(
String => $PackageString, # Attribute String or Name is required
Name => $NameOfThePackage,
);
PackageInstallDefaultFiles()
returns true if the distribution package (located under ) can get installed
$PackageObject->PackageInstallDefaultFiles();
PackageFileGetMD5Sum()
generates a MD5 Sum for all files in a given package
my $MD5Sum = $PackageObject->PackageFileGetMD5Sum(
Name => 'Package Name',
Version => 123.0,
);
returns:
$MD5SumLookup = {
'Direcoty/File1' => 'f3f30bd59afadf542770d43edb280489'
'Direcoty/File2' => 'ccb8a0b86adf125a36392e388eb96778'
};
AnalyzePackageFrameworkRequirements()
Compare a framework array with the current framework.
my %CheckOk = $PackageObject->AnalyzePackageFrameworkRequirements(
Framework => $Structure{Framework}, # [ { 'Content' => '4.0.x', 'Minimum' => '4.0.4'} ]
NoLog => 1, # optional
IgnoreMinimumMaximum => 1, # optional, default 0, only check if the major version matches
);
%CheckOK = (
Success => 1, # 1 || 0
RequiredFramework => '5.0.x',
RequiredFrameworkMinimum => '5.0.10',
RequiredFrameworkMaximum => '5.0.16',
);
PackageUpgradeAll()
Updates installed packages to their latest version.
my %Result = $PackageObject->PackageUpgradeAll(
Force => 1, # optional 1 or 0, Upgrades packages even if validation fails.
SkipDeployCheck => 1, # optional 1 or 0, If active it does not check file deployment status
# for already updated packages.
);
%Result = (
Updated => { # updated packages to the latest on-line repository version
PackageA => 1,
PackageB => 1,
PackageC => 1,
# ...
},
Installed => { # packages installed as a result of missing dependencies
PackageD => 1,
# ...
},
AlreadyInstalled { # packages that are already installed with the latest version
PackageE => 1,
# ...
}
Undeployed { # packages not correctly deployed
PackageK => 1,
# ...
}
Failed => { # or {} if no failures
Cyclic => { # packages with cyclic dependencies
PackageF => 1,
# ...
},
NotFound => { # packages not listed in the on-line repositories
PackageG => 1,
# ...
},
WrongVersion => { # packages that requires a mayor version that the available in the on-line repositories
PackageH => 1,
# ...
},
DependencyFail => { # packages with dependencies that fail on any of the above reasons
PackageI => 1,
# ...
},
},
);
PackageInstallOrderListGet()
Gets a list of packages and its corresponding install order including is package dependencies. Higher install order means to install first.
my %Result = $PackageObject->PackageInstallOrderListGet(
InstalledPackages => \@PakageList, # as returned from RepositoryList(Result => 'short')
OnlinePackages => \@PakageList, # as returned from PackageOnlineList()
);
%Result = (
InstallOrder => {
PackageA => 3,
PackageB => 2,
PackageC => 1,
PackageD => 1,
# ...
},
Failed => { # or {} if no failures
Cyclic => { # packages with cyclic dependencies
PackageE => 1,
# ...
},
NotFound => { # packages not listed in the on-line repositories
PackageF => 1,
# ...
},
WrongVersion => { # packages that requires a mayor version that the available in the on-line repositories
PackageG => 1,
# ...
},
DependencyFail => { # packages with dependencies that fail on any of the above reasons
PackageH => 1,
# ...
}
},
);
PackageUpgradeAllDataDelete()
Removes all Package Upgrade All data from the database.
my $Success = $PackageObject->PackageUpgradeAllDataDelete();
PackageUpgradeAllIsRunning()
Check if there is a Package Upgrade All process running by checking the scheduler tasks and the system data.
my %Result = $PackageObject->PackageUpgradeAllIsRunning();
Returns: %Result = ( IsRunning => 1, # or 0 if it is not running UpgradeStatus => 'Running' # (optional) 'Running' or 'Finished' or 'TimedOut', UpgradeSuccess => 1, # (optional) 1 or 0, );