Contracts
9 months ago
BatchProcessor.php
9 months ago
Migration.php
7 months ago
ProcessByWcMigrator.php
9 months ago
QuizAttemptMigrator.php
9 months ago
Migration.php
47 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Migration |
| 4 | * |
| 5 | * @package Tutor |
| 6 | * @author Themeum <support@themeum.com> |
| 7 | * @link https://themeum.com |
| 8 | * @since 3.8.0 |
| 9 | */ |
| 10 | |
| 11 | namespace Tutor\Migrations; |
| 12 | |
| 13 | /** |
| 14 | * Class Migration |
| 15 | */ |
| 16 | class Migration { |
| 17 | /** |
| 18 | * Constructor |
| 19 | */ |
| 20 | public function __construct() { |
| 21 | $this->schedule_migrations(); |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * Schedule migrations. |
| 26 | * |
| 27 | * @since 3.8.0 |
| 28 | * |
| 29 | * @return void |
| 30 | */ |
| 31 | public function schedule_migrations() { |
| 32 | $migrators = array( |
| 33 | QuizAttemptMigrator::instance(), |
| 34 | ); |
| 35 | |
| 36 | if ( tutor_utils()->has_wc() ) { |
| 37 | $migrators[] = ProcessByWcMigrator::instance(); |
| 38 | } |
| 39 | |
| 40 | foreach ( $migrators as $migrator ) { |
| 41 | if ( ! $migrator->is_completed() ) { |
| 42 | $migrator->schedule(); |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 |