-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support the ignore of config collections #17
base: 8.x-1.x
Are you sure you want to change the base?
Conversation
Having this would be great thanks! We also want to ignore a whole language collection. Is there a current workaround to do this? If not, it would be very important to get this functionality in. |
Hey, I'm not familiar with collections - can you give me some more background/link to some docs? Thanks |
Hi @larowlan, been a while but I'll try to explain it as best as I can. Basically for languages for example you can have multiple variations of the same variables for languages. In that instance I was referring to, we had for instance one code base for multiple languages. We didn't want to commit each language to the repository so we wanted to ignore entire collections. E.g. sw for the swedish language. Here is perhaps a better description as to its purpose: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I didn't know that collections existed - so thanks for the learning opportunity.
Couple of minor comments
@@ -87,24 +88,40 @@ function drush_drush_cmi_tools_config_export_plus($destination = NULL) { | |||
catch (InvalidDataTypeException $e) { | |||
$ignore_list_error = TRUE; | |||
} | |||
if (!isset($parsed['ignore']) || !is_array($parsed['ignore'])) { | |||
if (!isset($parsed['ignore']) || !is_array($parsed['ignore']) || !isset($parsed['ignore_collection']) || !is_array($parsed['ignore_collection'])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a hard break - can we make existing config-ignore.yml files that don't have the ignore_collection key continue to work?
e.g. we could
$parsed += ['ignore_collection' => []];
``
} | ||
$collection_directories = explode('/', $collection_dir); | ||
$collection_root_dir = $destination_dir . '/' . reset($collection_directories); | ||
if (is_dir($collection_root_dir) && (count(scandir($collection_root_dir)) == 2)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a comment here about what this is doing? The 2 seems magical.
Can we use glob
here - if all we're doing is removing directories that match the ignore_collection key?
We have a situation where we wish to ignore entire collections. An example would be having languages turned on but we don't necessarily want this all to be exported to config. Currently there is now way to ignore those with the file_scan_directory method using patterns. So I have added an additional option to specify a collection to ignore.
Example:
Would ignore and remove the Swedish language collection and also remove the collection root directory if empty.
Have also fixed a few formatting issues where there were two spaces instead of one after the equals sign.