← All changes
|
libraries/action-scheduler/classes/migration/LogMigrator.php
+15
-6
1.0.2
→
3.1.1
View file →
| @@ -14,12 +14,20 @@ | ||
| 14 | 14 | * |
| 15 | 15 | * @codeCoverageIgnore |
| 16 | 16 | */ |
| 17 | 17 | class LogMigrator { |
| 18 | - /** @var ActionScheduler_Logger */ | |
| 18 | + /** | |
| 19 | + * Source logger instance. | |
| 20 | + * | |
| 21 | + * @var ActionScheduler_Logger | |
| 22 | + */ | |
| 19 | 23 | private $source; |
| 20 | 24 | |
| 21 | - /** @var ActionScheduler_Logger */ | |
| 25 | + /** | |
| 26 | + * Destination logger instance. | |
| 27 | + * | |
| 28 | + * @var ActionScheduler_Logger | |
| 29 | + */ | |
| 22 | 30 | private $destination; |
| 23 | 31 | |
| 24 | 32 | /** |
| 25 | 33 | * ActionMigrator constructor. |
| @@ -24,13 +32,13 @@ | ||
| 24 | 32 | /** |
| 25 | 33 | * ActionMigrator constructor. |
| 26 | 34 | * |
| 27 | 35 | * @param ActionScheduler_Logger $source_logger Source logger object. |
| 28 | - * @param ActionScheduler_Logger $destination_Logger Destination logger object. | |
| 36 | + * @param ActionScheduler_Logger $destination_logger Destination logger object. | |
| 29 | 37 | */ |
| 30 | - public function __construct( ActionScheduler_Logger $source_logger, ActionScheduler_Logger $destination_Logger ) { | |
| 38 | + public function __construct( ActionScheduler_Logger $source_logger, ActionScheduler_Logger $destination_logger ) { | |
| 31 | 39 | $this->source = $source_logger; |
| 32 | - $this->destination = $destination_Logger; | |
| 40 | + $this->destination = $destination_logger; | |
| 33 | 41 | } |
| 34 | 42 | |
| 35 | 43 | /** |
| 36 | 44 | * Migrate an action log. |
| @@ -39,10 +47,11 @@ | ||
| 39 | 47 | * @param int $destination_action_id Destination logger object. |
| 40 | 48 | */ |
| 41 | 49 | public function migrate( $source_action_id, $destination_action_id ) { |
| 42 | 50 | $logs = $this->source->get_logs( $source_action_id ); |
| 51 | + | |
| 43 | 52 | foreach ( $logs as $log ) { |
| 44 | - if ( $log->get_action_id() == $source_action_id ) { | |
| 53 | + if ( absint( $log->get_action_id() ) === absint( $source_action_id ) ) { | |
| 45 | 54 | $this->destination->log( $destination_action_id, $log->get_message(), $log->get_date() ); |
| 46 | 55 | } |
| 47 | 56 | } |
| 48 | 57 | } |