BulkExtensionRepositoryWriter implements SplObserver
Importer object for extension list, which handles the XML parser and writes directly into the database.
This class is a specific domain repository implementation and is not part of the Public TYPO3 API.
Attributes
- #[Autoconfigure]
- $public: true
Table of Contents
Interfaces
- SplObserver
Properties
- $arrRows : array<string|int, mixed>
- Keeps record values to be inserted into database.
- $connectionPool : ConnectionPool
- $extensionModel : Extension
- $extensionRepository : ExtensionRepository
- $fieldNames : array<string|int, mixed>
- Keeps fieldnames of tx_extensionmanager_domain_model_extension table.
- $maxRowsPerChunk : int
- Maximum of rows that can be used in a bulk insert for the current database platform.
- $minimumDateToImport : int
- Only import extensions newer than this date (timestamp), see constructor
- $parser : ExtensionXmlParser
- $remoteIdentifier : string
- Keeps the information from which remote the extension list was fetched.
- $sumRecords : int
- Keeps number of processed version records.
Methods
- __construct() : mixed
- Method retrieves and initializes extension XML parser instance.
- import() : void
- Method initializes parsing of extension.xml.gz file.
- update() : void
- Method receives an update from a subject.
- fetchMaximalVersionsForAllExtensions() : array<string|int, mixed>
- Fetches the UIDs of all maximal versions for all extensions.
- loadIntoDatabase() : void
- Method collects and stores extension version details into the database.
- markExtensionWithMaximumVersionAsCurrent() : void
- Sets current_version = 1 for all extensions where the extension version is maximal.
Properties
$arrRows
Keeps record values to be inserted into database.
protected
array<string|int, mixed>
$arrRows
= []
$connectionPool
protected
ConnectionPool
$connectionPool
$extensionModel
protected
Extension
$extensionModel
$extensionRepository
protected
ExtensionRepository
$extensionRepository
$fieldNames
Keeps fieldnames of tx_extensionmanager_domain_model_extension table.
protected
static array<string|int, mixed>
$fieldNames
= ['extension_key', 'version', 'integer_version', 'current_version', 'alldownloadcounter', 'downloadcounter', 'title', 'ownerusername', 'author_name', 'author_email', 'authorcompany', 'last_updated', 'md5hash', 'remote', 'state', 'review_state', 'category', 'description', 'serialized_dependencies', 'update_comment', 'documentation_link', 'distribution_image', 'distribution_welcome_image']
$maxRowsPerChunk
Maximum of rows that can be used in a bulk insert for the current database platform.
protected
int
$maxRowsPerChunk
= 50
$minimumDateToImport
Only import extensions newer than this date (timestamp), see constructor
protected
int
$minimumDateToImport
$parser
protected
ExtensionXmlParser
$parser
$remoteIdentifier
Keeps the information from which remote the extension list was fetched.
protected
string
$remoteIdentifier
$sumRecords
Keeps number of processed version records.
protected
int
$sumRecords
= 0
Methods
__construct()
Method retrieves and initializes extension XML parser instance.
public
__construct(ExtensionRepository $repository, Extension $extension, ConnectionPool $connectionPool, ExtensionXmlParser $parser) : mixed
Parameters
- $repository : ExtensionRepository
- $extension : Extension
- $connectionPool : ConnectionPool
- $parser : ExtensionXmlParser
Tags
import()
Method initializes parsing of extension.xml.gz file.
public
import(string $localExtensionListFile, string $remoteIdentifier) : void
Parameters
- $localExtensionListFile : string
-
absolute path to extension list xml.gz
- $remoteIdentifier : string
-
identifier of the remote when inserting records into DB
update()
Method receives an update from a subject.
public
update(SplSubject $subject) : void
Parameters
- $subject : SplSubject
-
a subject notifying this observer
fetchMaximalVersionsForAllExtensions()
Fetches the UIDs of all maximal versions for all extensions.
protected
fetchMaximalVersionsForAllExtensions(string $remoteIdentifier) : array<string|int, mixed>
This is done by doing a LEFT JOIN to itself ("a" and "b") and comparing both integer_version fields.
Parameters
- $remoteIdentifier : string
Return values
array<string|int, mixed>loadIntoDatabase()
Method collects and stores extension version details into the database.
protected
loadIntoDatabase(ExtensionXmlParser $subject) : void
Parameters
- $subject : ExtensionXmlParser
-
a subject notifying this observer
markExtensionWithMaximumVersionAsCurrent()
Sets current_version = 1 for all extensions where the extension version is maximal.
protected
markExtensionWithMaximumVersionAsCurrent(string $remoteIdentifier) : void
For performance reasons, the "native" database connection is used here directly.
Parameters
- $remoteIdentifier : string