TerExtensionRemote implements ExtensionDownloaderRemoteInterface, ListableRemoteInterface
Class for downloading .t3x files from extensions.typo3.org and validating the results.
This also includes the ListableRemoteInterface, which means it downloads extensions.xml.gz files and can import it in the database.
This is the only dependency for the concrete TER implementation on extensions.typo3.org and encapsulates the definition where an extension is located in TER.
Not responsible for:
- installing / activating an extension
Table of Contents
Interfaces
- ExtensionDownloaderRemoteInterface
- API for downloading packages from a remote server and validating the downloaded results.
- ListableRemoteInterface
- API for downloading a list of available packages from a server.
Properties
- $identifier : string
- $localExtensionListCacheFile : string
- $remoteBase : string
Methods
- __construct() : mixed
- downloadExtension() : void
- Downloads a single extension, and extracts the t3x file into a target location folder.
- getAvailablePackages() : void
- Download the xml.gz file, and extract it into the database.
- getIdentifier() : string
- Returns the remote identifier
- getLastUpdate() : DateTimeInterface
- Get the time when the remote was updated the last time.
- needsUpdate() : bool
- Checks whether the remote is outdated and should fetch latest updates.
- decodeExchangeData() : array<string|int, mixed>
- Decodes extension array from t3x file contents.
- downloadFile() : ResponseInterface
- Internal method
- fetchPackageList() : void
- Downloads the extensions.xml.gz and imports it into the database.
- isDownloadedExtensionListUpToDate() : bool
- TER provides an extensions.md5 which contains the hashsum of the current remote extensions.gz file.
- isDownloadedPackageValid() : bool
- Validates the integrity of the contents of a downloaded file.
Properties
$identifier
protected
string
$identifier
$localExtensionListCacheFile
protected
string
$localExtensionListCacheFile
$remoteBase
protected
string
$remoteBase
= 'https://extensions.typo3.org/fileadmin/ter/'
Methods
__construct()
public
__construct(string $identifier[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $identifier : string
- $options : array<string|int, mixed> = []
downloadExtension()
Downloads a single extension, and extracts the t3x file into a target location folder.
public
downloadExtension(string $extensionKey, string $version, FileHandlingUtility $fileHandler[, string|null $verificationHash = null ][, string $pathType = 'Local' ]) : void
Parameters
- $extensionKey : string
-
a lower-cased extension key
- $version : string
-
the version to be fetched e.g. 1.5.2
- $fileHandler : FileHandlingUtility
-
the file handler which deals with unpacking the files
- $verificationHash : string|null = null
- $pathType : string = 'Local'
-
either "Local", "System" or "Global"
Tags
getAvailablePackages()
Download the xml.gz file, and extract it into the database.
public
getAvailablePackages([bool $force = false ]) : void
Parameters
- $force : bool = false
getIdentifier()
Returns the remote identifier
public
getIdentifier() : string
Return values
stringgetLastUpdate()
Get the time when the remote was updated the last time.
public
getLastUpdate() : DateTimeInterface
Return values
DateTimeInterfaceneedsUpdate()
Checks whether the remote is outdated and should fetch latest updates.
public
needsUpdate() : bool
Return values
booldecodeExchangeData()
Decodes extension array from t3x file contents.
protected
decodeExchangeData(string $stream) : array<string|int, mixed>
This kind of data is when an extension is uploaded to TER
Parameters
- $stream : string
-
Data stream
Tags
Return values
array<string|int, mixed> —Array with result on success, otherwise an error string.
downloadFile()
Internal method
protected
downloadFile(string $remotePath) : ResponseInterface
Parameters
- $remotePath : string
Tags
Return values
ResponseInterfacefetchPackageList()
Downloads the extensions.xml.gz and imports it into the database.
protected
fetchPackageList() : void
isDownloadedExtensionListUpToDate()
TER provides an extensions.md5 which contains the hashsum of the current remote extensions.gz file.
protected
isDownloadedExtensionListUpToDate() : bool
Let's check if this is the same, if so, it is not needed to download a new extensions.gz.
Return values
boolisDownloadedPackageValid()
Validates the integrity of the contents of a downloaded file.
protected
isDownloadedPackageValid(string $expectedHash, string $fileContents) : bool
Parameters
- $expectedHash : string
- $fileContents : string