You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Disclaimer: I only did about 30 minutes of code reading before putting this post together, however I have been using spatie/laravel-backup for 3ish years now.
#TLDR
There appears to be no way to append a static string to the default file name (at the time backup:run is called, ie: no flag/option) and I would like to propose this be changed.
I think there are many options, but the best that I can see are the following, in no particular order (depending on initial rationale of --filename and its intended functionality):
Repurpose --filename to be an append to the existing DefaultFilename as defined in BackupJob->setDefaultFilename()
Create a new option (such as --filename-append)
Choose not to support appending and make me (and likely others) do weird non-sense in shell scripts. [I would be very sad if this is the chosen option]
Current Situation
Here are a couple things to keep in mind:
Based on the installation and Setup steps, the current recommendation (as of V8) is to use the console scheduler (no issue there).
There is currently a config value (backup.backup.destination.filename_prefix) to prepend a specific value to the zip placed in the temporary location (and then uploaded with the same name to the configured disks)
The functionality currently provided makes sense, under most circumstances the default date stamp naming convention can handle the situation. If you need to make a specific differentiation between backups (such as for different environments), you can use the filename_prefix.
Investigation
Context
I think there is another use case that is being missed. In my case, I only run deploy's to production on a relatively infrequent schedule. This leads to larger batches of changes getting deployed, and I would ideally like to have a backup auto-magically run before the deploy.
Injecting a php artisan backup:run is not problematic, however when I started investigating the parameters of backup:run I noticed the --filename option.
Findings
Upon, a little bit of, further investigation this appears to be injecting the filename (provided via the command option) into BackupJob->setFilename().
From what I can see this will completely override the date stamp naming convention (provided by default), which could cause naming conflicts when attempting to upload.
Proposal
There appears to be no way to append a static string to the default file name (at the time backup:run is called, ie: no flag/option) and I would like to propose this be changed. There is currently a good use case for prepending, so here is my case for appending (at least to the default filename, but maybe more).
Based on the provided context, you might be wondering, "why?". Being able to append to the file name, will allow for proper sorting in any operating system, while also allow for differentiation (ie: this backup took place before a deployment). Another use case would be to differentiate db-only vs code-only backups when reviewing disks.
I think there are many options, but the best that I can see are the following, in no particular order (depending on initial rationale of --filename and its intended functionality):
Repurpose --filename to be an append to the existing DefaultFilename as defined in BackupJob->setDefaultFilename()
Create a new option (such as --filename-append)
Choose not to support appending and make me (and likely others) do weird non-sense in shell scripts. [I would be very sad if this is the chosen option]
Let me know if you have any questions or concerns, let me know if a PR would be helpful.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Disclaimer: I only did about 30 minutes of code reading before putting this post together, however I have been using spatie/laravel-backup for 3ish years now.
#TLDR
Current Situation
Here are a couple things to keep in mind:
backup.backup.destination.filename_prefix
) to prepend a specific value to the zip placed in the temporary location (and then uploaded with the same name to the configured disks)The functionality currently provided makes sense, under most circumstances the default date stamp naming convention can handle the situation. If you need to make a specific differentiation between backups (such as for different environments), you can use the
filename_prefix
.Investigation
Context
I think there is another use case that is being missed. In my case, I only run deploy's to production on a relatively infrequent schedule. This leads to larger batches of changes getting deployed, and I would ideally like to have a backup auto-magically run before the deploy.
Injecting a
php artisan backup:run
is not problematic, however when I started investigating the parameters ofbackup:run
I noticed the--filename
option.Findings
Upon, a little bit of, further investigation this appears to be injecting the filename (provided via the command option) into
BackupJob->setFilename()
.From what I can see this will completely override the date stamp naming convention (provided by default), which could cause naming conflicts when attempting to upload.
Proposal
There appears to be no way to append a static string to the default file name (at the time
backup:run
is called, ie: no flag/option) and I would like to propose this be changed. There is currently a good use case for prepending, so here is my case for appending (at least to the default filename, but maybe more).Based on the provided context, you might be wondering, "why?". Being able to append to the file name, will allow for proper sorting in any operating system, while also allow for differentiation (ie: this backup took place before a deployment). Another use case would be to differentiate db-only vs code-only backups when reviewing disks.
I think there are many options, but the best that I can see are the following, in no particular order (depending on initial rationale of
--filename
and its intended functionality):--filename
to be an append to the existing DefaultFilename as defined inBackupJob->setDefaultFilename()
--filename-append
)Let me know if you have any questions or concerns, let me know if a PR would be helpful.
Beta Was this translation helpful? Give feedback.
All reactions