Description | manuals and libraries |
Kernel::System::Package - to manage application packages/modules
All functions to manage application packages/modules.
create an object
use Kernel::System::ObjectManager;
local $Kernel::OM = Kernel::System::ObjectManager->new();
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 and vendor
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
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 );
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
);
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'
};
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.