PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backups, Restore, Migration & Clone / 4.11.2
WP STAGING – WordPress Backups, Restore, Migration & Clone v4.11.2
4.11.2 4.11.1 4.11.0 4.10.0 4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.1 trunk 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.10.0 3.2.0 3.3.1 3.3.2 3.3.3 3.4.1 3.4.3 3.5.0 3.6.0 3.7.1 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.8.0
wp-staging / Staging / FirstRun.php
wp-staging / Staging Last commit date
Ajax 2 weeks ago Dto 2 weeks ago Interfaces 1 week ago Jobs 2 weeks ago Renderer 2 weeks ago Service 6 days ago Tasks 6 days ago Traits 1 week ago CloneOptions.php 2 weeks ago FirstRun.php 2 weeks ago Sites.php 1 week ago StagingServiceProvider.php 2 weeks ago
FirstRun.php
96 lines
1 <?php
2
3 namespace WPStaging\Staging;
4
5 use WPStaging\Frontend\LoginNotice;
6 use WPStaging\Framework\Notices\DisabledItemsNotice;
7 use WPStaging\Core\WPStaging;
8 use WPStaging\Framework\Assets\Assets;
9 use WPStaging\Framework\SiteInfo;
10 use WPStaging\Framework\ThirdParty\WordFence;
11 use WPStaging\Framework\ThirdParty\ThirdPartyCacheHandler;
12 use WPStaging\Framework\Filesystem\OPcache;
13
14
15
16
17
18
19
20
21 class FirstRun
22 {
23
24
25
26 const FIRST_RUN_KEY = 'wpstg_execute';
27
28
29
30
31 const MAILS_DISABLED_KEY = 'wpstg_emails_disabled';
32
33
34 const WOO_SCHEDULER_ENABLED_KEY = 'wpstg_woo_scheduler_enabled';
35
36 public function init()
37 {
38 if (!(new SiteInfo())->isStagingSite()) {
39 return;
40 }
41
42 if (!get_option(self::FIRST_RUN_KEY)) {
43 return;
44 }
45
46 $this->initActions();
47
48 $this->removeInitialRunOption();
49 }
50
51
52
53
54
55 private function initActions()
56 {
57
58 (new LoginNotice())->setTransient();
59
60
61 delete_transient(Assets::TRANSIENT_REST_URL);
62
63
64 WPStaging::make(DisabledItemsNotice::class)->enable();
65
66
67
68
69
70
71 (new WordFence())->renameUserIni();
72
73 if (class_exists('\WPStaging\Pro\Staging\NetworkClone')) {
74 (new \WPStaging\Pro\Staging\NetworkClone())->init();
75 }
76
77
78 $cacheHandler = WPStaging::make(ThirdPartyCacheHandler::class);
79 $cacheHandler->purgeEnduranceCache();
80
81
82 do_action('wpstg.clone_first_run');
83
84
85 WPStaging::make(OPcache::class)->maybeInvalidate();
86 }
87
88
89
90
91 private function removeInitialRunOption()
92 {
93 delete_option(static::FIRST_RUN_KEY);
94 }
95 }
96