Skip to content
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

Added null option for unlimited backup storage size #1788

Merged
merged 3 commits into from
May 2, 2024

Conversation

rcerljenko
Copy link
Contributor

Hi,

I've added unlimited storage option for backups. We had a situation where we wanted to keep our backups for 30 days (backup command is run every hour) and it's a fairly large databse which grows each day so it's a little hard to determine max limit for storage and it feels kinda wrong to set it to some very very big number.

Thx!

@freekmurze
Copy link
Member

Instead of 0 could you use null to use this feature?

@rcerljenko
Copy link
Contributor Author

Instead of 0 could you use null to use this feature?

Sure


if (!$maximumSize || ($backups->size() + $this->newestBackup->sizeInBytes()) <= $maximumSize) {
if ($maximumSize === null || ($backups->size() + $this->newestBackup->sizeInBytes()) <= $maximumSize * 1024 * 1024) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is getting a bit unreadable. Could you extract this check to a separate function with a good name and early returns so we can avoid using ||

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem

@rcerljenko rcerljenko changed the title Added 0 option for unlimited backup storage size Added null option for unlimited backup storage size May 2, 2024
@freekmurze freekmurze merged commit 1afee28 into spatie:main May 2, 2024
6 checks passed
@freekmurze
Copy link
Member

Thanks!

@rcerljenko rcerljenko deleted the feature/unlimited-storage branch May 2, 2024 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants