diff --git a/core/includes/batch.inc b/core/includes/batch.inc index 84291ae..60e8fc8 100644 --- a/core/includes/batch.inc +++ b/core/includes/batch.inc @@ -18,8 +18,8 @@ use Drupal\Component\Utility\UrlHelper; use Drupal\Core\Batch\Percentage; use Drupal\Core\Form\FormState; +use Drupal\Core\Render\JsonResponse; use Drupal\Core\Url; -use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RedirectResponse; diff --git a/core/lib/Drupal/Core/Render/JsonResponse.php b/core/lib/Drupal/Core/Render/JsonResponse.php new file mode 100644 index 0000000..28ce9a9 --- /dev/null +++ b/core/lib/Drupal/Core/Render/JsonResponse.php @@ -0,0 +1,16 @@ +sendHeaders(); - $this->sendContent(); - - if (!$this->shutdownFunctionRegistered() && function_exists('fastcgi_finish_request')) { - fastcgi_finish_request(); - } - elseif ('cli' !== PHP_SAPI) { - static::closeOutputBuffers(0, TRUE); - } - return $this; - } - - /** - * Determines if shutdown functions are registered. - * - * @return bool - * True if any shutdown functions are registered. - */ - protected function shutdownFunctionRegistered() { - return drupal_register_shutdown_function() ? TRUE : FALSE; - } + use ResponseTrait; } diff --git a/core/lib/Drupal/Core/Render/ResponseTrait.php b/core/lib/Drupal/Core/Render/ResponseTrait.php new file mode 100644 index 0000000..8093c04 --- /dev/null +++ b/core/lib/Drupal/Core/Render/ResponseTrait.php @@ -0,0 +1,48 @@ +sendHeaders(); + $this->sendContent(); + + if (!$this->shutdownFunctionRegistered() && function_exists('fastcgi_finish_request')) { + fastcgi_finish_request(); + } + elseif ('cli' !== PHP_SAPI) { + static::closeOutputBuffers(0, TRUE); + } + return $this; + } + + /** + * Determines if shutdown functions are registered. + * + * @return bool + * True if any shutdown functions are registered. + */ + protected function shutdownFunctionRegistered() { + return drupal_register_shutdown_function() ? TRUE : FALSE; + } + +}