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
LogMigrator.php
21 lines
| 1 | <?php |
| 2 | namespace Action_Scheduler\Migration; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | use ActionScheduler_Logger; |
| 5 | class LogMigrator { |
| 6 | private $source; |
| 7 | private $destination; |
| 8 | public function __construct( ActionScheduler_Logger $source_logger, ActionScheduler_Logger $destination_logger ) { |
| 9 | $this->source = $source_logger; |
| 10 | $this->destination = $destination_logger; |
| 11 | } |
| 12 | public function migrate( $source_action_id, $destination_action_id ) { |
| 13 | $logs = $this->source->get_logs( $source_action_id ); |
| 14 | foreach ( $logs as $log ) { |
| 15 | if ( absint( $log->get_action_id() ) === absint( $source_action_id ) ) { |
| 16 | $this->destination->log( $destination_action_id, $log->get_message(), $log->get_date() ); |
| 17 | } |
| 18 | } |
| 19 | } |
| 20 | } |
| 21 |