[HttpKernel] compress files generated by the profiler
This commit is contained in:
parent
373469b53f
commit
08f9470556
@ -119,6 +119,10 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
if (\function_exists('gzcompress')) {
|
||||
$file = 'compress.zlib://'.$file;
|
||||
}
|
||||
|
||||
return $this->createProfileFromData($token, unserialize(file_get_contents($file)));
|
||||
}
|
||||
|
||||
@ -161,7 +165,14 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
'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 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
continue;
|
||||
}
|
||||
|
||||
if (\function_exists('gzcompress')) {
|
||||
$file = 'compress.zlib://'.$file;
|
||||
}
|
||||
|
||||
$profile->addChild($this->createProfileFromData($token, unserialize(file_get_contents($file)), $profile));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user