ActionMigrator.php
1 year ago
ActionScheduler_DBStoreMigrator.php
1 year ago
BatchFetcher.php
1 year ago
Config.php
4 years ago
Controller.php
1 year ago
DryRun_ActionMigrator.php
1 year ago
DryRun_LogMigrator.php
1 year ago
LogMigrator.php
1 year ago
Runner.php
1 year ago
Scheduler.php
1 year ago
index.php
3 years ago
Config.php
65 lines
| 1 | <?php |
| 2 | namespace Action_Scheduler\Migration; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | use Action_Scheduler\WP_CLI\ProgressBar; |
| 5 | use ActionScheduler_Logger as Logger; |
| 6 | use ActionScheduler_Store as Store; |
| 7 | class Config { |
| 8 | private $source_store; |
| 9 | private $source_logger; |
| 10 | private $destination_store; |
| 11 | private $destination_logger; |
| 12 | private $progress_bar; |
| 13 | private $dry_run = false; |
| 14 | public function __construct() { |
| 15 | } |
| 16 | public function get_source_store() { |
| 17 | if ( empty( $this->source_store ) ) { |
| 18 | throw new \RuntimeException( __( 'Source store must be configured before running a migration', 'action-scheduler' ) ); |
| 19 | } |
| 20 | return $this->source_store; |
| 21 | } |
| 22 | public function set_source_store( Store $store ) { |
| 23 | $this->source_store = $store; |
| 24 | } |
| 25 | public function get_source_logger() { |
| 26 | if ( empty( $this->source_logger ) ) { |
| 27 | throw new \RuntimeException( __( 'Source logger must be configured before running a migration', 'action-scheduler' ) ); |
| 28 | } |
| 29 | return $this->source_logger; |
| 30 | } |
| 31 | public function set_source_logger( Logger $logger ) { |
| 32 | $this->source_logger = $logger; |
| 33 | } |
| 34 | public function get_destination_store() { |
| 35 | if ( empty( $this->destination_store ) ) { |
| 36 | throw new \RuntimeException( __( 'Destination store must be configured before running a migration', 'action-scheduler' ) ); |
| 37 | } |
| 38 | return $this->destination_store; |
| 39 | } |
| 40 | public function set_destination_store( Store $store ) { |
| 41 | $this->destination_store = $store; |
| 42 | } |
| 43 | public function get_destination_logger() { |
| 44 | if ( empty( $this->destination_logger ) ) { |
| 45 | throw new \RuntimeException( __( 'Destination logger must be configured before running a migration', 'action-scheduler' ) ); |
| 46 | } |
| 47 | return $this->destination_logger; |
| 48 | } |
| 49 | public function set_destination_logger( Logger $logger ) { |
| 50 | $this->destination_logger = $logger; |
| 51 | } |
| 52 | public function get_dry_run() { |
| 53 | return $this->dry_run; |
| 54 | } |
| 55 | public function set_dry_run( $dry_run ) { |
| 56 | $this->dry_run = (bool) $dry_run; |
| 57 | } |
| 58 | public function get_progress_bar() { |
| 59 | return $this->progress_bar; |
| 60 | } |
| 61 | public function set_progress_bar( ProgressBar $progress_bar ) { |
| 62 | $this->progress_bar = $progress_bar; |
| 63 | } |
| 64 | } |
| 65 |