PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / 2.4.5
Fluent Support – Helpdesk & Customer Support Ticket System v2.4.5
2.4.5 2.4.0 2.3.2 2.3.1 2.3.0 2.2.1 2.2.0 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.4.0 1.4.1 1.4.2 1.4.5 1.4.6 1.4.7 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 All 69 releases
← All changes | boot/app.php +26 -6 1.10.2 → 2.4.5 View file →
@@ -19,8 +19,11 @@
19 19 });
20 20
21 21 add_action('plugins_loaded', function () use ($file) {
22 22 $application = new Application($file);
23 +
24 + \FluentSupport\Database\DBMigrator::maybeMigrateDBChanges();
25 +
23 26 do_action('fluent_support_loaded', $application);
24 27 do_action('fluent_support_addons_loaded', $application);
25 28
26 29 // add_action('init', function () {
@@ -39,16 +42,33 @@
39 42 if (!wp_next_scheduled('fluent_support_weekly_tasks')) {
40 43 wp_schedule_event(time(), 'weekly', 'fluent_support_weekly_tasks');
41 44 }
42 45
43 - /*
44 - * The below schedule is powered by Action Scheduler by WooCommerce
45 - * It will run every 30 minutes.
46 - */
47 - if (false === as_next_scheduled_action('fluent_support_half_hourly')) {
48 - as_schedule_recurring_action(time(), 1800, 'fluent_support_half_hourly', [], 'fluent-support', true);
46 + global $wpdb;
47 + $table = esc_sql($wpdb->prefix . 'fs_tickets');
48 + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- $table is sanitized via esc_sql(); no user input.
49 + $column_exists = $wpdb->get_var("SHOW COLUMNS FROM `{$table}` LIKE 'serial_number'");
50 + if ($column_exists) {
51 + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
52 + $has_null = $wpdb->get_var("SELECT id FROM `{$table}` WHERE `serial_number` IS NULL LIMIT 1");
53 + if ($has_null) {
54 + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
55 + $wpdb->query("UPDATE `{$table}` SET `serial_number` = `id` WHERE `serial_number` IS NULL");
56 + }
49 57 }
50 58
59 + // Half-hourly Action Scheduler job. Only schedule it while something
60 + // listens (currently only Pro), otherwise it fires with no callback.
61 + $hasListener = has_action('fluent_support_half_hourly');
62 + $nextRun = as_next_scheduled_action('fluent_support_half_hourly', [], 'fluent-support');
63 +
64 + if ($hasListener) {
65 + if (false === $nextRun) {
66 + as_schedule_recurring_action(time(), 1800, 'fluent_support_half_hourly', [], 'fluent-support', true);
67 + }
68 + } elseif (false !== $nextRun) {
69 + as_unschedule_all_actions('fluent_support_half_hourly', [], 'fluent-support');
70 + }
51 71 });
52 72
53 73 });
54 74 };