Kernel::System::Package - to manage application packages/modules
All functions to manage application packages/modules.
create an object
my $PackageObject = $Kernel::OM->Get('Kernel::System::Package');
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 );
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 );
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 );
remove a package from local repository
$PackageObject->RepositoryRemove( Name => 'Application A', Version => '1.0', );
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 );
reinstall files of a package
$PackageObject->PackageReinstall( String => $FileString );
upgrade a package
$PackageObject->PackageUpgrade( String => $FileString, Force => 1, # optional 1 or 0, for to install package even if validation fails );
uninstall a package
$PackageObject->PackageUninstall( String => $FileString );
returns a list of available online repositories
my %List = $PackageObject->PackageOnlineRepositories();
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 );
download of an online package and put it into the local repository
$PackageObject->PackageOnlineGet( Source => 'http://host.example.com/', File => 'SomePackage-1.0.opm', );
check if package (files) is deployed, returns true if it's ok
$PackageObject->DeployCheck( Name => 'Application A', Version => '1.0', Log => 1, # Default: 1 );
returns the info of the latest DeployCheck(), what's not deployed correctly
my %Hash = $PackageObject->DeployCheckInfo();
check if package is verified by the vendor
$PackageObject->PackageVerify( Package => $Package, Structure => \%Structure, );
or
$PackageObject->PackageVerify( Package => $Package, Name => 'FAQ', );
returns the info of the latest PackageVerify()
my %Hash = $PackageObject->PackageVerifyInfo();
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', );
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, }, ], );
parse a package
my %Structure = $PackageObject->PackageParse( String => $FileString );
export files of an package
$PackageObject->PackageExport( String => $FileString, Home => '/path/to/export' );
returns true if the package is already installed
$PackageObject->PackageIsInstalled( String => $PackageString, # Attribute String or Name is required Name => $NameOfThePackage, );
returns true if the distribution package (located under ) can get installed
$PackageObject->PackageInstallDefaultFiles();
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' };
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 ); %CheckOK = ( Success => 1, # 1 || 0 RequiredFramework => '5.0.x', RequiredFrameworkMinimum => '5.0.10', RequiredFrameworkMaximum => '5.0.16', );
Updates installed packages to their latest version. Also updates OTRS Business Solution™ if system is entitled and there is an update.
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, # ... }, }, );
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, # ... } }, );
Removes all Package Upgrade All data from the database.
my $Success = $PackageObject->PackageUpgradeAllDataDelete();
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, );
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.