-
-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathclass.migrations.php
More file actions
40 lines (32 loc) · 1.01 KB
/
class.migrations.php
File metadata and controls
40 lines (32 loc) · 1.01 KB
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
<?php
/**
* Leaflet Map Migrations
* @since 3.4.0
*/
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
}
define('LEAFLET_MAP__MIGRATION_DIR', LEAFLET_MAP__PLUGIN_DIR . 'migrations/');
class Leaflet_Map_Migrations {
/**
* only call once
**/
private static $called = false;
/**
* We assume if this is called, our db version diverges from plugin version
* migrations here are run in ascending order, always compared via '<' against db version
*/
public static function run_once($db_version) {
if ( self::$called ) {
return;
}
self::$called = true;
if (version_compare($db_version, '3.4.0', '<')) {
include_once LEAFLET_MAP__MIGRATION_DIR . '001-v3.4.0-geocoder-transients.php';
migration001();
// update version, if for some reason something fails afterwards, and we want to prevent this migration
update_option(LEAFLET_MAP__DB_VERSION_KEY, '3.4.0');
}
}
}