Problem/Motivation
We need to import components in a flexible way and assure that all dependencies are met correctly. The current process import all at the same time, not allowing partial component importing or checking for dependencies.
Proposed resolution
Create a set of methods that analyze component files and generate an ordered and prioritized list of components and then import them.
Remaining tasks
This is a raw work in progress, and the idea is to discuss the best way to achieve what we need. Right now there is a lot stuff to change in order to provide this feature completely. Only to mention:
load() (for storage class)
In the future we will need to import independent files, perhaps, from random paths. So we have to provide a way to override root path for configuration files.
checkDependencies()
Right now is only checking for dependencies in staging and files. We have to cover actual active store objects in order to provide features like importing independent files directly to activestore.
User interface changes
None
API changes
2 new method for the Configuration class.
getPriorizatedDependencies()
Recursively check a component and its dependencies to build an ordered array of components to be imported related to a single component.
checkNewConfigurations()
Use getPriorizatedDependencies() to generate a more general array that cover all components for an import process. Right now is using a static variable to assure that we do not include any component more than 1 time.
Major change to importAllNewConfigurations() now called importConfigurations()
No it receives an array of components in order to process and import them.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | configuration_new_dependency_logic-7.patch | 5.96 KB | gdrupal |
| #5 | configuration_new_dependency_logic-5.patch | 7.31 KB | gdrupal |
| #2 | configuration_new_dependency_logic-2.patch | 11.85 KB | gdrupal |
| configuration_new_dependency_logic.patch | 5.97 KB | gdrupal |
Comments
Comment #1
gdrupal commentedComment #2
gdrupal commentedWork in progress.
Comment #3
dagmarWhat does this \A means?
I've seen issues witht the use of $file->name, it's a problem with the namespaces.
This is not neccesary to change. Maybe a problem with your IDE.
There a are a lot of changes (removed empty lines and alignment issues) that make this patch harder to review, please try to ajust your ide settings to reflect only the important changes.
Comment #4
gdrupal commentedFor taking files that only begins with a string if not, you get any file with "menu" string when looking "menu" for example you will get "view.menu-data" or "menulink.main-menu.218.Home".
I did not know about that We can use the array instead, NP!
About Other changes of coding "look", I have my ide configured to follow drupal coding standar so when I use auto format to remove tailing spaces and so, it fixes indent too and other stuff.
Comment #5
gdrupal commentedNew patch with fixes..
Comment #6
dagmar$id could be defined outside the if. It is defined twice in the if and in the else.
Question. What about use the key of component_ordered_stack instead of add a new item using $component_ordered_stack? This is because we could have duplicated values in the stack if we are not using the $id as the key of the array. Also I think is faster than use in_array().
Finally, there are several empty lines removed at the begining of the patch. I preffer to have an empty line between each class property.
Comment #7
gdrupal commentedNew patch with more fixes ;)
Comment #8
dagmarThis have been fixed with #1774006: Fix the import system based on dependencies.
Comment #9.0
(not verified) commentedUpdated for matching 2nd patch