From 08f947055674a661ae11ea6f3c583ed70d59bd7e Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 25 Sep 2019 10:40:15 +0200 Subject: [PATCH] [HttpKernel] compress files generated by the profiler --- .../HttpKernel/Profiler/FileProfilerStorage.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php index 5797bdc41587a..c6c23289ab020 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php +++ b/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php @@ -119,6 +119,10 @@ public function read($token): ?Profile return null; } + if (\function_exists('gzcompress')) { + $file = 'compress.zlib://'.$file; + } + return $this->createProfileFromData($token, unserialize(file_get_contents($file))); } @@ -161,7 +165,14 @@ public function write(Profile $profile): bool 'status_code' => $profile->getStatusCode(), ]; - if (false === file_put_contents($file, serialize($data))) { + $context = stream_context_create(); + + if (\function_exists('gzcompress')) { + $file = 'compress.zlib://'.$file; + stream_context_set_option($context, 'zlib', 'level', 3); + } + + if (false === file_put_contents($file, serialize($data), 0, $context)) { return false; } @@ -282,6 +293,10 @@ protected function createProfileFromData($token, $data, $parent = null) continue; } + if (\function_exists('gzcompress')) { + $file = 'compress.zlib://'.$file; + } + $profile->addChild($this->createProfileFromData($token, unserialize(file_get_contents($file)), $profile)); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy