Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Drush command generate-content(alias genc) doesn't validate if the content-types entered in the --type parameter --type exists in the Drupal database or not.
drush genc 2 --type=some_random_content_type_that_doesnt_exist
It goes ahead and creates the content that will not have a content type entry in the node tables. So I think it should validate the content types before actually creating the content.
Comment | File | Size | Author |
---|---|---|---|
#1 | Screenshot from 2015-01-30 17:00:34.png | 15.89 KB | gokulnk |
#1 | devel_generate_2417181_validate_cotnent_types_in_genc_command.patch | 1.59 KB | gokulnk |
Screenshot from 2015-01-30 16:58:01.png | 52.09 KB | gokulnk |
Comments
Comment #1
gokulnk CreditAttribution: gokulnk commentedProviding a patch that checks if the content types entered are present in the Drupal database and shows an appropriate Error Message.
Comment #2
chakrapani CreditAttribution: chakrapani commentedLooks good to me.
Though a more specific check can be added to identify the wrong content type, it can be a overkill.
one other suggestion is you could print available content types when there is an error.
making it RTBC as the above suggestions are optional and suggested features.
Regards
Chakrapani R
Comment #3
moshe weitzman CreditAttribution: moshe weitzman commentedThere are an endless number of validations that can be added to a program. CLI apps like Drush generally come without safety belts.