ExtensionRepository
readonly class \
- Implements
- ExtensionCatalogueInterface, PackageResolverInterface
A repository for extensions.
The implementation does not filter extension marked as insecure, this has to happen on a different level when needed.
The packages offered for download are resolved through the TER REST API first, so downloads, dependencies and updates are as current as the catalogue browsed in the module. The imported extension list answers whenever TER does not know an extension, can not be asked, or "offlineMode" is enabled.
Internal
This class is a specific domain repository implementation and is not part of the Public TYPO3 API.
Table of Contents
Interfaces
- ExtensionCatalogueInterface
- The catalogue of extensions offered for installation, as the "Get Extensions" module browses it: one page of the list at a time, the search, the versions of a single extension and the distributions.
- PackageResolverInterface
- Pins down which exact package a download, an update or a dependency means.
Methods
- __construct() : mixed
- countAll() : int
- The number of extensions {@see findAll} pages through.
- countByTitleOrAuthorNameOrExtensionKey() : int
- The number of records {@see findByTitleOrAuthorNameOrExtensionKey} matches, without the relevance ranking, which only determines their order.
- findAll() : Extension[]
- Returns one page of the catalogue. The order is stabilised by the extension key, as "last_updated" alone is not unique and offset based paging needs a total order to not repeat or skip rows between pages.
- findAllCommunityDistributions() : Extension[]
- Find all extensions with category "distribution" not published by the TYPO3 CMS Team.
- findAllOfficialDistributions() : Extension[]
- Find all extensions with category "distribution" that have been published by the TYPO3 CMS Team.
- findByExtensionKeyOrderedByVersion() : Extension[]
- All versions of a single extension, highest version first.
- findByTitleOrAuthorNameOrExtensionKey() : Extension[]
- Find extensions by title, author name or extension key.
- findByVersionRangeAndExtensionKeyOrderedByVersion() : Extension[]
- Find an extension between a certain version range ordered by version number.
- findHighestAvailableVersion() : Extension|null
- Find the highest version available of an extension.
- findOneByCurrentVersionByExtensionKey() : Extension|null
- The version of an extension that is currently offered for installation, or null if the catalogue does not know the extension.
- findOneByExtensionKeyAndVersion() : Extension|null
- Find a single extension by key and version when the remote is not known.
- findOneByPackageIdentifier() : Extension|null
- Resolve a single package by its full remote identity (package key + version + remote).
- getByPackageIdentifier() : Extension
- Same as findOneByPackageIdentifier(), but for callers which can not deal with a missing record. Records are dropped and recreated whenever an extension list is updated, so a package taken from an outdated view may not resolve anymore.
- filterYoungestVersionOfExtensionList() : Extension[]
- Filter a list of various extensions in various versions to return a list containing the extension-version combination with the highest version number.
- getExtensionsSuitableForTypo3Version() : Extension[]
- Get extensions (out of a given list) that are suitable for the current TYPO3 version
Methods
__construct()
public
__construct(ConnectionPool $connectionPool, TerApiClient $terApiClient, TerExtensionMapper $terExtensionMapper, ExtensionConfiguration $extensionConfiguration, LoggerInterface $logger) : mixed
Parameters
- $connectionPool : ConnectionPool
- $terApiClient : TerApiClient
- $terExtensionMapper : TerExtensionMapper
- $extensionConfiguration : ExtensionConfiguration
- $logger : LoggerInterface
countAll()
The number of extensions {@see findAll} pages through.
public
countAll() : int
Return values
intcountByTitleOrAuthorNameOrExtensionKey()
The number of records {@see findByTitleOrAuthorNameOrExtensionKey} matches, without the relevance ranking, which only determines their order.
public
countByTitleOrAuthorNameOrExtensionKey(string $searchString) : int
Parameters
- $searchString : string
Return values
intfindAll()
Returns one page of the catalogue. The order is stabilised by the extension key, as "last_updated" alone is not unique and offset based paging needs a total order to not repeat or skip rows between pages.
public
findAll(int $offset, int $limit) : Extension[]
Parameters
- $offset : int
- $limit : int
Return values
Extension[]findAllCommunityDistributions()
Find all extensions with category "distribution" not published by the TYPO3 CMS Team.
public
findAllCommunityDistributions([bool $showUnsuitableDistributions = false ]) : Extension[]
Parameters
- $showUnsuitableDistributions : bool = false
Return values
Extension[]findAllOfficialDistributions()
Find all extensions with category "distribution" that have been published by the TYPO3 CMS Team.
public
findAllOfficialDistributions([bool $showUnsuitableDistributions = false ]) : Extension[]
Parameters
- $showUnsuitableDistributions : bool = false
Return values
Extension[]findByExtensionKeyOrderedByVersion()
All versions of a single extension, highest version first.
public
findByExtensionKeyOrderedByVersion(string $extensionKey) : Extension[]
Parameters
- $extensionKey : string
Return values
Extension[]findByTitleOrAuthorNameOrExtensionKey()
Find extensions by title, author name or extension key.
public
findByTitleOrAuthorNameOrExtensionKey(string $searchString, int $offset, int $limit) : Extension[]
Uses a simple scoring to sort matches.
The relevance ranking is not unique, so the extension key stabilises the order: offset based paging needs a total order to not repeat or skip rows between pages.
Parameters
- $searchString : string
-
The string to search for extensions
- $offset : int
- $limit : int
Return values
Extension[]findByVersionRangeAndExtensionKeyOrderedByVersion()
Find an extension between a certain version range ordered by version number.
public
findByVersionRangeAndExtensionKeyOrderedByVersion(string $extensionKey[, int $lowestVersion = 0 ][, int $highestVersion = 0 ][, bool $includeCurrentVersion = true ]) : Extension[]
Parameters
- $extensionKey : string
- $lowestVersion : int = 0
- $highestVersion : int = 0
- $includeCurrentVersion : bool = true
Return values
Extension[]findHighestAvailableVersion()
Find the highest version available of an extension.
public
findHighestAvailableVersion(string $extensionKey) : Extension|null
Parameters
- $extensionKey : string
Return values
Extension|nullfindOneByCurrentVersionByExtensionKey()
The version of an extension that is currently offered for installation, or null if the catalogue does not know the extension.
public
findOneByCurrentVersionByExtensionKey(string $extensionKey) : Extension|null
Parameters
- $extensionKey : string
Return values
Extension|nullfindOneByExtensionKeyAndVersion()
Find a single extension by key and version when the remote is not known.
public
findOneByExtensionKeyAndVersion(string $extensionKey, string $version) : Extension|null
Callers that do know the remote should use findOneByPackageIdentifier instead.
Note: if the same key/version exists for more than one remote the returned record is arbitrary. This is intentional for the two use-cases that require it: looking up TER data for a locally installed extension (no remote stored on disk) and the update flow, where the frontend currently only submits key and version.
Parameters
- $extensionKey : string
- $version : string
-
(example: 4.3.10)
Return values
Extension|nullfindOneByPackageIdentifier()
Resolve a single package by its full remote identity (package key + version + remote).
public
findOneByPackageIdentifier(PackageIdentifier $packageIdentifier) : Extension|null
All three fields are applied as constraints, which addresses exactly one record due to the unique key over these fields. Use findOneByExtensionKeyAndVersion when the remote is not known.
Parameters
- $packageIdentifier : PackageIdentifier
Return values
Extension|nullgetByPackageIdentifier()
Same as findOneByPackageIdentifier(), but for callers which can not deal with a missing record. Records are dropped and recreated whenever an extension list is updated, so a package taken from an outdated view may not resolve anymore.
public
getByPackageIdentifier(PackageIdentifier $packageIdentifier) : Extension
Parameters
- $packageIdentifier : PackageIdentifier
Tags
Return values
ExtensionfilterYoungestVersionOfExtensionList()
Filter a list of various extensions in various versions to return a list containing the extension-version combination with the highest version number.
protected
filterYoungestVersionOfExtensionList(Extension[] $extensions, bool $showUnsuitable) : Extension[]
Parameters
- $extensions : Extension[]
- $showUnsuitable : bool
Return values
Extension[]getExtensionsSuitableForTypo3Version()
Get extensions (out of a given list) that are suitable for the current TYPO3 version
protected
getExtensionsSuitableForTypo3Version(Extension[] $extensions) : Extension[]
Parameters
- $extensions : Extension[]
-
List of extensions to check
Return values
Extension[] —List of extensions suitable for current TYPO3 version