Drupal Module

Backup module for Drupal 9, 10, and 11. Export your database, public/private files, and site configuration.

v1.3.0Updated 2026-01-01

Requirements

  • Drupal 9.0, 10.0, or 11.0+
  • PHP 8.0 or higher
  • Composer for installation
  • LOX API key

Installation

Option 1: Manual Installation

  1. Download and extract

    Extract the module to modules/contrib/lox_backup

  2. Enable the module
    drush en lox_backup
  3. Configure settings

    Go to Configuration → System → LOX Backup

Option 2: Via Admin UI

  1. Navigate to Extend

    Go to Extend → + Install new module

  2. Upload the module

    Upload the zip file or paste the URL

  3. Enable and configure

    Check "LOX Backup" and click Install

Configuration

API Settings

SettingDescription
API KeyYour LOX API key from backlox.com
API URLDefault: https://backlox.com/api

Backup Components

ComponentDescriptionPath
DatabaseAll Drupal tablesdatabase.sql
Public FilesUploaded files, imagessites/default/files
Private FilesPrivate file storageprivate://
ConfigurationSite configuration YAMLconfig/*.yml

Scheduled Backups

The module uses Drupal's cron system. Configure your server to run Drupal cron:

# Run cron every hour
0 * * * * cd /var/www/drupal && drush cron

# Or use wget
0 * * * * wget -O - -q "https://your-site.com/cron/YOUR_CRON_KEY"

The module checks the schedule setting on each cron run and triggers a backup when due.

Drush Commands

The module provides Drush commands for command-line backup management:

# Run a backup
drush lox:backup

# Test connection
drush lox:test

# List recent backups
drush lox:list

# Show backup status
drush lox:status

Coming Soon

Drush commands will be available in the next release.

Permissions

The module provides one permission:

  • Administer LOX Backup - Required to configure settings and run backups. Typically assigned to the Administrator role.

Backup Structure

drupal-mysite-20240115_030000.tar.gz
├── database.sql        # Full database dump
├── files/              # Public files (sites/default/files)
├── private/            # Private files (if configured)
└── config/             # Configuration export
    ├── system.site.yml
    ├── user.role.*.yml
    ├── views.view.*.yml
    └── ... (all config)

Restoring from Backup

  1. Download and extract the backup

    Get the backup from the LOX dashboard and extract the tar.gz file.

  2. Restore the database
    drush sql:cli < database.sql
  3. Restore files

    Copy the files directory to sites/default/files

  4. Import configuration
    drush config:import --source=/path/to/config
  5. Clear caches
    drush cr

PULL Mode (New in v1.3.0)

New Feature: Server-Initiated Backups

PULL mode allows LOX to initiate backups remotely, providing centralized scheduling, better reliability, and active monitoring of your Drupal sites.

Enabling PULL Mode

  1. Go to LOX Backup settings

    Navigate to Configuration → System → LOX Backup → PULL tab.

  2. Enable PULL mode

    Toggle "Enable PULL Backups" to generate a secure token.

  3. Register site in LOX dashboard

    Add your site URL and PULL token in the LOX dashboard under CMS Sites.

PULL API Endpoints

POST /lox/pull/backup         # Trigger backup generation
GET  /lox/pull/status         # Get site status and sizes
GET  /lox/pull/download       # Download generated backup
POST /lox/pull/token/refresh  # Regenerate PULL token

Troubleshooting

Private files not backing up

Ensure private file path is configured in settings.php and the path is readable by the web server.

Scheduled backups not running

Verify cron is running properly. Check Reports → Recent log messagesfor cron-related errors.