Migration.php
2 years ago
Migration_10.php
3 years ago
Migration_11.php
3 years ago
Migration_12.php
3 years ago
Migration_13.php
3 years ago
Migration_14.php
2 years ago
Migration_15.php
2 years ago
Migration_1_0.php
3 years ago
Migration_1_6.php
3 years ago
Migration_1_8.php
3 years ago
Migration_1_9.php
3 years ago
Migration_2.php
3 years ago
Migration_3.php
3 years ago
Migration_4.php
3 years ago
Migration_5.php
3 years ago
Migration_6.php
3 years ago
Migration_7.php
3 years ago
Migration_8.php
3 years ago
Migration_9.php
3 years ago
Migration_Job.php
2 years ago
Migration_Job.php
37 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWP_SCOPED\IAWP\Migrations; |
| 4 | |
| 5 | use IAWP_SCOPED\IAWP\Utils\WP_Async_Request; |
| 6 | class Migration_Job extends WP_Async_Request |
| 7 | { |
| 8 | /** |
| 9 | * @var string |
| 10 | */ |
| 11 | protected $action = 'iawp_database_migration'; |
| 12 | /** |
| 13 | * Handle |
| 14 | * |
| 15 | * Override this method to perform any actions required |
| 16 | * during the async request. |
| 17 | * |
| 18 | * @return void |
| 19 | */ |
| 20 | protected function handle() : void |
| 21 | { |
| 22 | Migration::create_or_migrate(); |
| 23 | } |
| 24 | /** |
| 25 | * Dispatch a migration job if the database is out of date and no migration is currently running |
| 26 | * |
| 27 | * @return void |
| 28 | */ |
| 29 | public static function maybe_dispatch() : void |
| 30 | { |
| 31 | if (Migration::should_migrate()) { |
| 32 | $migration_job = new self(); |
| 33 | $migration_job->dispatch(); |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 |