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.
Provide drush option for date range to match the functionality from UI.
Comment | File | Size | Author |
---|
Comments
Comment #1
fengtanI believe that generated nodes' post date is already randomly distributed between "now" and the selected period you pick when you create content (see attached screenshot).
I had a quick test and noticed that post dates were indeed randomly created (edit generated nodes and check the "Authoring information" fields)
Did you mean something else ?
Comment #2
barraponto CreditAttribution: barraponto commentedIndeed, dates are randomized in the form (the web user interface) but there's no option in the Drush command (the command line interface). Let's fix that! With this patch you can use date strings (it will use strtotime behind the curtains):
drush generate-content 420 0 --since='last year'
Comment #3
barraponto CreditAttribution: barraponto commentedComment #4
moshe weitzman CreditAttribution: moshe weitzman commentedPlease add one or two examples on the command definition
Comment #5
barraponto CreditAttribution: barraponto commentedPatch submitted by the Drush iq-submit command.
Comment #6
rj CreditAttribution: rj commentedThis worked for me, would love to see it committed. Thanks.
Comment #7
moshe weitzman CreditAttribution: moshe weitzman commentedStill needs Examples in Drush help and needs D8 port.
Comment #8
humansky CreditAttribution: humansky as a volunteer commentedSlightly different approach to the same problem, with added test conditions to verify the date is within valid range. Let me know what you guys think. If you like it, I will create a D8 version.
Comment #9
MustangGB CreditAttribution: MustangGB commentedI think #5 is the superior approach due to the increased flexibility.
Comment #10
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedThis is still missing. It would be good to have the drush option to match the UI option. Latest dev version is now 4.x The issue has been migrated to DrupalSpoons
https://gitlab.com/drupalspoons/devel/-/issues/237