1

我正在尝试使用 laravel spatie 包在谷歌驱动器上上传备份我遵循了这些步骤 https://gist.github.com/sergomet/f234cc7a8351352170eb547cccd65011 我的备份已成功创建 g-drive 已成功集成但是在执行操作时backup:run它主要给出此错误找不到文件,最后它说

备份失败,因为:取消链接 C:\xampp\htdocs\newfolder\storage\app/backup-temp\temp\2020-11-07-20-06-19.zip) 资源暂时不可用 在此处输入图像描述

这是我的 config/backup.php

<?php

return [

    'backup' => [
      'name' => config('GOOGLE_DRIVE_FOLDER_ID' , 'laravel-backup'),

        'source' => [

            'files' => [
                'include' => [
                ],
                'exclude' => [
                    base_path('vendor'),
                    base_path('node_modules'),
                ],
                'followLinks' => false,
            ],

            'databases' => [
                'mysql',
            ],
        ],
        'database_dump_compressor' => null,

        'destination' => [
            'filename_prefix' => '',
            'disks' => [
                'local' , 'google'
            ],
        ],
        'temporary_directory' => storage_path('app/backup-temp'),
    ],

    'notifications' => [

        'notifications' => [
            \Spatie\Backup\Notifications\Notifications\BackupHasFailed::class         => ['mail'],
            \Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFound::class => ['mail'],
            \Spatie\Backup\Notifications\Notifications\CleanupHasFailed::class        => ['mail'],
            \Spatie\Backup\Notifications\Notifications\BackupWasSuccessful::class     => ['mail'],
            \Spatie\Backup\Notifications\Notifications\HealthyBackupWasFound::class   => ['mail'],
            \Spatie\Backup\Notifications\Notifications\CleanupWasSuccessful::class    => ['mail'],
        ],

        'notifiable' => \Spatie\Backup\Notifications\Notifiable::class,

        'mail' => [
        ],

        'slack' => [
            'webhook_url' => '',
            'channel' => null,

            'username' => null,

            'icon' => null,

        ],
    ],
    'monitorBackups' => [
        [
            'name' => env('GOOGLE_DRIVE_FOLDER_ID' , 'laravel-backup'),
            'disks' => ['local'],
            'newestBackupsShouldNotBeOlderThanDays' => 1,
            'storageUsedMayNotBeHigherThanMegabytes' => 5000,
        ],
    ],

    'cleanup' => [
        'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class,

        'defaultStrategy' => [
            'keepAllBackupsForDays' => 7,
            'keepDailyBackupsForDays' => 16,
            'keepWeeklyBackupsForWeeks' => 8,
            'keepMonthlyBackupsForMonths' => 4,
            'keepYearlyBackupsForYears' => 2,

            'deleteOldestBackupsWhenUsingMoreMegabytesThan' => 5000,
        ],
    ],
];

我的.env

GOOGLE_DRIVE_CLIENT_ID=183462809528-gqhvm96rpsvhccp4lll55soms.apps.googleusercontent.com
GOOGLE_DRIVE_CLIENT_SECRET=T7OaNoN5t2GBHU4hvBVKX
GOOGLE_DRIVE_REFRESH_TOKEN="1//04Z70eIYBuRvgCgYIARAAGAQSNwF-L9Ir1riNcqKpwiOYeFdP6LlXhpcRgDPiMLbZvZS0UKQtDrEpqizRpLwah-Y2-WdmOs"
GOOGLE_DRIVE_FOLDER_ID=1245H1fYLxa8q0LJD1uTAe-chX8W44ALJ
4

1 回答 1

1

要修复此错误name,请将config/backup.php.

'name' => '',

在下面的视频链接中,详细解释了这个错误的解决方法: https ://www.youtube.com/watch?v=6kxXkrlRuJU

我相信它会有所帮助。或者您也可以查看文章 -
如何在 Google Drive 上设置 Laravel 备份?

于 2020-12-15T11:59:58.723 回答