Expose clearing the profiles and fix it

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
This commit is contained in:
Carl Schwan 2022-09-22 12:36:15 +02:00 committed by Julius Härtl (Rebase PR Action)
parent 20ea9a2535
commit fda3af7915
3 changed files with 11 additions and 0 deletions

View file

@ -99,6 +99,7 @@ class FileProfilerStorage {
$iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST);
foreach ($iterator as $file) {
$file = $file->getPathInfo();
if (is_file($file)) {
unlink($file);
} else {

View file

@ -102,4 +102,8 @@ class Profiler implements IProfiler {
public function setEnabled(bool $enabled): void {
$this->enabled = $enabled;
}
public function clear(): void {
$this->storage->purge();
}
}

View file

@ -98,4 +98,10 @@ interface IProfiler {
* @since 24.0.0
*/
public function collect(Request $request, Response $response): IProfile;
/**
* Clear the stored profiles
* @since 25.0.0
*/
public function clear(): void;
}