Migration Config

Action_SchedulerMigrationConfig is a builder class that configures the migration runner with source/destination stores and loggers.

Since: 3.0.0
Source: classes/migration/Config.php

Purpose

The Config class defines:

  • Where actions are migrating from (source store/logger)
  • Where actions are migrating to (destination store/logger)
  • Whether this is a dry run
  • Optional progress bar for WP-CLI

Properties

Property Type Description
$source_store ActionScheduler_Store Store to migrate from
$source_logger ActionScheduler_Logger Logger to migrate from
$destination_store ActionScheduler_Store Store to migrate to
$destination_logger ActionScheduler_Logger Logger to migrate to
$dry_run bool If true, simulates migration without writing
$progress_bar ProgressBar WP-CLI progress indicator

Methods

get_source_store()

public function get_source_store(): ActionScheduler_Store

Returns the configured source store. Throws RuntimeException if not set.

set_source_store()

public function set_source_store( ActionScheduler_Store $store ): void

Sets the source store (typically ActionScheduler_wpPostStore).

get_source_logger()

public function get_source_logger(): ActionScheduler_Logger

Returns the configured source logger. Throws RuntimeException if not set.

set_source_logger()

public function set_source_logger( ActionScheduler_Logger $logger ): void

Sets the source logger (typically ActionScheduler_wpCommentLogger).

get_destination_store()

public function get_destination_store(): ActionScheduler_Store

Returns the configured destination store. Throws RuntimeException if not set.

set_destination_store()

public function set_destination_store( ActionScheduler_Store $store ): void

Sets the destination store (typically ActionScheduler_DBStoreMigrator).

get_destination_logger()

public function get_destination_logger(): ActionScheduler_Logger

Returns the configured destination logger. Throws RuntimeException if not set.

set_destination_logger()

public function set_destination_logger( ActionScheduler_Logger $logger ): void

Sets the destination logger (typically ActionScheduler_DBLogger).

get_dry_run() / set_dry_run()

public function get_dry_run(): bool
public function set_dry_run( bool $dry_run ): void

Controls dry run mode. When true, migration is simulated without actual writes.

get_progress_bar() / set_progress_bar()

public function get_progress_bar(): ?ProgressBar
public function set_progress_bar( ProgressBar $progress_bar ): void

Optional progress bar for WP-CLI feedback.

Default Configuration

The Controller builds the default config:

$config = new Config();
$config->set_source_store( new ActionScheduler_wpPostStore() );
$config->set_source_logger( new ActionScheduler_wpCommentLogger() );
$config->set_destination_store( new ActionScheduler_DBStoreMigrator() );
$config->set_destination_logger( new ActionScheduler_DBLogger() );

Filter

// Customize migration configuration
add_filter( 'action_scheduler/migration_config', function( $config ) {
    // Modify config as needed
    return $config;
});