Breaking: #107397 - Circular dependency between ProcessedFile and Task removed
See forge#107397
Description
The circular dependency between
Processed
and File Processing Task
classes has been resolved to improve the architecture and maintainability
of the file processing system.
The following changes have been made to
Processed
:
- The public method
get
has been removedTask () - The public method
generate
has been removedProcessed File Name Without Extension ()
The following changes have been made to
Processed
:
- Method
add
now requires a() Task
parameterInterface - Method
update
now requires a() Task
parameterInterface
The checksum validation logic has been moved
from
Processed
to
Abstract
Impact
Any code that calls the following methods will cause PHP fatal errors:
Processed
File->get Task () Processed
File->generate Processed File Name Without Extension ()
Any code that calls
Processed
or
Processed
without the new
Task
parameter will cause PHP fatal errors.
Code that relied on
Processed
objects having Task objects available
internally will no longer work, as Task objects are now created externally
by
File
when needed.
Affected installations
Installations with custom file processing extensions or custom Task
implementations that directly interact with the
Processed
method are affected. The extension scanner will report any usage of
Processed
and
Processed
as weak match.
Extensions that manually call
Processed
or
Processed
are also affected. The extension
scanner will not report any usage of these methods due to too many weak matches.
Migration
Replace calls to
Processed
with direct creation of Task
objects through the
Task
:
// Before
$task = $processedFile->getTask();
// After
$taskTypeRegistry = GeneralUtility::makeInstance(TaskTypeRegistry::class);
$task = $taskTypeRegistry->getTaskForType(
$processedFile->getTaskType(),
$processedFile,
$processedFile->getProcessingConfiguration()
);
It is recommended to implement your own alternative to
Processed
:
Update calls to
Processed
and
Processed
:
// Before
$processedFileRepository->add($processedFile);
$processedFileRepository->update($processedFile);
// After
$task = $taskTypeRegistry->getTaskForType(
$processedFile->getTaskType(),
$processedFile,
$processedFile->getProcessingConfiguration()
);
$processedFileRepository->add($processedFile, $task);
$processedFileRepository->update($processedFile, $task);