feat: Sync revamped, faster and improved #3478
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1370
Fixes #1493
Fixes #1238
Fixes #523 (as in we do re-import and delete the previous location)
This pull request refactors the directory import functionality by introducing a pipeline-based approach with modular processing stages. The changes aim to simplify the code, improve maintainability, and enhance functionality, such as tree-based album creation and better handling of reserved directories.
Refactoring of
Exec
class:Exec
class with a pipeline-based architecture for processing imports, using theIlluminate\Pipeline\Pipeline
class. (app/Actions/Import/Exec.php
)ImportDTO
to encapsulate import parameters and state, replacing the use of multiple class properties. (app/Actions/Import/Exec.php
)normalizePath
,readLocalIgnoreList
, andcheckAgainstIgnoreList
, delegating these responsibilities to new pipeline stages. (app/Actions/Import/Exec.php
)New pipeline stages:
BuildTree:
BuildTree
pipeline stage to construct a tree structure of folders and files for import. (app/Actions/Import/Pipes/BuildTree.php
)app/Actions/Import/Pipes/BuildTree.php
)CreateNonExistingAlbums:
CreateNonExistingAlbums
stage to create albums for folders that do not already exist in the database. (app/Actions/Import/Pipes/CreateNonExistingAlbums.php
)app/Actions/Import/Pipes/CreateNonExistingAlbums.php
)Improvements to reserved directory handling:
folder_skip_list
array in theBuildTree
stage. (app/Actions/Import/Pipes/BuildTree.php
)app/Actions/Import/Pipes/BuildTree.php
)These changes significantly enhance the modularity and readability of the import process while laying the groundwork for future extensibility.