PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.17.0
GiveWP – Donation Plugin and Fundraising Platform v4.17.0
4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 All 256 releases
give / vendor / woocommerce / action-scheduler / classes / migration / LogMigrator.php

LogMigrator.php in GiveWP – Donation Plugin and Fundraising Platform 4.17.0, at vendor/woocommerce/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