PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / trunk
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution vtrunk
2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 1.7.2 All 33 releases
← All changes | boot/app.php +17 -4 2.1.2trunk View file →
@@ -10,10 +10,12 @@
10 10 return function ($file) {
11 11
12 12 $app = new Application($file);
13 13
14 - register_activation_hook($file, function () use ($app) {
15 - ($app->make(ActivationHandler::class))->handle();
14 + register_activation_hook($file, function ($network_wide = false) use ($app) {
15 + // WordPress passes $network_wide; dropping it left every blog but the
16 + // activating one unmigrated and unscheduled on a network activation.
17 + ($app->make(ActivationHandler::class))->handle($network_wide);
16 18 });
17 19
18 20 register_deactivation_hook($file, function () use ($app) {
19 21 ($app->make(DeactivationHandler::class))->handle();
@@ -24,11 +26,22 @@
24 26 add_action('plugins_loaded', function () use ($app) {
25 27 do_action('fluent_booking/loaded', $app);
26 28
27 29 $currentDBVersion = get_option('fluent_booking_db_version');
30 +
28 31 if (!$currentDBVersion || version_compare($currentDBVersion, FLUENT_BOOKING_DB_VERSION, '<')) {
29 - update_option('fluent_booking_db_version', FLUENT_BOOKING_DB_VERSION, 'no');
30 - DBMigrator::run();
32 + // plugins_loaded, so every request during an upgrade reaches this.
33 + if (!get_transient('fluent_booking_db_migration_lock')) {
34 + set_transient('fluent_booking_db_migration_lock', 1, 5 * MINUTE_IN_SECONDS);
35 +
36 + DBMigrator::run();
37 +
38 + // Stamped after the run: a failure mid-migration used to leave
39 + // the version current against a schema that never changed.
40 + update_option('fluent_booking_db_version', FLUENT_BOOKING_DB_VERSION, 'no');
41 +
42 + delete_transient('fluent_booking_db_migration_lock');
43 + }
31 44 }
32 45
33 46 if (defined('FLUENT_BOOKING_PRO_VERSION') && version_compare(FLUENT_BOOKING_MIN_PRO_VERSION, FLUENT_BOOKING_PRO_VERSION, '>')) {
34 47 if (!current_user_can('manage_options')) {