TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
DependencyUtility Class Reference
Inheritance diagram for DependencyUtility:
SingletonInterface

Public Member Functions

 injectObjectManager (\TYPO3\CMS\Extbase\Object\ObjectManager $objectManager)
 
 injectExtensionRepository (\TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository $extensionRepository)
 
 injectListUtility (\TYPO3\CMS\Extensionmanager\Utility\ListUtility $listUtility)
 
 injectEmConfUtility (\TYPO3\CMS\Extensionmanager\Utility\EmConfUtility $emConfUtility)
 
 injectManagementService (\TYPO3\CMS\Extensionmanager\Service\ExtensionManagementService $managementService)
 
 setLocalExtensionStorage ($localExtensionStorage)
 
 setSkipDependencyCheck ($skipDependencyCheck)
 
 hasDependencyErrors ()
 
 getDependencyErrors ()
 
 findInstalledExtensionsThatDependOnMe ($extensionKey)
 

Protected Member Functions

 setAvailableExtensions ()
 
 checkTypo3Dependency (Dependency $dependency)
 
 checkPhpDependency (Dependency $dependency)
 
 checkExtensionDependency (Dependency $dependency)
 
 getExtensionFromRepository ($extensionKey, Dependency $dependency)
 
 getExtensionFromInExtensionRepository ($extensionKey)
 
 getExtensionFromTer ($extensionKey, Dependency $dependency)
 
 isDependentExtensionLoaded ($extensionKey)
 
 isLoadedVersionCompatible (Dependency $dependency)
 
 isVersionCompatible ($version, Dependency $dependency)
 
 isDependentExtensionAvailable ($extensionKey)
 
 isAvailableVersionCompatible (Dependency $dependency)
 
 isExtensionDownloadableFromTer ($extensionKey)
 
 isDownloadableVersionCompatible (Dependency $dependency)
 
 getLatestCompatibleExtensionByIntegerVersionDependency (Dependency $dependency)
 
 getLowestAndHighestIntegerVersions (Dependency $dependency)
 

Protected Attributes

 $objectManager
 
 $extensionRepository
 
 $listUtility
 
 $emConfUtility
 
 $managementService
 
 $availableExtensions = []
 
 $localExtensionStorage = ''
 
 $dependencyErrors = []
 
 $skipDependencyCheck = false
 

Detailed Description

Utility for dealing with dependencies

Definition at line 26 of file DependencyUtility.php.

Member Function Documentation

checkExtensionDependency ( Dependency  $dependency)
protected

Main controlling function for checking dependencies Dependency check is done in the following way:

  • installed extension in matching version ? - return true
  • available extension in matching version ? - mark for installation
  • remote (TER) extension in matching version? - mark for download
Todo:
handle exceptions / markForUpload
Parameters
Dependency$dependency
Exceptions
ExceptionMissingVersionDependencyException
Returns
bool

Definition at line 279 of file DependencyUtility.php.

References DependencyUtility\$dependencyErrors, DependencyUtility\getExtensionFromRepository(), Dependency\getHighestVersion(), Dependency\getIdentifier(), Dependency\getLowestVersion(), Extension\getVersion(), DependencyUtility\isAvailableVersionCompatible(), DependencyUtility\isDependentExtensionAvailable(), DependencyUtility\isDependentExtensionLoaded(), and DependencyUtility\isLoadedVersionCompatible().

checkPhpDependency ( Dependency  $dependency)
protected

Returns true if current php version fulfills extension requirements

Parameters
Dependency$dependency
Exceptions
ExceptionUnresolvedPhpDependencyException
Returns
bool

Definition at line 242 of file DependencyUtility.php.

References Dependency\getHighestVersion(), Dependency\getIdentifier(), and Dependency\getLowestVersion().

checkTypo3Dependency ( Dependency  $dependency)
protected

Returns true if current TYPO3 version fulfills extension requirements

Parameters
Dependency$dependency
Exceptions
ExceptionUnresolvedTypo3DependencyException
Returns
bool

Definition at line 210 of file DependencyUtility.php.

References Dependency\getHighestVersion(), Dependency\getIdentifier(), Dependency\getLowestVersion(), and VersionNumberUtility\getNumericTypo3Version().

