PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backup, Restore, Migration & Clone / 4.8.0
WP STAGING – WordPress Backup, Restore, Migration & Clone v4.8.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 / bootstrap.php
wp-staging Last commit date
Backend 1 month ago Backup 1 month ago Basic 3 months ago Component 1 month ago Core 1 month ago Framework 1 month ago Frontend 5 months ago Notifications 8 months ago Staging 1 month ago assets 1 month ago languages 1 month ago resources 1 year ago vendor_wpstg 1 month ago views 1 month ago CONTRIBUTING.md 1 year ago Deactivate.php 8 months ago README.md 3 months ago SECURITY.md 2 years ago autoloader.php 1 month ago bootstrap.php 1 month ago constantsFree.php 1 month ago freeBootstrap.php 1 month ago install.php 1 year ago opcacheBootstrap.php 1 month ago readme.txt 1 month ago runtimeRequirements.php 3 months ago uninstall.php 2 months ago wp-staging-error-handler.php 6 months ago wp-staging.php 1 month ago
bootstrap.php
157 lines
1 <?php
2
3 use WPStaging\Core\WPStaging;
4
5 /**
6 * @var string $pluginFilePath The absolute path to the main file of this plugin.
7 */
8 $pluginFilePath = $pluginFilePath ?? '';
9 if (file_exists(__DIR__ . '/autoloader_dev.php')) {
10 include_once __DIR__ . '/autoloader_dev.php';
11 } elseif (wpstgDoLoadPluginAutoLoad($pluginFilePath)) {
12 include_once __DIR__ . '/autoloader.php';
13 }
14
15 // Early bail: vendor_wpstg files missing/corrupted (issue #5074), or any other
16 // autoloader malfunction. Verifying a vendor class catches the case where src.php
17 // loads fine but vendor.php is broken — \WPStaging\Core\WPStaging alone is not
18 // enough because it lives in the src map. Both checks together cover src/vendor
19 // corruption symmetrically. The vendor class also resolves under autoloader_dev.php
20 // via class_alias, so this works in dev as well as dist.
21 if (
22 !class_exists('\WPStaging\Vendor\lucatume\DI52\Container')
23 || !class_exists('\WPStaging\Core\WPStaging')
24 ) {
25 add_action('admin_notices', function () {
26 if (!current_user_can('manage_options')) {
27 return;
28 }
29
30 // Hard-coded English: at this point we cannot trust that the plugin's
31 // text-domain bootstrap loaded, so __() may misbehave.
32 echo '<div class="notice notice-error"><p><strong>WP STAGING:</strong> '
33 . esc_html('Plugin files appear to be missing or corrupted. Please reinstall the plugin or contact support@wp-staging.com for help.')
34 . '</p></div>';
35 });
36
37 return;
38 }
39
40 // Register common constants.
41 if (!defined('WPSTG_PLUGIN_FILE')) {
42 define('WPSTG_PLUGIN_FILE', $pluginFilePath);
43 }
44
45 // Absolute path to plugin dir /var/www/.../plugins/wp-staging(-pro)/
46 if (!defined('WPSTG_PLUGIN_DIR')) {
47 define('WPSTG_PLUGIN_DIR', plugin_dir_path($pluginFilePath));
48 }
49
50 // URL of the base folder
51 if (!defined('WPSTG_PLUGIN_URL')) {
52 define('WPSTG_PLUGIN_URL', plugin_dir_url($pluginFilePath));
53 }
54
55 // Expected version number of the must-use plugin 'optimizer'. Used for automatic updates of the mu-plugin
56 if (!defined('WPSTG_OPTIMIZER_MUVERSION')) {
57 define('WPSTG_OPTIMIZER_MUVERSION', '1.6.0');
58 }
59
60 // /var/www/single/wp-content/plugins/wp-staging-pro/wp-staging-pro.php => wp-staging-pro
61 if (!defined('WPSTG_PLUGIN_SLUG')) {
62 define('WPSTG_PLUGIN_SLUG', basename(dirname($pluginFilePath)));
63 }
64
65 // An identifier that is the same both for WP STAGING Free and WP STAGING | PRO
66 if (!defined('WPSTG_PLUGIN_DOMAIN')) {
67 define('WPSTG_PLUGIN_DOMAIN', 'wp-staging');
68 }
69
70 // Absolute path to the views folder /var/www/.../plugins/wp-staging(-pro)/views/
71 if (!defined('WPSTG_VIEWS_DIR')) {
72 define('WPSTG_VIEWS_DIR', WPSTG_PLUGIN_DIR . 'views/');
73 }
74
75 // Absolute path to the resources folder /var/www/.../plugins/wp-staging(-pro)/resources/
76 if (!defined('WPSTG_RESOURCES_DIR')) {
77 define('WPSTG_RESOURCES_DIR', WPSTG_PLUGIN_DIR . 'resources/');
78 }
79
80 // Define WordPress default constants if not already defined in outdated WP version for backward compatibility.
81 if (!defined('KB_IN_BYTES')) {
82 define('KB_IN_BYTES', 1024);
83 }
84
85 if (!defined('MB_IN_BYTES')) {
86 define('MB_IN_BYTES', 1024 * KB_IN_BYTES);
87 }
88
89 if (!defined('GB_IN_BYTES')) {
90 define('GB_IN_BYTES', 1024 * MB_IN_BYTES);
91 }
92
93 if (!defined('MINUTE_IN_SECONDS')) {
94 define('MINUTE_IN_SECONDS', 60);
95 }
96
97 if (!defined('HOUR_IN_SECONDS')) {
98 define('HOUR_IN_SECONDS', 60 * MINUTE_IN_SECONDS);
99 }
100
101 if (!defined('DAY_IN_SECONDS')) {
102 define('DAY_IN_SECONDS', 24 * HOUR_IN_SECONDS);
103 }
104
105 if (!defined('WEEK_IN_SECONDS')) {
106 define('WEEK_IN_SECONDS', 7 * DAY_IN_SECONDS);
107 }
108
109 if (!defined('MONTH_IN_SECONDS')) {
110 define('MONTH_IN_SECONDS', 30 * DAY_IN_SECONDS);
111 }
112
113 if (!defined('YEAR_IN_SECONDS')) {
114 define('YEAR_IN_SECONDS', 365 * DAY_IN_SECONDS);
115 }
116
117 /**
118 * Register specific Pro and Free constants. We register them here instead of on the
119 * entrypoint because we want to make sure we are defining constants for the plugins
120 * actually being bootstrapped.
121 */
122 if (file_exists(__DIR__ . '/constantsPro.php')) {
123 include_once __DIR__ . '/constantsPro.php';
124 } elseif (file_exists(__DIR__ . '/constantsFree.php')) {
125 include_once __DIR__ . '/constantsFree.php';
126 }
127
128 if (!function_exists('\WPStaging\functions\debug_log') && file_exists(__DIR__ . '/wp-staging-error-handler.php')) {
129 include_once __DIR__ . '/wp-staging-error-handler.php';
130 }
131
132 // This is needed otherwise unit tests doesn't work because of new DI52 library
133 if (php_sapi_name() === "cli" && defined("WPSTG_UNIT_TESTS") && constant("WPSTG_UNIT_TESTS")) {
134 WPStaging::setUseBaseContainerSingleton(true);
135 }
136
137 $wpStaging = WPStaging::getInstance();
138 $wpStaging->registerErrorHandler();
139
140 /*
141 * Set the WPSTG_COMPATIBLE constant in the container,
142 * so that we can change it for testing purposes.
143 */
144 $wpStaging->set('WPSTG_COMPATIBLE', WPSTG_COMPATIBLE);
145
146 /*
147 * Used during testing to enable virtual filesystem.
148 */
149 $wpStaging->set('WPSTG_ALLOW_VFS', false);
150
151 // Wordpress DB Object
152 global $wpdb;
153
154 if ($wpdb instanceof wpdb) {
155 $wpStaging->set("wpdb", $wpdb);
156 }
157