File Transfer Rotate WordPress Plugin

  • Version: 0.6.2
  • Updated: June 10, 2025
SKU: WP-FTR Category: Tags: , , ,

Description

Simplify WordPress File Transfers and Rotations with FTR

FTR (File Transfer and Rotate) is your ultimate WordPress plugin for seamless file transfer. Whether it’s backups, exports, logs, or full folder transfers, FTR ensures secure, automated, and efficient operations with minimal setup. Perfect for developers and admins, FTR integrates easily with wordpress through the Admin UI, WP-CLI, WP-CRON or direct PHP calls for full flexibility.

Key Features:

  • WP-CLI Power: Extensive commands for complete control.
  • WP-CRON Automation: Schedule transfers and rotations effortlessly.
  • Secure Transfers: Built on phpseclib, using SFTP with no SSH2 dependency.
  • Smart Rotation: Auto-manage remote backups with custom intervals.

With FTR, file transfers continue uninterrupted even during timeouts, resuming reliably. Setup is straightforward via hooks, admin menus, or CLI, and all sensitive data is encrypted for robust security. Say goodbye to file management headaches and let FTR handle the heavy lifting!

FTR – File Transfer and Rotate

Transfer backups, exports, logs, files or folders from or to remote locations and/or rotate files to specific date intervals.
FTR transfers or rotations can be invoked from WP-CLI, PHP functions or through scheduled Actions WP-CRON.

  • Extensive WP-CLI commands
  • Automatic WP-CRON schedules
  • Direct PHP transfers
  • Transfer seperate file(s) or complete folders
  • Recursive folders will NOT be supported
  • Build using phpseclib
  • use SFTP for transfers
  • no dependency on SSH2 extension
  • PHP timeouts will not break transfer in WP-CRON
  • Transfer resume rescheduled on timeout
  • Transfers run continuesly in WP-CLI

Configuration

A base configuration can be set up through the configuration action hook.

When transfers are invoked the following configuration steps are executed.

  • Default configuration is used
  • Configuration action hook is fired
  • Action configuration is loaded (if requested)
  • Third any direct configuration is applied
  • Command line (WP-CLI)
  • Configuration vars (PHP functions)

FTR Actions can be configured seperately through the administration menu (FTR > Actions). These Actions can be automatically scheduled or used as a base configuration which can be called from WP-CLI or PHP functions. The FTR Action menu is only shown to Administrators.

Settings

In the WordPress Settings menu an option FTR is added. In the menu you can configure the following options.

OptionsDescription
Log FileFolder and file of log file
Log LevelWhich events should be logged
ShedulerRun scheduler for automatic transfers through WP-CRON

Automatic transfers will run Actions which have valid schedule options (days/monthts) and are published. Drafts are ignored.

Actions

Configuration fields with sensitive information like host, username, source, target, pass and secret will be encrypted upon saving. No plaintext information is stored in the database.

OptionsDescription
HostHost
PortPort
TimeoutPHP timeout
UsernameUsername
Connection TypeConnection Type
PasswordPassword
Private KeyPrivate Key
Transfer TypeUpload or Download Transfer
SourceSource file or folder
TargetTarget folder
TimestampAdd timestamp to file
Date FormatDate format for timestamp
Cron ExpressionSchedule Cron expression
Rotation IntervalRotation Interval
File ExistTransfer Logic for Existing Files

Interval

Examples

0d:* 1d:7 1w:4 1m:12 1y:1
0d:* 1d:2 1w:1 1m:1 6m:1 1y:1

Syntax

SyntaxIntervalVersions
0d:*0 day (today)Unlimited
1d:71 day7
1w:41 week4
1m:121 month12
2m:62 months6
1y:21 year2
  • Each [interval] will keep a number of set [versions]
  • Overlapping ranges will be replaced
    .. 1d:7 will have the last day replaced by 1w:1)
  • Ranges will touch irregardless of set interval configuration

Action hook

Configuration field values can be added by using the below hook. Values set through the action hook will be the initial values before loading Actions or direct configuration values through WP-CLI or PHP functions.

Note that the host, username, secret have to saved encrypted. FTR does NOT accept decrypted sensitive information stored in plaintext.

