PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.7
GiveWP – Donation Plugin and Fundraising Platform v4.16.7
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 2.30.0 2.31.0 2.31.1 All 253 releases
give / src / MigrationLog / Migrations / MigrateCompletedMigrations.php
MigrateCompletedMigrations.php
67 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\MigrationLog\Migrations;
4
5 use Give\Framework\Migrations\Contracts\Migration;
6 use Give\MigrationLog\MigrationLogFactory;
7 use Give\MigrationLog\MigrationLogStatus;
8
9 /**
10 * Class MigrateCompletedMigrations
11 * @package Give\MigrationLog\Migrations
12 *
13 * @since 2.10.0
14 */
15 class MigrateCompletedMigrations extends Migration
16 {
17 /**
18 * @var MigrationLogFactory
19 */
20 private $migrationLogFactory;
21
22 /**
23 * MigrateCompletedMigrations constructor.
24 *
25 * @param MigrationLogFactory $migrationLogFactory
26 */
27 public function __construct(MigrationLogFactory $migrationLogFactory)
28 {
29 $this->migrationLogFactory = $migrationLogFactory;
30 }
31
32 /**
33 * @return string
34 */
35 public static function id()
36 {
37 return 'migrate_completed_migrations';
38 }
39
40 /**
41 * @return string
42 */
43 public static function title()
44 {
45 return esc_html__('Migrate completed migrations to give_migrations table','give' );
46 }
47
48 /**
49 * @return int
50 */
51 public static function timestamp()
52 {
53 return strtotime('1970-01-02 00:00');
54 }
55
56 public function run()
57 {
58 $migrations = get_option('give_database_migrations', []);
59
60 foreach ($migrations as $migrationId) {
61 $migrationLog = $this->migrationLogFactory->make($migrationId);
62 $migrationLog->setStatus(MigrationLogStatus::SUCCESS);
63 $migrationLog->save();
64 }
65 }
66 }
67