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

Disable notifications prevents BackupWasSuccessful event from firing #1826

Open
Aghanimo opened this issue Jul 25, 2024 · 0 comments
Open

Disable notifications prevents BackupWasSuccessful event from firing #1826

Aghanimo opened this issue Jul 25, 2024 · 0 comments

Comments

@Aghanimo
Copy link

Describe the bug

When running php artisan backup:run --disable-notifications, the BackupWasSuccessful event does not fire, preventing listeners from executing. Without the flag, the event fires correctly.

Steps to Reproduce

  1. Set up an event listener for Spatie\Backup\Events\BackupWasSuccessful in EventServiceProvider.
  2. Run php artisan backup:run --disable-notifications.
  3. Observe that the listener does not execute.

Expected behavior

The BackupWasSuccessful event should fire regardless of the --disable-notifications flag.

Environment

  • Laravel Version: 10.0
  • Spatie Laravel Backup Version: 8.8

Additional context

Here is the relevant setup in EventServiceProvider:

protected $listen = [
    Spatie\Backup\Events\BackupWasSuccessful::class => [
        App\Listeners\BackupCompletedListener::class,
    ],
];

public function boot()
{
    parent::boot();

    Event::listen(Spatie\Backup\Events\BackupWasSuccessful::class, function ($event) {
        Log::info('BackupWasSuccessful event fired.');
    });
}

This bug occurs when I want to call backup in code like this:

    $backupJob = BackupJobFactory::createFromArray(config('backup'));
    $backupJob->disableNotifications();

    $backupJob->run();

Thanks To Spatie Team

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

No branches or pull requests

1 participant