PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 1.0.97
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v1.0.97
2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 1.1.0 All 77 releases
fluent-community / boot / app.php

app.php in FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses 1.0.97, at boot/app.php

64 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if (!defined('ABSPATH')) exit; // Exit if accessed directly
2
3 use FluentCommunity\App\Hooks\Handlers\ActivationHandler;
4 use FluentCommunity\App\Hooks\Handlers\DeactivationHandler;
5 use FluentCommunity\Framework\Foundation\Application;
6
7 return function ($file) {
8
9 $app = new Application($file);
10
11 register_activation_hook($file, function () use ($app) {
12 ($app->make(ActivationHandler::class))->handle();
13
14 if (function_exists('\as_next_scheduled_action')) {
15 if (!\as_next_scheduled_action('fluent_community_scheduled_hour_jobs')) {
16 as_schedule_recurring_action(time(), 3600, 'fluent_community_scheduled_hour_jobs', [], 'fluent-community');
17 }
18
19 if (!\as_next_scheduled_action('fluent_community_daily_jobs')) {
20 as_schedule_recurring_action(time(), 86400, 'fluent_community_daily_jobs', [], 'fluent-community');
21 }
22 }
23
24 });
25
26 register_deactivation_hook($file, function () use ($app) {
27 ($app->make(DeactivationHandler::class))->handle();
28 });
29
30 require_once FLUENT_COMMUNITY_PLUGIN_DIR . 'vendor/woocommerce/action-scheduler/action-scheduler.php';
31 require_once FLUENT_COMMUNITY_PLUGIN_DIR . 'app/Functions/helpers.php';
32
33 if (file_exists(FLUENT_COMMUNITY_PLUGIN_DIR . 'Modules/modules_init.php')) {
34 require_once FLUENT_COMMUNITY_PLUGIN_DIR . 'Modules/modules_init.php';
35 }
36
37 add_action('plugins_loaded', function () use ($app) {
38 do_action('fluent_community/portal_loaded', $app);
39 });
40
41 add_action('fluent_community/portal_render_for_user', function () {
42 if (!\FluentCommunity\App\Services\Helper::isSiteAdmin()) {
43 return;
44 }
45
46 if (!\as_next_scheduled_action('fluent_community_scheduled_hour_jobs')) {
47 as_schedule_recurring_action(time(), 3600, 'fluent_community_scheduled_hour_jobs', [], 'fluent-community');
48 }
49
50 if (!\as_next_scheduled_action('fluent_community_daily_jobs')) {
51 \as_schedule_recurring_action(time(), 86400, 'fluent_community_daily_jobs', [], 'fluent-community');
52 }
53
54 /*
55 * We will remove this after final release
56 */
57 $currentDBVersion = get_option('fluent_community_db_version');
58 if (!$currentDBVersion || version_compare($currentDBVersion, FLUENT_COMMUNITY_DB_VERSION, '<')) {
59 update_option('fluent_community_db_version', FLUENT_COMMUNITY_DB_VERSION, 'no');
60 \FluentCommunity\Database\DBMigrator::run();
61 }
62 });
63 };
64