PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backup, Restore, Migration & Clone / 4.7.2
WP STAGING – WordPress Backup, Restore, Migration & Clone v4.7.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 / bootstrap.php
wp-staging Last commit date
Backend 3 months ago Backup 3 months ago Basic 3 months ago Component 6 months ago Core 3 months ago Framework 3 months ago Frontend 5 months ago Notifications 8 months ago Staging 3 months ago assets 3 months ago languages 3 months ago resources 1 year ago vendor_wpstg 3 months ago views 3 months ago CONTRIBUTING.md 1 year ago Deactivate.php 8 months ago README.md 3 months ago SECURITY.md 2 years ago autoloader.php 6 months ago bootstrap.php 9 months ago constantsFree.php 3 months ago freeBootstrap.php 1 year ago install.php 1 year ago opcacheBootstrap.php 3 months ago readme.txt 3 months ago runtimeRequirements.php 3 months ago uninstall.php 3 months ago wp-staging-error-handler.php 6 months ago wp-staging.php 3 months ago
bootstrap.php
137 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: Unexpected behavior from the autoloader.
16 if (!class_exists('\WPStaging\Core\WPStaging')) {
17 return;
18 }
19
20 // Register common constants.
21 if (!defined('WPSTG_PLUGIN_FILE')) {
22 define('WPSTG_PLUGIN_FILE', $pluginFilePath);
23 }
24
25 // Absolute path to plugin dir /var/www/.../plugins/wp-staging(-pro)/
26 if (!defined('WPSTG_PLUGIN_DIR')) {
27 define('WPSTG_PLUGIN_DIR', plugin_dir_path($pluginFilePath));
28 }
29
30 // URL of the base folder
31 if (!defined('WPSTG_PLUGIN_URL')) {
32 define('WPSTG_PLUGIN_URL', plugin_dir_url($pluginFilePath));
33 }
34
35 // Expected version number of the must-use plugin 'optimizer'. Used for automatic updates of the mu-plugin
36 if (!defined('WPSTG_OPTIMIZER_MUVERSION')) {
37 define('WPSTG_OPTIMIZER_MUVERSION', '1.6.0');
38 }
39
40 // /var/www/single/wp-content/plugins/wp-staging-pro/wp-staging-pro.php => wp-staging-pro
41 if (!defined('WPSTG_PLUGIN_SLUG')) {
42 define('WPSTG_PLUGIN_SLUG', basename(dirname($pluginFilePath)));
43 }
44
45 // An identifier that is the same both for WP STAGING Free and WP STAGING | PRO
46 if (!defined('WPSTG_PLUGIN_DOMAIN')) {
47 define('WPSTG_PLUGIN_DOMAIN', 'wp-staging');
48 }
49
50 // Absolute path to the views folder /var/www/.../plugins/wp-staging(-pro)/views/
51 if (!defined('WPSTG_VIEWS_DIR')) {
52 define('WPSTG_VIEWS_DIR', WPSTG_PLUGIN_DIR . 'views/');
53 }
54
55 // Absolute path to the resources folder /var/www/.../plugins/wp-staging(-pro)/resources/
56 if (!defined('WPSTG_RESOURCES_DIR')) {
57 define('WPSTG_RESOURCES_DIR', WPSTG_PLUGIN_DIR . 'resources/');
58 }
59
60 // Define WordPress default constants if not already defined in outdated WP version for backward compatibility.
61 if (!defined('KB_IN_BYTES')) {
62 define('KB_IN_BYTES', 1024);
63 }
64
65 if (!defined('MB_IN_BYTES')) {
66 define('MB_IN_BYTES', 1024 * KB_IN_BYTES);
67 }
68
69 if (!defined('GB_IN_BYTES')) {
70 define('GB_IN_BYTES', 1024 * MB_IN_BYTES);
71 }
72
73 if (!defined('MINUTE_IN_SECONDS')) {
74 define('MINUTE_IN_SECONDS', 60);
75 }
76
77 if (!defined('HOUR_IN_SECONDS')) {
78 define('HOUR_IN_SECONDS', 60 * MINUTE_IN_SECONDS);
79 }
80
81 if (!defined('DAY_IN_SECONDS')) {
82 define('DAY_IN_SECONDS', 24 * HOUR_IN_SECONDS);
83 }
84
85 if (!defined('WEEK_IN_SECONDS')) {
86 define('WEEK_IN_SECONDS', 7 * DAY_IN_SECONDS);
87 }
88
89 if (!defined('MONTH_IN_SECONDS')) {
90 define('MONTH_IN_SECONDS', 30 * DAY_IN_SECONDS);
91 }
92
93 if (!defined('YEAR_IN_SECONDS')) {
94 define('YEAR_IN_SECONDS', 365 * DAY_IN_SECONDS);
95 }
96
97 /**
98 * Register specific Pro and Free constants. We register them here instead of on the
99 * entrypoint because we want to make sure we are defining constants for the plugins
100 * actually being bootstrapped.
101 */
102 if (file_exists(__DIR__ . '/constantsPro.php')) {
103 include_once __DIR__ . '/constantsPro.php';
104 } elseif (file_exists(__DIR__ . '/constantsFree.php')) {
105 include_once __DIR__ . '/constantsFree.php';
106 }
107
108 if (!function_exists('\WPStaging\functions\debug_log') && file_exists(__DIR__ . '/wp-staging-error-handler.php')) {
109 include_once __DIR__ . '/wp-staging-error-handler.php';
110 }
111
112 // This is needed otherwise unit tests doesn't work because of new DI52 library
113 if (php_sapi_name() === "cli" && defined("WPSTG_UNIT_TESTS") && constant("WPSTG_UNIT_TESTS")) {
114 WPStaging::setUseBaseContainerSingleton(true);
115 }
116
117 $wpStaging = WPStaging::getInstance();
118 $wpStaging->registerErrorHandler();
119
120 /*
121 * Set the WPSTG_COMPATIBLE constant in the container,
122 * so that we can change it for testing purposes.
123 */
124 $wpStaging->set('WPSTG_COMPATIBLE', WPSTG_COMPATIBLE);
125
126 /*
127 * Used during testing to enable virtual filesystem.
128 */
129 $wpStaging->set('WPSTG_ALLOW_VFS', false);
130
131 // Wordpress DB Object
132 global $wpdb;
133
134 if ($wpdb instanceof wpdb) {
135 $wpStaging->set("wpdb", $wpdb);
136 }
137