- WordPress 6.9.4 (es_ES) with Kadence theme - Homepage: Hero, La Asociación, Pilares, Beneficios, Eventos, Miembros, Hazte Miembro, Contacto - Brand identity: #13294b navy, #a12932 burgundy, #c69c48 gold - Fonts: Raleway (headings) + Source Sans 3 (body) + Lato (UI) - Plugins: Kadence Blocks, Polylang, Contact Form 7 - Custom CSS with full brand styling and responsive layout - HTTPS enforced via wp-config.php proxy detection
48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?php declare( strict_types=1 );
|
|
|
|
namespace KadenceWP\KadenceBlocks\Shutdown;
|
|
|
|
/**
|
|
* Process different tasks during the WordPress shutdown action.
|
|
*
|
|
* @see Shutdown_Provider::register()
|
|
*/
|
|
final class Shutdown_Handler {
|
|
|
|
/**
|
|
* @var Shutdown_Collection
|
|
*/
|
|
private $collection;
|
|
|
|
public function __construct( Shutdown_Collection $collection ) {
|
|
$this->collection = $collection;
|
|
}
|
|
|
|
/**
|
|
* If running on PHP-FPM, this will return the request, but continue processing
|
|
* any code after in the same thread, which means it instantly sends the request back
|
|
* to the browser without needing to wait for the code after it to process.
|
|
*
|
|
* @action shutdown
|
|
*
|
|
* @return void
|
|
*/
|
|
public function handle(): void {
|
|
// So far, there is no reason to process this unless this is a REST request.
|
|
if ( ! defined( 'REST_REQUEST' ) || ! REST_REQUEST ) {
|
|
return;
|
|
}
|
|
|
|
// Return request early, if possible.
|
|
if ( function_exists( 'fastcgi_finish_request' ) ) {
|
|
fastcgi_finish_request();
|
|
}
|
|
|
|
// Process all Terminable tasks in the background.
|
|
foreach ( $this->collection->all() as $task ) {
|
|
$task->terminate();
|
|
}
|
|
}
|
|
|
|
}
|