ePages 6.11.0 - DE_EPAGES/Core/API/BaseInstaller.pm

Package DE_EPAGES::Core::API::BaseInstaller

@EXPORT_OK
ResetInstallerCache

Functions

ResetInstallerCache
addReason
call
cartridgeDirectory
cartridgePackage
dependentCartridges
directDependentCartridges
directRequiredCartridges
doPatch
finishInstall
finishPatch
finishUninstall
force
getReasons
hasReasons
id
install
installRequiredCartridges
installedVersion
isCompliant
isInstalled
isRecursive
loadInstaller
new
noScheduler
patch
patchCartridgeDir
patchStoreTypeDir
patches
patchesDirectory
requiredCartridges
setVersion
startInstall
startPatch
startUninstall
storeName
storeType
storeTypeDir
storeTypeVersion
supportedVersions
testCartridgeCompliant
testExists
testInstall
testInstallRequiredCartridges
testNotExists
testUninstall
testUninstallDependentCartridges
uninstall
uninstallDependentCartridges
version

ResetInstallerCache

Reset the internal installer cache

Syntax
ResetInstallerCache();

addReason

Adds reason to collect problems on install/uninstall/patch/...

Syntax
$Installer->addReason($hReason);
Input
$hReason (ref.hash)
keys can include keys:
  • Reason - key - string
  • Package - patch cartridge package - string
  • Version - patch cartridge version - string

call

Executes the code reference. Depending on the force flag, errors are degraded to warnings.

Syntax
$Installer->call( $Code );
Example
$Installer->call( sub { ImportObject( "Objects.xml" ) } );
Input
$Code (code reference)
code reference

cartridgeDirectory

Gets cartridge directory name.

Syntax
$CartridgeDirectory = $Installer->cartridgeDirectory;
Return
$CartridgeDirectory (string)
cartridge directory name (DE_EPAGES/Core)

cartridgePackage

Gets cartridge package name.

Syntax
$CartridgePackage = $Installer->cartridgePackage;
Return
$CartridgePackage (string)
cartridge package name (DE_EPAGES::Core)

dependentCartridges

Returns a list of all cartridges that depend on this cartridge. The list includes direct and indirect dependencies. The cartridges can be uninstalled in the order of the list. The default implementation returns an empty list.

Syntax
$aDependentCartridges = $Installer->dependentCartridges;
Return
$aDependentCartridges (ref.array.object)
list of cartridge objects

directDependentCartridges

Returns a list of cartridges that have declared dependencies on this cartridge. The list does not include indirect dependencies. The default implementation returns an empty list.

Syntax
$aDependentCartridges = $Installer->directDependentCartridges;
Return
$aDependentCartridges (ref.array.object)
list of cartridge objects

directRequiredCartridges

Returns a list of all cartridges that are directly required by this cartridges. The list does not include cartridges that are required by the required cartridges.

Syntax
$aRequiredCartridges = $Installer->directRequiredCartridges;
Return
$aRequiredCartridges (ref.array.object)
list of cartridge objects

doPatch

Patches cartridge in active store. This function calls methods named "patch_$InstalledVersion". InstalledVersion is actual version of cartridge '.' are replaced with '_' (version on 1.0.1.0 will call patch_1_0_1_0). At the end of each patch call the called function returns the new version (eg: 1.1.0.0).

Syntax
$Installer->doPatch;

finishInstall

Finalizes the cartridge installation. Writes a info 'finish install 'at log. Sets the cartridge version.

Syntax
$Installer->finishInstall;

finishPatch

Finalizes the cartridge patch. Writes a info 'finish patch 'at log.

Syntax
$Installer->finishPatch;

finishUninstall

Finalizes the cartridge uninstallation. Writes 'finish uninstall' to log. Delete Cartridge entry from Cartridges.d/$Store.conf

Syntax
$Installer->finishUninstall;

force

Forces uninstallation.

Syntax
$Force = $Installer->force;
Example
die "Installation failed" unless $Installer->force;
Return
$Force (boolean)
ignore errors during install or uninstall

