| 1 |
<?php |
| 2 |
|
| 3 |
namespace SyncBasalam\Migrations; |
| 4 |
|
| 5 |
use SyncBasalam\Migrations\Versions\Migration_1_3_0; |
| 6 |
use SyncBasalam\Migrations\Versions\Migration_1_3_2; |
| 7 |
use SyncBasalam\Migrations\Versions\Migration_1_3_8; |
| 8 |
use SyncBasalam\Migrations\Versions\Migration_1_4_0; |
| 9 |
use SyncBasalam\Migrations\Versions\Migration_1_4_1; |
| 10 |
use SyncBasalam\Migrations\Versions\Migration_1_6_2; |
| 11 |
use SyncBasalam\Migrations\Versions\Migration_1_7_8; |
| 12 |
use SyncBasalam\Migrations\Versions\Migration_1_8_0; |
| 13 |
use SyncBasalam\Migrations\Versions\Migration_1_8_1; |
| 14 |
use SyncBasalam\Migrations\Versions\Migration_1_8_5; |
| 15 |
use SyncBasalam\Migrations\Versions\Migration_1_8_7; |
| 16 |
use SyncBasalam\Migrations\Versions\Migration_1_10_6; |
| 17 |
use SyncBasalam\Migrations\Versions\Migration_1_10_8; |
| 18 |
|
| 19 |
defined('ABSPATH') || exit; |
| 20 |
|
| 21 |
class MigrationManager |
| 22 |
{ |
| 23 |
private $migrations = []; |
| 24 |
|
| 25 |
public function __construct() |
| 26 |
{ |
| 27 |
$this->migrations = [ |
| 28 |
'1.3.0' => new Migration_1_3_0(), |
| 29 |
'1.3.2' => new Migration_1_3_2(), |
| 30 |
'1.3.8' => new Migration_1_3_8(), |
| 31 |
'1.4.0' => new Migration_1_4_0(), |
| 32 |
'1.4.1' => new Migration_1_4_1(), |
| 33 |
'1.6.2' => new Migration_1_6_2(), |
| 34 |
'1.7.8' => new Migration_1_7_8(), |
| 35 |
'1.8.0' => new Migration_1_8_0(), |
| 36 |
'1.8.1' => new Migration_1_8_1(), |
| 37 |
'1.8.5' => new Migration_1_8_5(), |
| 38 |
'1.8.7' => new Migration_1_8_7(), |
| 39 |
'1.10.6' => new Migration_1_10_6(), |
| 40 |
'1.10.8' => new Migration_1_10_8(), |
| 41 |
]; |
| 42 |
} |
| 43 |
|
| 44 |
public function runMigrations($currentVersion, $newVersion) |
| 45 |
{ |
| 46 |
foreach ($this->migrations as $version => $migration) { |
| 47 |
if (version_compare($currentVersion, $version, '<')) $migration->up(); |
| 48 |
} |
| 49 |
|
| 50 |
update_option('sync_basalam_version', $newVersion); |
| 51 |
} |
| 52 |
} |
| 53 |
|