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.
I've been working with some config files from different sources over the last few days and keeping track of which site config(2).tar.gz config(3).tar.gz came from becomes an increasingly difficult task.
Following the example of backup and migrate I've attached what I hope a fix for this issue might look like.
Comment | File | Size | Author |
---|---|---|---|
#10 | better_file_name_for-2547865-10.patch | 2 KB | StryKaizer |
#10 | test_only-better_file_name_for-2547865-10.patch | 1.11 KB | StryKaizer |
Comments
Comment #2
hron84 CreditAttribution: hron84 as a volunteer commentedCould you please also add $_SERVER['SERVER_PORT'] to the filename if it is not equals to 80 or 443? It would be important since some development systems can look like run different Drupal instances on different ports and not everyone can/would like to edit hosts file just to make different hostnames.
Otherwise, I support this patch.
Comment #3
alexpottThis change makes tonnes of sense.
I think the host name should come the request using Request::getHost().
Comment #4
alexpottI think a test will break.
Comment #5
alexpottAlso I this is a task not a feature request.
Comment #6
dawehnerHaha, so does that mean we have no test coverage at all for this feature? Oh wait, actually we do have test coverage, we just get the raw content
and not care about the used filename, see
core/modules/config/src/Tests/ConfigExportUITest.php:53
Comment #7
alexpottSo we need tests then.
Comment #8
mrf CreditAttribution: mrf at Chapter Three commentedHere is an update using getHttpHost() method and the request time to make this easier to test.
Next step is the actual tests but wanted to actually get this up since its been sitting lonely on my machine for two days.
Comment #9
mrf CreditAttribution: mrf at Chapter Three commentedOh and hron84 to address your concern that method is supposed to return the port number if its nonstandard according to the docs.
Comment #10
StryKaizerTest attached + patch including test
I made one change to the original patch in #8, I added quotes around the filename
Comment #12
borisson_The test added in #10 looks sufficient (test only fails, as expected).
Comment #13
yoroy CreditAttribution: yoroy as a volunteer commentedSo, what's the proposed new file name, I can't tell from the patch :-)
Comment #14
borisson_@yoroy, the new filename will be
config-$hostname-$date.tar.gz
where$hostname
is the host name of the server the installation is running on and$date
is the request-date formatted asY-m-d-H-i
.An example is:
config-d8-dev-2015-08-26-15-28.tar.gz
(my hostname is d8.dev).Comment #15
yoroy CreditAttribution: yoroy as a volunteer commentedExcellent, that makes a lot of sense. Thank you borisson_.
Comment #16
alexpottBeta evaluation: This is a really nice usability fix with no disruption.
Committed 3a0a28e and pushed to 8.0.x. Thanks!