1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
<?php
namespace TotalPoll\Migrations\Polls\WPPolls; ! defined( 'ABSPATH' ) && exit();
use TotalPoll\Migrations\Polls\Load;
/** * WP-Polls Migrator. * @package TotalPoll\Migrations\Polls\WPPolls */ class Migrator extends \TotalPoll\Migrations\Polls\Migrator { /** * Migrator constructor. * * @param array $env */ public function __construct( $env ) { parent::__construct( $env, new Extract(), new Transform(), new Load() ); }
/** * @return array */ public function jsonSerialize() { return [ 'name' => 'WP-Polls', 'image' => $this->env['url'] . 'assets/dist/images/migration/wp-polls.png', 'done' => $this->getMigratedCount(), 'total' => $this->getCount(), ]; }
public function migrate( $onProgress = null ) { $polls = parent::migrate( $onProgress );
$ids = $this->extract->getMigratedPollsIds();
foreach ( $polls as $poll ): $ids[] = $poll->getId(); endforeach;
update_option( 'wp-polls_poll_migrated', $ids );
return $polls; } }
|