PluginProbe
WANotifier for Forms and Actions / 3.1.1
WANotifier for Forms and Actions v3.1.1
3.1.1 3.1.0 3.0.4 2.7.10 2.7.11 2.7.12 2.7.13 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 3.0.0 3.0.1 3.0.2 3.0.3 trunk 0.1.0 0.1.1 1.0.0 1.0.1 1.0.2 All 67 releases
notifier / libraries / action-scheduler / classes / migration / LogMigrator.php

LogMigrator.php in WANotifier for Forms and Actions 3.1.1, at libraries/action-scheduler/classes/migration/LogMigrator.php

59 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 namespace Action_Scheduler\Migration;
5
6 use ActionScheduler_Logger;
7
8 /**
9 * Class LogMigrator
10 *
11 * @package Action_Scheduler\Migration
12 *
13 * @since 3.0.0
14 *
15 * @codeCoverageIgnore
16 */
17 class LogMigrator {
18 /**
19 * Source logger instance.
20 *
21 * @var ActionScheduler_Logger
22 */
23 private $source;
24
25 /**
26 * Destination logger instance.
27 *
28 * @var ActionScheduler_Logger
29 */
30 private $destination;
31
32 /**
33 * ActionMigrator constructor.
34 *
35 * @param ActionScheduler_Logger $source_logger Source logger object.
36 * @param ActionScheduler_Logger $destination_logger Destination logger object.
37 */
38 public function __construct( ActionScheduler_Logger $source_logger, ActionScheduler_Logger $destination_logger ) {
39 $this->source = $source_logger;
40 $this->destination = $destination_logger;
41 }
42
43 /**
44 * Migrate an action log.
45 *
46 * @param int $source_action_id Source logger object.
47 * @param int $destination_action_id Destination logger object.
48 */
49 public function migrate( $source_action_id, $destination_action_id ) {
50 $logs = $this->source->get_logs( $source_action_id );
51
52 foreach ( $logs as $log ) {
53 if ( absint( $log->get_action_id() ) === absint( $source_action_id ) ) {
54 $this->destination->log( $destination_action_id, $log->get_message(), $log->get_date() );
55 }
56 }
57 }
58 }
59