← All changes
|
core/base/background-process/wp-background-process.php
+0
-40
4.1.0-dev2
→
3.30.1
View file →
| @@ -79,50 +79,10 @@ | ||
| 79 | 79 | public function dispatch() { |
| 80 | 80 | // Schedule the cron healthcheck. |
| 81 | 81 | $this->schedule_event(); |
| 82 | 82 | |
| 83 | - // On admin page requests (not AJAX/cron), also process on shutdown as fallback. | |
| 84 | - // This ensures background tasks run even if HTTP loopback requests are blocked. | |
| 85 | - if ( is_admin() && ! wp_doing_ajax() && ! wp_doing_cron() ) { | |
| 86 | - add_action( 'shutdown', [ $this, 'maybe_handle_on_shutdown' ], 0 ); | |
| 87 | - } | |
| 88 | - | |
| 89 | 83 | // Perform remote post. |
| 90 | 84 | return parent::dispatch(); |
| 91 | - } | |
| 92 | - | |
| 93 | - /** | |
| 94 | - * Maybe handle on shutdown | |
| 95 | - * | |
| 96 | - * Fallback handler for when HTTP loopback requests are blocked. | |
| 97 | - * Flushes output to browser first, then processes the queue directly. | |
| 98 | - * | |
| 99 | - * @access public | |
| 100 | - */ | |
| 101 | - public function maybe_handle_on_shutdown() { | |
| 102 | - // Don't run if already processed via loopback or if queue is empty. | |
| 103 | - if ( $this->is_process_running() ) { | |
| 104 | - return; | |
| 105 | - } | |
| 106 | - | |
| 107 | - if ( $this->is_queue_empty() ) { | |
| 108 | - return; | |
| 109 | - } | |
| 110 | - | |
| 111 | - // Flush output to browser so page loads immediately. | |
| 112 | - if ( ob_get_level() ) { | |
| 113 | - wp_ob_end_flush_all(); | |
| 114 | - } | |
| 115 | - | |
| 116 | - // Finish the request - browser gets response, PHP continues. | |
| 117 | - if ( function_exists( 'fastcgi_finish_request' ) ) { | |
| 118 | - fastcgi_finish_request(); | |
| 119 | - } elseif ( function_exists( 'litespeed_finish_request' ) ) { | |
| 120 | - litespeed_finish_request(); | |
| 121 | - } | |
| 122 | - | |
| 123 | - // Process the queue directly. | |
| 124 | - $this->handle(); | |
| 125 | 85 | } |
| 126 | 86 | |
| 127 | 87 | /** |
| 128 | 88 | * Push to queue |