getReasons

Returns collected reasons and deletes reasons.

Syntax
$ahReasons = $Installer->getReasons();
Return
$ahReasons (ref.array.hash)
keys can include keys:
  • Reason - key - string
  • Package - patch cartridge package - string
  • Version - patch cartridge version - string

hasReasons

Returns if reasons exists.

Syntax
$Has = $Installer->hasReasons();
Return
$Has (boolean)
has reasons

id

Returns the cartridge id from the current database or undef if the cartridge is not installed in the current database.

Syntax
$CartridgeID = $Installer->id;
Return
$CartridgeID (int)
cartridge id

install

Installs the files and database objects of a cartridge to the current store/database.

Syntax
$Installer->install;

installRequiredCartridges

Installs required cartridges.

Syntax
$Installer->installRequiredCartridges;

installedVersion

Returns the installed version of the cartridge in the current database.

Syntax
my $Version = $Installer->installedVersion();
Return
$Version (string)
version string, e.g. '1.0'

isCompliant

Returns whether or not the current version is compliant to the new version of patch. Returns true if the major version is equal and the current minor version is equal or higher than required.

Syntax
$IsCompliant = $Installer->isCompliant($RequiredVersion, $CurrentVersion);
Example
$IsCompliant = $Installer->isCompliant('5.0.0.4');
$IsCompliant = $Installer->isCompliant('5.0.0.4', '6.1'); # false
$IsCompliant = $Installer->isCompliant('5.0.0.4', '5.0.1'); # true
Input
$RequiredVersion (string)
required version
$CurrentVersion (string)
current version (optional default $self->version)
Return
$IsCompliant (boolean)
true if the cartridge is compliant

isInstalled

Returns true if the cartridge is installed in the current database.

Syntax
$IsInstalled = $Installer->isInstalled;
Return
$IsInstalled (boolean)
true if the cartridge is installed

isRecursive

Returns true if required cartridges are to be installed automatically or dependent cartridges are uninstalled automatically.

Syntax
$IsRecursive = $Installer->isRecursive;
Return
$IsRecursive (boolean)
recursive flag

loadInstaller

Loads other installer.

Syntax
$OtherInstaller = $Installer->loadInstaller( $Package );
Input
$Package (string)
cartridge package, e.g. DE_EPAGES::Shop
Return
$OtherInstaller (object)
cartridge installer object

new

Creates a new installer object.

Syntax
$Installer = DE_EPAGES::Core::API::BaseInstaller->new(%Options);
Input
%Options (hash)
option
  • CartridgeDirectory - cartridge base directory (DE_EPAGES/Core) - string
  • StoreName - store name for in/uninstall (optional default undef) - string
  • StoreType - store type for in/uninstall (optional default undef) - string
  • IsRecusive - (un)install dependent and required cartridges (optional default 1)- boolean
  • Force - uninstall are forced (not stops) (optional default 0)- boolean
  • NoScheduler - install without scheduler files (optional default 0)- boolean

Return
$Installer (object)
cartridge installer

noScheduler

Returns true if cartridges are to be installed without scheduler files

Syntax
$NoScheduler = $Installer->noScheduler;
Return
$NoScheduler (boolean)
no scheduler flag

patch

Patches the files and database objects of a cartridge to the current store/database if the cartridge is installed.

Syntax
$Installer->patch;

patchCartridgeDir

Patches cartridge directory. This function calls methods named "patchCartridgeDir_$CartridgeDirVersion". CartridgeDirVersion is first patch version of cartridge '.' are replaced with '_' (version on 1.0.1.0 will call patchCartridgeDir_1_0_1_0). At the end of each patch call the called function returns the new version (eg: 1.1.0.0).

Syntax
$Installer->patchCartridgeDir;

patchStoreTypeDir

Patches cartridge directory. This function calls methods named "patchStoreTypeDir_$CartridgeDirVersion". CartridgeDirVersion is first patch version of cartridge '.' are replaced with '_' (version on 1.0.1.0 will call patchStoreTypeDir_1_0_1_0). At the end of each patch call the called function returns the new version (eg: 1.1.0.0).

