PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 1.0.98
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v1.0.98
2.11.0 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 All 78 releases
fluent-community / app / Hooks / Handlers / ActivationHandler.php

ActivationHandler.php in FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses 1.0.98, at app/Hooks/Handlers/ActivationHandler.php

61 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCommunity\App\Hooks\Handlers;
4
5 use FluentCommunity\App\Services\Helper;
6 use FluentCommunity\Framework\Foundation\Application;
7 use FluentCommunity\Database\DBMigrator;
8 use FluentCommunity\App\Models\SpaceGroup;
9
10 class ActivationHandler
11 {
12 protected $app = null;
13
14 public function __construct(Application $app)
15 {
16 $this->app = $app;
17 }
18
19 public function handle($network_wide = false)
20 {
21 DBMigrator::run($network_wide);
22 update_option('fluent_community_db_version', FLUENT_COMMUNITY_DB_VERSION, 'no');
23
24 // We may need to register the action schedulers here
25 if (!\as_next_scheduled_action('fluent_community_scheduled_hour_jobs')) {
26 \as_schedule_recurring_action(time(), 3600, 'fluent_community_scheduled_hour_jobs', [], 'fluent-community');
27 }
28
29 if (!\as_next_scheduled_action('fluent_community_daily_jobs')) {
30 \as_schedule_recurring_action(time(), 86400, 'fluent_community_daily_jobs', [], 'fluent-community');
31 }
32
33 $slug = Helper::getPortalSlug();
34 add_rewrite_rule('^' . $slug . '/?$', 'index.php?fcom_route=portal_home', 'top'); // For /hooks
35 add_rewrite_rule('^' . $slug . '/(.+)/?', 'index.php?fcom_route=$matches[1]', 'top');
36 // flush rewrite rules
37 flush_rewrite_rules(true);
38 }
39
40 public function maybeCreateDefaultSpaceGroup()
41 {
42 $exist = SpaceGroup::query()->exists();
43 if ($exist) {
44 return false;
45 }
46
47 $defaultData = [
48 'title' => 'Get Started',
49 'slug' => 'get-started',
50 'serial' => 1,
51 'description' => 'This is the default menu group. Please update the title and description.',
52 'settings' => [
53 'hide_members' => 'no',
54 'always_show_spaces' => 'yes'
55 ]
56 ];
57
58 return SpaceGroup::create($defaultData);
59 }
60 }
61