承接 arifur/bookstack-backup 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

arifur/bookstack-backup

最新稳定版本:v1.2.0

Composer 安装命令:

composer require arifur/bookstack-backup

包简介

Backup management for Bookstack

README 文档

README

Backup management package for BookStack.

Overview

This package adds a Backups area under settings and provides:

  • Manual backup creation
  • Backup history list with download and delete actions
  • Delete confirmation page before file removal
  • Backup settings for filename prefix, database include toggle, and max backups
  • Automatic pruning by max backup count
  • FTP remote upload settings for manual and scheduled backups

Access is protected by the settings-manage permission.

Installation

Add the package to BookStack:

"require": {
    "arifur/bookstack-backup": "dev-main"
},
"repositories": [
    {
        "type": "path",
        "url": "../bookstack-backup"
    }
]

Then run:

composer update
php artisan package:discover
php artisan cache:clear
php artisan view:clear
php artisan migrate

If you prefer publishing package migrations first:

php artisan vendor:publish --provider="Arifur\\BookstackBackup\\BackupServiceProvider" --tag="bookstack-backup-migrations"
php artisan migrate

Configuration

Publish config:

php artisan vendor:publish --tag="bookstack-backup-config"

Current config keys:

return [
    'storage_path' => storage_path('backups'),
    'max_backups' => 10,
];

Routes

All routes are registered by the package and use middleware web, auth, and can:settings-manage.

Method URI Purpose
GET /settings/backups Backup page
POST /settings/backups Update backup settings
GET /settings/backups/backup-settings Backup settings page
POST /settings/backups/backup-settings Save backup settings page values
POST /settings/backups/create Create backup now
GET /settings/backups/download/{filename} Download backup
GET /settings/backups/delete/{filename} Delete confirmation page
DELETE /settings/backups/delete/{filename} Delete backup
GET /settings/backups/schedule Schedule page endpoint
POST /settings/backups/schedule Schedule save endpoint
GET /settings/backups/remote Remote page endpoint
POST /settings/backups/remote Remote save endpoint

Note: Current sidebar navigation shows Backup and Backup Settings. Schedule and Remote routes exist but are not shown in the sidebar by default.

Features

  • Manual backup creation (database and/or uploads)
  • Backup history with download, hash, and delete
  • Delete confirmation page before file removal
  • Backup settings for filename prefix, database include toggle, and max backups
  • Automatic pruning by max backup count
  • FTP remote upload for manual and scheduled backups
  • Enable Remote Backup: master toggle to globally enable/disable all remote uploads
  • Remote upload progress indicator on manual backup
  • Schedule backups via UI (requires cron or Laravel scheduler)
  • Notification email field is currently disabled in the UI

Running Scheduled Backups

You can run scheduled backups using either of these approaches.

Option A: Direct Cron Command (Without Laravel Scheduler)

Run the package command directly from cron. This does not use Laravel scheduler.

Edit crontab:

crontab -e

Add this line:

* * * * * cd /path/to/your/project && /usr/bin/php artisan bookstack-backup:run-scheduled >> /var/log/bookstack-backup-cron.log 2>&1

Use the correct PHP binary path on your server (for example /usr/bin/php or /usr/local/bin/php).

Quick manual test:

cd /path/to/your/project
/usr/bin/php artisan bookstack-backup:run-scheduled

Option B: Laravel Scheduler

Run Laravel's scheduler from cron, then let the app invoke the package schedule:

* * * * * cd /path/to/your/project && php artisan schedule:run >> /dev/null 2>&1

Replace /path/to/your/project with your BookStack project root (where artisan is located).

Configuring Scheduled Backups

To set up and configure scheduled backups:

  1. Install and publish the package config (if not already done):

    composer update
    php artisan vendor:publish --tag="bookstack-backup-config"
    php artisan cache:clear
    php artisan view:clear
  2. Configure your backup schedule in the BookStack UI:

    • Go to Settings → Backups → Schedule.
    • Enable scheduled backups using the toggle.
    • Set your preferred schedule:
      • Frequency: Choose daily, weekly, or monthly.
      • Time: Set the time of day for the backup to run.
      • Day of Week: (If weekly) Select which day backups should run.
      • Day of Month: (If monthly) Select which day backups should run.
    • (Optional) Toggle whether to keep a local copy after remote upload.
    • Save your changes.
  3. Set up one of the scheduler execution options:

    Edit your crontab:

    crontab -e

    Option A (direct package command):

    * * * * * cd /path/to/your/project && php artisan bookstack-backup:run-scheduled >> /dev/null 2>&1
    

    Option B (Laravel scheduler):

    * * * * * cd /path/to/your/project && php artisan schedule:run >> /dev/null 2>&1
    

    Both options should run every minute.

Note:

  • Use one scheduler execution option to avoid duplicate runs.
  • The notification email field is currently disabled in the UI.

Notes

  • Backups are created as zip files.
  • History currently shows date-only in list rows, with full filename and full created timestamp on hover.
  • Delete action is a two-step flow through a confirmation page.

Troubleshooting

Backups fail to create:

  1. Ensure mysqldump is installed and available on PATH.
  2. Verify DB credentials in your environment.
  3. Ensure the backup storage path is writable.

Package not appearing:

  1. Run composer update.
  2. Clear view and app caches.
  3. Check logs in storage/logs.

Migrations not applied:

  1. Run php artisan package:discover.
  2. Run php artisan migrate.
  3. If needed, publish migrations with php artisan vendor:publish --provider="Arifur\\BookstackBackup\\BackupServiceProvider" --tag="bookstack-backup-migrations" then run php artisan migrate again.

Publishing Assets

Publish views:

php artisan vendor:publish --provider="Arifur\\BookstackBackup\\BackupServiceProvider" --tag="bookstack-backup-views"

Publish translations:

php artisan vendor:publish --provider="Arifur\\BookstackBackup\\BackupServiceProvider" --tag="bookstack-backup-lang"

License

MIT

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固