Syntax
$Installer->patchStoreTypeDir;

patches

Returns older versions which can be patched by this cartridge.

Syntax
$aPatchVersions = $Installer->patches;
Return
$aPatchVersions (ref.array.string)
list upgradable versions of this cartridge, for exapme:
[ '1.0', '1.1' ]

patchesDirectory

Gets cartridge patch directory name.

Syntax
$CartridgePatchDirectory = $Installer->patchesDirectory;
Return
$CartridgePatchDirectory (string)
cartridge patch directory name (DE_EPAGES/Core/Patches)

requiredCartridges

Returns a list of all required cartridges, including indirectly required cartridges. The cartridges can be installed in the order of the list. The default implementation returns an empty list.

Syntax
$aRequiredCartridges = $Installer->requiredCartridges;
Return
$aRequiredCartridges (ref.array.object)
list of cartridge objects

setVersion

Updates the cartridge version in the current database.

Syntax
$Installer->setVersion( $Version );
Example
$Installer->setVersion('1.0.2');
Input
$Version (string)
new version string, e.g. '1.0.2'

startInstall

Prepares the cartridge installation.

Syntax
$Installer->startInstall;

startPatch

Prepares the cartridge patch. Writes a info 'start patch' at log.

Syntax
$Installer->startPatch;

startUninstall

Prepares the cartridge uninstallation.

Syntax
$Installer->startUninstall;

storeName

The cartridge will be installed at this store.

Syntax
$StoreName = $Installer->storeName;
Return
$StoreName (string)
store name

storeType

The cartridge will be installed for this store type.

Syntax
$StoreType = $Installer->storeType;
Return
$StoreType (string)
store type

storeTypeDir

The cartridge will be installed into this store type directory.

Syntax
$StoreTypeDir = $Installer->storeTypeDir;
Return
$StoreTypeDir (string)
store type directory

storeTypeVersion

The cartridge will be installed for this store type version.

Syntax
$StoreTypeVersion = $Installer->storeTypeVersion;
Return
$StoreTypeVersion (string)
store type version

supportedVersions

Returns a list of supported versions of the required cartridge.

Syntax
$aVersions = $Installer->supportedVersions($Package);
Input
$Package (string)
package name of a required cartridge
Return
$aVersions (ref.array.string)
list of version strings

testCartridgeCompliant

Tests if a required cartridge exists with a supported version. Calls addReason if the version of the required cartridge is not compatible.

Syntax
$Installer->testCartridgeCompliant($Cartridge);
Input
$Cartridge (object)
installer object of required cartridge, calls methods
cartridgePackage,
isCompliant and
version

testExists

Adds a reason if cartridge is not installed. Calls addReason if the cartridge is not yet installed.

Syntax
$Installer->testExists;

testInstall

Tests installation of cartridge. Calls addReason for each reason why the cartridge cannot be installed.

Syntax
$Installer->testInstall;

testInstallRequiredCartridges

Tests installation of required cartridges. Calls addReason for each reason why a required cartridge cannot be installed.

Syntax
$Installer->testInstallRequiredCartridges;

testNotExists

Adds a reason if cartridge is installed. Calls addReason if the cartridge is already installed.

Syntax
$Installer->testNotExists;

testUninstall

Tests uninstallation of cartridge. Calls addReason for each reason why the cartridge cannot be uninstalled.

Syntax
$Installer->testUninstall;

testUninstallDependentCartridges

Tests deinstallation of dependent cartridges. Calls addReason for each reason why a dependent cartridge cannot be uninstalled.

Syntax
$Installer->testUninstallDependentCartridges;

uninstall

Removes cartridge files and database objects from the current store/database.

Syntax
$Installer->uninstall;

uninstallDependentCartridges

Uninstalls dependent cartridges (does nothing).

Syntax
$Installer->uninstallDependentCartridges;

version

Returns the current cartridge version.

Syntax
$Version = $Installer->version;
Return
$Version (string)
current cartridge varsion (source code version), for example
'1.0'