findInstalledExtensionsThatDependOnMe (   $extensionKey)
Parameters
string$extensionKey
Returns
array

Definition at line 572 of file DependencyUtility.php.

getDependencyErrors ( )

Return the dependency errors

Returns
array

Definition at line 198 of file DependencyUtility.php.

References DependencyUtility\$dependencyErrors.

getExtensionFromInExtensionRepository (   $extensionKey)
protected

Gets an extension from the in extension repository (the local extension storage)

Parameters
string$extensionKey
Returns
bool

Definition at line 375 of file DependencyUtility.php.

References GeneralUtility\get_dirs().

Referenced by DependencyUtility\getExtensionFromRepository().

getExtensionFromRepository (   $extensionKey,
Dependency  $dependency 
)
protected

Get an extension from a repository (might be in the extension itself or the TER)

Parameters
string$extensionKey
Dependency$dependency
Returns
void
Exceptions
ExceptionUnresolvedDependencyException

Definition at line 361 of file DependencyUtility.php.

References DependencyUtility\getExtensionFromInExtensionRepository(), and DependencyUtility\getExtensionFromTer().

Referenced by DependencyUtility\checkExtensionDependency().

getExtensionFromTer (   $extensionKey,
Dependency  $dependency 
)
protected

Handles checks to find a compatible extension version from TER to fulfill given dependency

Todo:
unit tests
Parameters
string$extensionKey
Dependency$dependency
Exceptions
ExceptionUnresolvedDependencyException
Returns
void

Definition at line 396 of file DependencyUtility.php.

References Dependency\getIdentifier(), DependencyUtility\getLatestCompatibleExtensionByIntegerVersionDependency(), DependencyUtility\isDependentExtensionLoaded(), DependencyUtility\isDownloadableVersionCompatible(), and DependencyUtility\isExtensionDownloadableFromTer().

Referenced by DependencyUtility\getExtensionFromRepository().

getLatestCompatibleExtensionByIntegerVersionDependency ( Dependency  $dependency)
protected

Get the latest compatible version of an extension that fulfills the given dependency from TER

Parameters
Dependency$dependency
Returns
Extension

Definition at line 539 of file DependencyUtility.php.

References Dependency\getIdentifier(), and DependencyUtility\getLowestAndHighestIntegerVersions().

Referenced by DependencyUtility\getExtensionFromTer().

getLowestAndHighestIntegerVersions ( Dependency  $dependency)
protected

Return array of lowest and highest version of dependency as integer

Parameters
Dependency$dependency
Returns
array

Definition at line 556 of file DependencyUtility.php.

References VersionNumberUtility\convertVersionNumberToInteger(), Dependency\getHighestVersion(), and Dependency\getLowestVersion().

Referenced by DependencyUtility\getLatestCompatibleExtensionByIntegerVersionDependency(), and DependencyUtility\isDownloadableVersionCompatible().

hasDependencyErrors ( )

Returns TRUE if a dependency error was found

Returns
bool

Definition at line 188 of file DependencyUtility.php.

injectEmConfUtility ( \TYPO3\CMS\Extensionmanager\Utility\EmConfUtility  $emConfUtility)
Parameters
\TYPO3\CMS\Extensionmanager\Utility\EmConfUtility$emConfUtility

Definition at line 100 of file DependencyUtility.php.

References DependencyUtility\$emConfUtility.

injectExtensionRepository ( \TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository  $extensionRepository)
Parameters
\TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository$extensionRepository

Definition at line 84 of file DependencyUtility.php.

References DependencyUtility\$extensionRepository.

injectListUtility ( \TYPO3\CMS\Extensionmanager\Utility\ListUtility  $listUtility)
Parameters
\TYPO3\CMS\Extensionmanager\Utility\ListUtility$listUtility

Definition at line 92 of file DependencyUtility.php.

References DependencyUtility\$listUtility.

injectManagementService ( \TYPO3\CMS\Extensionmanager\Service\ExtensionManagementService  $managementService)
Parameters
\TYPO3\CMS\Extensionmanager\Service\ExtensionManagementService$managementService

Definition at line 108 of file DependencyUtility.php.

References DependencyUtility\$managementService.

injectObjectManager ( \TYPO3\CMS\Extbase\Object\ObjectManager  $objectManager)
Parameters
\TYPO3\CMS\Extbase\Object\ObjectManager$objectManager

