Docs: Drupal

Drupal module

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

v1.4.0Updated 2026-09-27

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/{token}  # Download generated backup (one-time token)
POST /lox/pull/token/refresh  # Regenerate PULL token (X-API-Key)
POST /lox/pull/restore        # Restore backup (if enabled)

All endpoints except the token refresh require the X-LOX-Pull-Token header. When "Allow PULL" is switched off in the module settings, every request is refused with HTTP 403 (pull_disabled), even with a valid token. Restore requests accept {type: "component", component: "database"} to restore a single component, and only download archives from the configured LOX platform origin.

Remote restore (new in v1.3.1)

Security feature: Remote restore control

By default, the module blocks restore requests from the LOX platform. This ensures that restores can only be initiated from your Drupal admin panel, protecting against unauthorized or accidental data overwrites.

Allow remote restore setting

The "Allow Remote Restore" option in Configuration → LOX Backup controls whether LOX can initiate restores remotely:

SettingBehavior
Disabled (Secure)Remote restore requests are blocked with HTTP 403. Restores must be done manually via Drush or from the Drupal admin.This is the default and recommended setting.
EnabledLOX platform can send restore requests to your Drupal site. Use with caution - anyone with access to your LOX account can trigger a restore.

Security warning

When remote restore is enabled, anyone with access to your LOX account can initiate a restore, potentially overwriting your current site data including content and configuration. Only enable this if you understand the risks.

Backup profiles (updated in v1.4.0)

A profile says what the plugin backs up, how often, and how long LOX keeps each copy. Profiles are stored in LOX, so you can define them in two places:

  • In the plugin: Configuration → System → LOX Backup → Profiles → Create profile. You can start from a LOX template and change it before saving.
  • In the LOX dashboard: Backups → Profiles → New profile, choosing this site. The site appears there once it has sent LOX a backup.

The plugin only lists and runs the profiles of its own site. Each profile sets:

  • What to back up: Database (database), Public files (public_files), Private files (private_files), Modules (modules), Themes (themes), Configuration (config)
  • Frequency: hourly up to monthly, with a preferred day for weekly and monthly profiles (day 31 = last day of the month)
  • Time window and timezone: the hours a scheduled run may start, or any time
  • Retention and immutability: how long LOX keeps each copy, and how many of those days it cannot be deleted
  • Active: an inactive profile is kept but never runs

Running profiles on schedule

The plugin runs its site's active profiles when they are due, from its scheduled task. Each backup is attached to its profile, and the next run time is saved in LOX. Call the task every hour:

0 * * * * curl -s "https://your-site.com/lox/cron?token=YOUR_TOKEN" > /dev/null 2>&1

Drupal's own cron runs due profiles too: if it already runs every hour, the URL is not needed. The token is on the module's settings page.

Backups that LOX requests from the site (PULL) follow the site's schedule in LOX, not the profiles.

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.