Skip to content

Commit 57ddfb6

Browse files
committed
add option to clear saved profiles
Signed-off-by: Robin Appelman <[email protected]>
1 parent 8d599c3 commit 57ddfb6

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

lib/private/Profiler/FileProfilerStorage.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,4 +283,8 @@ protected function createProfileFromData(string $token, array $data, IProfile $p
283283

284284
return $profile;
285285
}
286+
287+
public function clear() {
288+
\OC_Helper::rmdirr($this->folder, false);
289+
}
286290
}

lib/private/Profiler/Profiler.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,8 @@ public function isEnabled(): bool {
102102
public function setEnabled(bool $enabled): void {
103103
$this->enabled = $enabled;
104104
}
105+
106+
public function clear() {
107+
$this->storage->clear();
108+
}
105109
}

lib/public/Profiler/IProfiler.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,12 @@ public function setEnabled(bool $enabled): void;
9898
* @since 24.0.0
9999
*/
100100
public function collect(Request $request, Response $response): IProfile;
101+
102+
/**
103+
* Remove all stored profiles
104+
*
105+
* @return mixed
106+
* @since 25.0.0
107+
*/
108+
public function clear();
101109
}

0 commit comments

Comments
 (0)