Definition at line 76 of file DependencyUtility.php.

References DependencyUtility\$objectManager.

isAvailableVersionCompatible ( Dependency  $dependency)
protected

Checks whether the available version is compatible

Parameters
Dependency$dependency
Returns
bool

Definition at line 499 of file DependencyUtility.php.

References Dependency\getIdentifier(), DependencyUtility\isVersionCompatible(), and DependencyUtility\setAvailableExtensions().

Referenced by DependencyUtility\checkExtensionDependency().

isDependentExtensionAvailable (   $extensionKey)
protected

Checks whether the needed extension is available (not necessarily installed, but present in system)

Parameters
string$extensionKey
Returns
bool

Definition at line 487 of file DependencyUtility.php.

References DependencyUtility\setAvailableExtensions().

Referenced by DependencyUtility\checkExtensionDependency().

isDependentExtensionLoaded (   $extensionKey)
protected
Parameters
string$extensionKey
Returns
bool

Definition at line 449 of file DependencyUtility.php.

References ExtensionManagementUtility\isLoaded().

Referenced by DependencyUtility\checkExtensionDependency(), and DependencyUtility\getExtensionFromTer().

isDownloadableVersionCompatible ( Dependency  $dependency)
protected

Checks whether a compatible version of the extension exists in TER

Parameters
Dependency$dependency
Returns
bool

Definition at line 523 of file DependencyUtility.php.

References Dependency\getIdentifier(), and DependencyUtility\getLowestAndHighestIntegerVersions().

Referenced by DependencyUtility\getExtensionFromTer().

isExtensionDownloadableFromTer (   $extensionKey)
protected

Checks whether a ter extension with $extensionKey exists

Parameters
string$extensionKey
Returns
bool

Definition at line 512 of file DependencyUtility.php.

Referenced by DependencyUtility\getExtensionFromTer().

isLoadedVersionCompatible ( Dependency  $dependency)
protected
isVersionCompatible (   $version,
Dependency  $dependency 
)
protected
Parameters
string$version
Dependency$dependency
Returns
bool

Definition at line 469 of file DependencyUtility.php.

References Dependency\getHighestVersion(), and Dependency\getLowestVersion().

Referenced by DependencyUtility\isAvailableVersionCompatible(), and DependencyUtility\isLoadedVersionCompatible().

setAvailableExtensions ( )
protected

Setter for available extensions gets available extensions from list utility if not already done

Returns
void

Definition at line 128 of file DependencyUtility.php.

Referenced by DependencyUtility\isAvailableVersionCompatible(), and DependencyUtility\isDependentExtensionAvailable().

setLocalExtensionStorage (   $localExtensionStorage)
Parameters
string$localExtensionStorage
Returns
void

Definition at line 117 of file DependencyUtility.php.

References DependencyUtility\$localExtensionStorage.

setSkipDependencyCheck (   $skipDependencyCheck)
Parameters
bool$skipDependencyCheck
Returns
void

Definition at line 137 of file DependencyUtility.php.

References DependencyUtility\$skipDependencyCheck.

Member Data Documentation

$availableExtensions = []
protected

Definition at line 56 of file DependencyUtility.php.

$dependencyErrors = []
protected
$emConfUtility
protected

Definition at line 46 of file DependencyUtility.php.

Referenced by DependencyUtility\injectEmConfUtility().

$extensionRepository
protected

Definition at line 36 of file DependencyUtility.php.

Referenced by DependencyUtility\injectExtensionRepository().

$listUtility
protected

Definition at line 41 of file DependencyUtility.php.

Referenced by DependencyUtility\injectListUtility().

$localExtensionStorage = ''
protected

Definition at line 61 of file DependencyUtility.php.

Referenced by DependencyUtility\setLocalExtensionStorage().

$managementService
protected

Definition at line 51 of file DependencyUtility.php.

Referenced by DependencyUtility\injectManagementService().

$objectManager
protected

Definition at line 31 of file DependencyUtility.php.

Referenced by DependencyUtility\injectObjectManager().

$skipDependencyCheck = false
protected

Definition at line 71 of file DependencyUtility.php.

Referenced by DependencyUtility\setSkipDependencyCheck().