sonntagnacht / backup-bundle
用于对 symfony 2.8+ 项目的快照命令
1.0.15
2019-02-22 13:12 UTC
Requires
- php: >=5.6
- knplabs/knp-gaufrette-bundle: ~0.3
- sonntagnacht/toolbox-bundle: ^0.2
Requires (Dev)
- phpunit/phpunit: 3.7.*
- symfony/framework-standard-edition: ^2.8|3.*
This package is auto-updated.
Last update: 2024-09-12 22:16:42 UTC
README
此 BackupBundle 可以从每日、每周、每月或每年创建备份。它将默认数据库和 GaufretteFilesystems 保存到 GaufretteFilesystem 中的 tar.gz-存档。
安装
运行 composer require sonntagnacht/backup-bundle
在您的项目中使用 SNBackupBundle。
配置
添加到 AppKernel.php
class AppKernel extends Kernel { public function registerBundles() { $bundles = array( new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), // ... new SN\BackupBundle\SNBackupBundle(), // ... return $bundles; } // ... }
config.yml
knp_gaufrette: ... filesystems: backup_fs: adapter: ... sn_backup: target_fs: backup_fs databases: - mydb # name of your doctrine database connection include_fs: - image_fs # names of gaufrette filesystems wich should backuped
用法
为了备份当前 Web 应用程序(数据库和 gaufrette 文件系统)
php bin/console sn:backup:dump [daily|weekly|monthly|yearly]
对于大型备份,我们跳过了初始连接检查,因为连接可能会丢失,直到所有内容都存储在 tar
中。如果您仍然想要检查文件系统是否存在,请使用 --check-target-fs
执行备份命令。
获取所有备份的列表
php bin/console sn:backup:restore
恢复保存的备份
php bin/console sn:backup:restore [id]
删除七天前的备份。
php bin/console sn:backup:cleanup [daily|weekly|monthly|yearly] 7d
WebGUI
要使用 WebGUI,请将以下行添加到 routing.yml
SNBackupBundle: resource: "@SNBackupBundle/Controller/" type: annotation prefix: /backup