Cleaning up the backups of Snipe-IT failed v5.0.0 & v5.0.1
Please confirm you have done the following before posting your bug report:
- [x] I have enabled debug mode
- [x] I h ave read checked the Common Issues page
Describe the bug Hi, I would like to report some clean backup features which previously worked on version 4.x but after upgrading to version 5.x, the feature failed.
here is the php that I use
php --version
PHP 7.4.9 (cli) (built: Aug 7 2020 14:30:01) (NTS)
I upgraded the version using
php upgrade.php
I've done a vendor reinstall by removing the vendor folder and running
COMPOSER_CACHE_DIR=/dev/null composer install --no-dev
To Reproduce
Steps to reproduce the behavior:
- Running on crontab ( scheduler )
- Running manuall command
php artisan backup:clean
Expected behavior I hope the feature will work again
Screenshots Before upgrade to version 5
After upgrade to V5.0.0 and V5.0.1
this message when manual command
But if i delete manual from admin panel is successfull

Server (please complete the following information):
-
Snipe-IT Version v5.0.0 & v5.0.1

-
OS: Ubuntu 20.04.1 LTS
-
Web Server: Apache/2.4.41 (Ubuntu)
-
PHP Version : PHP 7.4.9
Error Messages
An error occurred while cleaning up the backups of Snipe-IT
Exception message: Trying to access array offset on value of type null
Exception trace: #0 /var/www/snipeit/vendor/spatie/laravel-backup/src/Tasks/Cleanup/Strategies/DefaultStrategy.php(47): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() #1 /var/www/snipeit/vendor/spatie/laravel-backup/src/Tasks/Cleanup/Strategies/DefaultStrategy.php(22): Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy->calculateDateRanges() #2 /var/www/snipeit/vendor/spatie/laravel-backup/src/Tasks/Cleanup/CleanupJob.php(42): Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy->deleteOldBackups() #3 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Support/Traits/EnumeratesValues.php(176): Spatie\Backup\Tasks\Cleanup\CleanupJob->Spatie\Backup\Tasks\Cleanup\{closure}() #4 /var/www/snipeit/vendor/spatie/laravel-backup/src/Tasks/Cleanup/CleanupJob.php(54): Illuminate\Support\Collection->each() #5 /var/www/snipeit/vendor/spatie/laravel-backup/src/Commands/CleanupCommand.php(42): Spatie\Backup\Tasks\Cleanup\CleanupJob->run() #6 [internal function]: Spatie\Backup\Commands\CleanupCommand->handle() #7 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array() #8 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/Util.php(36): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #9 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\Container\Util::unwrapIfClosure() #10 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod() #11 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/Container.php(590): Illuminate\Container\BoundMethod::call() #12 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Command.php(134): Illuminate\Container\Container->call() #13 /var/www/snipeit/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute() #14 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run() #15 /var/www/snipeit/vendor/spatie/laravel-backup/src/Commands/BaseCommand.php(16): Illuminate\Console\Command->run() #16 /var/www/snipeit/vendor/symfony/console/Application.php(1001): Spatie\Backup\Commands\BaseCommand->run() #17 /var/www/snipeit/vendor/symfony/console/Application.php(271): Symfony\Component\Console\Application->doRunCommand() #18 /var/www/snipeit/vendor/symfony/console/Application.php(147): Symfony\Component\Console\Application->doRun() #19 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\Component\Console\Application->run() #20 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\Console\Application->run() #21 /var/www/snipeit/artisan(35): Illuminate\Foundation\Console\Kernel->handle() #22 {main}
### I am very grateful, to the entire team and contributors who have worked to make this happen
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
Hi @denzfarid - thanks for raising this issue. I'm unfortunately unable to reproduce this locally :(
Have you tried clearing your config cache? It looks like some stuff changed between versions of the backup package we used.
https://github.com/spatie/laravel-backup/issues/1047
(You shouldn't need to republish the config file, as they mention in that post, since we publish those for you.)
Also make sure you've got the following in your .env:
PRIVATE_FILESYSTEM_DISK=local
PUBLIC_FILESYSTEM_DISK=local_public
(And clear your config cache again)
It should fall back gracefully to those settings even if you don't specify them, but it's worth a shot.
Also make sure you've got the following in your .env:
PRIVATE_FILESYSTEM_DISK=local PUBLIC_FILESYSTEM_DISK=local_public(And clear your config cache again)
It should fall back gracefully to those settings even if you don't specify them, but it's worth a shot.
I really appreciate @snipe , for taking the time to answer this ticket, on .env I have added the enviroment, but it's still the same, failed to clean up
Hi @denzfarid - thanks for raising this issue. I'm unfortunately unable to reproduce this locally :(
![]()
Have you tried clearing your config cache? It looks like some stuff changed between versions of the backup package we used.
(You shouldn't need to republish the config file, as they mention in that post, since we publish those for you.)
maybe it has a problem with the php7.4 version that I am using :)
Maaaaaybe, but that Spatie ticket I linked you to did mention that their stuff should work with PHP 7.4...
I'll check the Spatie library version tomorrow and see if maybe that's it. (It's 4AM here and I need to crash soon.)
Curious if anyone found a solution for this?
I'm also getting an error after upgrading to 5.0.4
An error occurred while cleaning up the backups of Snipe-IT
Exception message: Trying to access array offset on value of type null
Exception trace: #0 /var/www/snipeit/vendor/spatie/laravel-backup/src/Tasks/Cleanup/Strategies/DefaultStrategy.php(47): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() #1 /var/www/snipeit/vendor/spatie/laravel-backup/src/Tasks/Cleanup/Strategies/DefaultStrategy.php(22): Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy->calculateDateRanges() #2 /var/www/snipeit/vendor/spatie/laravel-backup/src/Tasks/Cleanup/CleanupJob.php(42): Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy->deleteOldBackups() #3 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Support/Traits/EnumeratesValues.php(176): Spatie\Backup\Tasks\Cleanup\CleanupJob->Spatie\Backup\Tasks\Cleanup\{closure}() #4 /var/www/snipeit/vendor/spatie/laravel-backup/src/Tasks/Cleanup/CleanupJob.php(54): Illuminate\Support\Collection->each() #5 /var/www/snipeit/vendor/spatie/laravel-backup/src/Commands/CleanupCommand.php(42): Spatie\Backup\Tasks\Cleanup\CleanupJob->run() #6 [internal function]: Spatie\Backup\Commands\CleanupCommand->handle() #7 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array() #8 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/Util.php(36): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #9 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\Container\Util::unwrapIfClosure() #10 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod() #11 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/Container.php(590): Illuminate\Container\BoundMethod::call() #12 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Command.php(134): Illuminate\Container\Container->call() #13 /var/www/snipeit/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute() #14 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run() #15 /var/www/snipeit/vendor/spatie/laravel-backup/src/Commands/BaseCommand.php(16): Illuminate\Console\Command->run() #16 /var/www/snipeit/vendor/symfony/console/Application.php(1001): Spatie\Backup\Commands\BaseCommand->run() #17 /var/www/snipeit/vendor/symfony/console/Application.php(271): Symfony\Component\Console\Application->doRunCommand() #18 /var/www/snipeit/vendor/symfony/console/Application.php(147): Symfony\Component\Console\Application->doRun() #19 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\Component\Console\Application->run() #20 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\Console\Application->run() #21 /var/www/snipeit/artisan(35): Illuminate\Foundation\Console\Kernel->handle() #22 {main}
I've made sure my .env matches the KB version, and I have also cleared my config with php artisan config:clear command.
From what I can see backups still work, just not the backup clean up.
Curious if anyone found a solution for this?
I'm also getting an error after upgrading to 5.0.4
An error occurred while cleaning up the backups of Snipe-IT Exception message: Trying to access array offset on value of type null Exception trace: #0 /var/www/snipeit/vendor/spatie/laravel-backup/src/Tasks/Cleanup/Strategies/DefaultStrategy.php(47): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() #1 /var/www/snipeit/vendor/spatie/laravel-backup/src/Tasks/Cleanup/Strategies/DefaultStrategy.php(22): Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy->calculateDateRanges() #2 /var/www/snipeit/vendor/spatie/laravel-backup/src/Tasks/Cleanup/CleanupJob.php(42): Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy->deleteOldBackups() #3 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Support/Traits/EnumeratesValues.php(176): Spatie\Backup\Tasks\Cleanup\CleanupJob->Spatie\Backup\Tasks\Cleanup\{closure}() #4 /var/www/snipeit/vendor/spatie/laravel-backup/src/Tasks/Cleanup/CleanupJob.php(54): Illuminate\Support\Collection->each() #5 /var/www/snipeit/vendor/spatie/laravel-backup/src/Commands/CleanupCommand.php(42): Spatie\Backup\Tasks\Cleanup\CleanupJob->run() #6 [internal function]: Spatie\Backup\Commands\CleanupCommand->handle() #7 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array() #8 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/Util.php(36): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #9 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\Container\Util::unwrapIfClosure() #10 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod() #11 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Container/Container.php(590): Illuminate\Container\BoundMethod::call() #12 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Command.php(134): Illuminate\Container\Container->call() #13 /var/www/snipeit/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute() #14 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run() #15 /var/www/snipeit/vendor/spatie/laravel-backup/src/Commands/BaseCommand.php(16): Illuminate\Console\Command->run() #16 /var/www/snipeit/vendor/symfony/console/Application.php(1001): Spatie\Backup\Commands\BaseCommand->run() #17 /var/www/snipeit/vendor/symfony/console/Application.php(271): Symfony\Component\Console\Application->doRunCommand() #18 /var/www/snipeit/vendor/symfony/console/Application.php(147): Symfony\Component\Console\Application->doRun() #19 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\Component\Console\Application->run() #20 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\Console\Application->run() #21 /var/www/snipeit/artisan(35): Illuminate\Foundation\Console\Kernel->handle() #22 {main}I've made sure my .env matches the KB version, and I have also cleared my config with
php artisan config:clearcommand.From what I can see backups still work, just not the backup clean up.
ticket close with some changes to the config/backup.php file
I see a difference in writing on the link https://github.com/spatie/laravel-backup/issues/1047#issuecomment-647264286 it explains that currently spatie/laravel-backup uses snake_cased
I made changes to the config/backup.php and replace with the original file from spatie https://github.com/spatie/laravel-backup/blob/master/config/backup.php#L201
here are the differences
on spatie

and this on snipe-it
https://github.com/snipe/snipe-it/blob/master/config/backup.php#L185

therefore I copied only the sections
https://github.com/spatie/laravel-backup/blob/master/config/backup.php#L201 until https://github.com/spatie/laravel-backup/blob/master/config/backup.php#L234
and it worked

@snipe can you replace the same thing in the file? please
GitHub
A package to backup your Laravel app. Contribute to spatie/laravel-backup development by creating an account on GitHub.
GitHub
A free open source IT asset/license management system - snipe/snipe-it
GitHub
A package to backup your Laravel app. Contribute to spatie/laravel-backup development by creating an account on GitHub.
Thanks for the update!
Thanks for the update!
You're welcome! 🤜🏻🤛🏽
You are a wizard! I love this platform and I love the community! Thank you all for all that you do!
@denzfarid I just pushed out a few changes on develop related to this - can you check it out and see if these still work for you?
@denzfarid I just pushed out a few changes on
developrelated to this - can you check it out and see if these still work for you?
perfect! @snipe 🤜🏻🤛🏽
thank you for changing the config/backup.php file
