PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backups, Restore, Migration & Clone / 4.10.0
WP STAGING – WordPress Backups, Restore, Migration & Clone v4.10.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 / Framework / Onboarding / FirstInstall.php
wp-staging / Framework / Onboarding Last commit date
BackupPluginsDetector.php 1 week ago FirstInstall.php 1 week ago FreeOnboarding.php 1 week ago NextStepRenderer.php 1 week ago OnboardingAjax.php 1 week ago OnboardingJourney.php 1 week ago QueuedBackup.php 1 week ago
FirstInstall.php
62 lines
1 <?php
2
3 namespace WPStaging\Framework\Onboarding;
4
5 use WPStaging\Staging\Sites;
6
7 /**
8 * Records whether an activation is the first WP STAGING has ever seen on this site.
9 *
10 * The marker is written only when the activation finds no WP STAGING footprint
11 * at all, which is what keeps first-run experiences away from a user who merely
12 * reactivates or upgrades: their activation ran long before the marker existed.
13 */
14 class FirstInstall
15 {
16 /** @var string UNIX timestamp of the first ever activation on this site. */
17 const OPTION_FIRST_INSTALL = 'wpstg_first_install';
18
19 /**
20 * Options only a previous run can have left behind; any one means this is not
21 * a first install. `wpstg_settings` is deliberately absent — booting the
22 * plugin writes it before this check runs, so it is present on fresh installs.
23 *
24 * @var string[]
25 */
26 const FOOTPRINT_OPTIONS = [
27 'wpstg_installDate',
28 'wpstg_free_install_date',
29 'wpstgpro_install_date',
30 'wpstg_version',
31 Sites::STAGING_SITES_OPTION,
32 ];
33
34 /**
35 * Must run at the very top of the activation routine, before WP STAGING
36 * writes any of its own options.
37 *
38 * @return bool Whether this activation was a first install.
39 */
40 public static function markIfFirstInstall(): bool
41 {
42 if (get_option(self::OPTION_FIRST_INSTALL) !== false) {
43 return true;
44 }
45
46 foreach (self::FOOTPRINT_OPTIONS as $option) {
47 if (get_option($option) !== false) {
48 return false;
49 }
50 }
51
52 add_option(self::OPTION_FIRST_INSTALL, (string)time(), '', false);
53
54 return true;
55 }
56
57 public function isFirstInstall(): bool
58 {
59 return get_option(self::OPTION_FIRST_INSTALL) !== false;
60 }
61 }
62