You are able to encrypt these values by invoking the wp ftr encrypt [data-to-encrypt] in WP-CLI.

add_filter('FTR_config_filter', 'FTR_config', 10, 1);
function FTR_config( $cfg ) 
{
    $cfg['log_path']            = ''; // defaults to plugin folder
    $cfg['transfer_type']       = ''; // get or put
    $cfg['source']              = '';
    $cfg['target']              = '';
    $cfg['source_date_format']  = 'Y-m-d-His';

    $cfg['transfer_timeout']    = ''; // defaults to php timeout

    $cfg['host']                = ''; // use --encrypt in cli to generate string
    $cfg['username']            = ''; // use --encrypt in cli to generate string
    $cfg['connection_type']     = ''; // key, pass or passkey
    $cfg['secret']              = ''; // use --encrypt in cli to generate string
    $cfg['private_key']         = ''; // use --encrypt in cli to generate string
    $cfg['port']                = 22;

    $cfg['schedule']            = true;    
    $cfg['cron_expression']     = '* * * * *';    

    $cfg['rotate']              = true;    
    $cfg['interval_config']     = '0d:* 1d:7 1w:4 1m:12 1y:2';    
    $cfg['timestamp']           = true;

    $cfg['file_exist']          = 'skip';
    $cfg['file_exist_smaller']  = 'append';
    $cfg['file_exist_larger']   = 'overwrite';

    return $cfg;
}

WP_CLI – command line interface

All functionality of FTR can be accomplished through the WordPress CLI.

By default --tranfer and --rotate commands execute as dry-run. Use --run for a no-dry-run execution after making sure the arguments are correct.

Transfer

When not using the FTR scheduler (see Settings configuration) you are able to run FTR configurations in the shell through wp ftr transfer --action commands. To schedule the transfers instead of direct run, use the --cron argument.

An direct or cron scheduled transfer can be initiated by providing all configuration options on the command line.

The action hook configuration could be used as a base configuration. One could keep the remote location host, username and secret stored. While providing the source and target on the command line. Make sure to use --encrypt on the command line to generate salted, hashed, encrypted strings for the settings in the action hook! This will avoid storing plaintext in your configuration hook.

Predefined Actions can be executed directly or scheduled through WP-CRON by using the --action argument. Any configuration field can be overruled by defining them as a argument on the command line.

wp FTR transfer --action=101 --cron [override arguments]

Arguments

ArgumentsDescription
–action=set action id to load
–uploadonly start transfer if explicitly set
–transfer-typetransfer type
–source=local file or folder
–target=remote destination folder
–runno-dry-run, initiate transfers
–timestampappend timestamp to remote file
–cron-expressioncron expression
–cronschedule WP-CRON job
–hosthost
–usernamehost username
–secrethost secret
–private-keyprivate key
–connection-typeconnection type
–porthost port
–overwriteoverwrite all files
–skipskip all files
–appendappend all files

Rotate

Rotate your remote backups based on predefined intervals.

Set the Action id to use predefined settings. If only one action has been defined it will be loaded automatically.

The config action hook will be preloaded and will be overruled by the selected Action. Any argument can be overruled on the command line too.

wp FTR rotate [arguments]

Rotate your remote backups based on intervals.

  • Checks correct remote paths
  • Retrieves remote backup list
  • Applies rotate logic based on interval configuration
  • Removes remote files
  • Non-destructice by default

Arguments

ArgumentsDescription
–action=set action id to load
–runno-dry-run, delete rotated remote backups
–target=remote destination folder to rotate
–intervalrotation interval
–cronschedule through cron

Encrypt

To store sensitive information in the configuration hook the data needs to be encrypted first. This can be achieved by usings the wp ftr encrypt [data-to-encrypt] command.

FTR does not allow decrypted data to be stored in plaintext.

Test-Rotate

wp FTR rotate-test [--days=<days>] [--date=<date>] [--verbose]

Run a test rotation with an generated array in memory.

Arguments

ArgumentsDescription
–days=number of days to simulate
–date=which starting date to use
–verboseverbose output

Reviews

There are no reviews yet.

Be the first to review “File Transfer Rotate WordPress Plugin”

Changelog

0.6.2 - June 10, 2025 Stable

- PHP 8.3 compatibility - Initial stable release