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
commonBootstrap.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
1 month ago
wp-staging-error-handler.php
6 months ago
wp-staging.php
1 month ago
commonBootstrap.php
66 lines
| 1 | <?php |
| 2 | |
| 3 | if (!function_exists('wpstgShouldSkipBootstrap')) { |
| 4 | function wpstgShouldSkipBootstrap(): bool |
| 5 | { |
| 6 | if (defined('WP_INSTALLING') && WP_INSTALLING) { |
| 7 | return false; |
| 8 | } |
| 9 | |
| 10 | if (is_admin()) { |
| 11 | return false; |
| 12 | } |
| 13 | |
| 14 | if (defined('DOING_CRON') && DOING_CRON) { |
| 15 | return false; |
| 16 | } |
| 17 | |
| 18 | if (defined('WP_CLI') && WP_CLI) { |
| 19 | return false; |
| 20 | } |
| 21 | |
| 22 | // WordPress login page: needed for post-restore login prompt and other login hooks. |
| 23 | $requestUri = isset($_SERVER['REQUEST_URI']) ? sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'])) : ''; |
| 24 | if (strpos($requestUri, '/wp-login.php') !== false) { |
| 25 | return false; |
| 26 | } |
| 27 | |
| 28 | // Temporary/auto login links (?wpstg_login=, ?wpstg_staging_login=, ?action=wpstg_*). |
| 29 | $action = isset($_GET['action']) ? sanitize_key($_GET['action']) : ''; |
| 30 | if ( |
| 31 | !empty($_GET['wpstg_login']) || |
| 32 | !empty($_GET['wpstg_staging_login']) || |
| 33 | strpos($action, 'wpstg_') === 0 |
| 34 | ) { |
| 35 | return false; |
| 36 | } |
| 37 | |
| 38 | // REST_REQUEST isn't defined at plugins_loaded; resolve prefix dynamically |
| 39 | // so custom rest_url_prefix filters are respected. |
| 40 | $restPrefix = '/' . trim(apply_filters('rest_url_prefix', 'wp-json'), '/') . '/'; |
| 41 | if (strpos($requestUri, $restPrefix) !== false) { |
| 42 | return false; |
| 43 | } |
| 44 | |
| 45 | if (!empty($_GET['rest_route'])) { |
| 46 | return false; |
| 47 | } |
| 48 | |
| 49 | // Non-WP-CLI PHP processes (test runners, deploy tools) also need full bootstrap. |
| 50 | if (php_sapi_name() === 'cli') { |
| 51 | return false; |
| 52 | } |
| 53 | |
| 54 | // Staging sites need full bootstrap: login gate, permission checks, admin bar CSS |
| 55 | if (get_option('wpstg_is_staging_site') === 'true') { |
| 56 | return false; |
| 57 | } |
| 58 | |
| 59 | if (file_exists(ABSPATH . '.wp-staging')) { |
| 60 | return false; |
| 61 | } |
| 62 | |
| 63 | return true; |
| 64 | } |
| 65 | } |
| 66 |