PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backup, Restore, Migration & Clone / 3.0.0
WP STAGING – WordPress Backup, Restore, Migration & Clone v3.0.0
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 / freeBootstrap.php
wp-staging Last commit date
Backend 2 years ago Backup 2 years ago Basic 2 years ago Core 2 years ago Framework 2 years ago Frontend 2 years ago assets 2 years ago languages 3 years ago vendor_wpstg 2 years ago Deactivate.php 2 years ago README.md 3 years ago autoloader.php 3 years ago bootstrap.php 2 years ago constantsFree.php 2 years ago freeBootstrap.php 3 years ago install.php 3 years ago opcacheBootstrap.php 2 years ago php56-compatibility.php 3 years ago readme.txt 2 years ago runtimeRequirements.php 2 years ago uninstall.php 3 years ago wp-staging-error-handler.php 3 years ago wp-staging.php 2 years ago
freeBootstrap.php
68 lines
1 <?php
2
3 /**
4 * The purpose of the pre-bootstrap process is to make sure the environment is able to run
5 * the plugin without any errors, such as making sure there are no other WPSTAGING instances
6 * active at the same time.
7 *
8 * It works at a low level, without the autoloader, using anonymous callbacks and local variables
9 * to make sure we always use and execute the expected code.
10 *
11 * Since it uses closures, you can't dequeue those actions, but this is expected.
12 *
13 * @var string $pluginFilePath The absolute path to the main file of this plugin.
14 */
15
16 add_action('plugins_loaded', function () use ($pluginFilePath) {
17 // Unused $pluginFilePath: Other code will fail if removed it
18 try {
19 require __DIR__ . '/runtimeRequirements.php';
20 require_once __DIR__ . '/bootstrap.php';
21 } catch (Exception $e) {
22 if (defined('WPSTG_DEBUG') && WPSTG_DEBUG) {
23 error_log('WP STAGING: ' . $e->getMessage());
24 }
25 }
26 }, 11, 0); // The priority of this hook must be larger than 10 for the runtime requirement check to detect older versions of WPSTAGING.
27
28 register_activation_hook($pluginFilePath, function () use ($pluginFilePath) {
29 // Unused $pluginFilePath: Other code will fail if removed it
30 // Prevent WPSTAGING Free activation when Pro is active
31 if (is_multisite()) {
32 foreach (wp_get_active_network_plugins() as $networkActivePlugin) {
33 if (strpos($networkActivePlugin, 'wp-staging-pro.php') !== false) {
34 set_site_transient('wpstgActivatingFreeWhileProIsActive', true, 1 * HOUR_IN_SECONDS);
35 wp_safe_redirect(self_admin_url('plugins.php'));
36 exit;
37 }
38 }
39 }
40 foreach (wp_get_active_and_valid_plugins() as $sitewidePlugin) {
41 if (strpos($sitewidePlugin, 'wp-staging-pro.php') !== false) {
42 // Set a transient that Pro picks up to render a notice to the user.
43 set_site_transient('wpstgActivatingFreeWhileProIsActive', true, 1 * HOUR_IN_SECONDS);
44
45 // Redirects to prevent "Plugin could not be activated because it triggered a fatal error notice".
46 wp_safe_redirect(self_admin_url('plugins.php'));
47
48 // Prevents the activation of this plugin.
49 exit;
50 }
51 }
52
53 try {
54 require __DIR__ . '/runtimeRequirements.php';
55 require_once __DIR__ . '/bootstrap.php';
56 require_once __DIR__ . '/install.php';
57 } catch (Exception $e) {
58 if (defined('WPSTG_DEBUG') && WPSTG_DEBUG) {
59 error_log('WP STAGING: ' . $e->getMessage());
60 }
61 }
62 });
63
64 register_deactivation_hook($pluginFilePath, function () use ($pluginFilePath) {
65 require_once __DIR__ . '/Deactivate.php';
66 new WPStaging\Deactivate($pluginFilePath);
67 });
68