aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-07-20 15:49:08 +0200
committerRobin Appelman <robin@icewind.nl>2023-04-04 17:24:29 +0200
commit43b61d26e86e5fafd22e7b77c9139b07313ad44f (patch)
tree7ee530c3d7b7250dd2d99830c0b9d2e150d522a1
parent59d0e7711dc84d46b30fd7a66ec13d8207b87150 (diff)
downloadnextcloud-server-43b61d26e86e5fafd22e7b77c9139b07313ad44f.tar.gz
nextcloud-server-43b61d26e86e5fafd22e7b77c9139b07313ad44f.zip
don't hard error when trying to load profiles with no profiler registered
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r--lib/private/Profiler/Profiler.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/private/Profiler/Profiler.php b/lib/private/Profiler/Profiler.php
index 9fd5e76d592..40050b7bf43 100644
--- a/lib/private/Profiler/Profiler.php
+++ b/lib/private/Profiler/Profiler.php
@@ -61,11 +61,19 @@ class Profiler implements IProfiler {
}
public function loadProfile(string $token): ?IProfile {
- return $this->storage->read($token);
+ if ($this->storage) {
+ return $this->storage->read($token);
+ } else {
+ return null;
+ }
}
public function saveProfile(IProfile $profile): bool {
- return $this->storage->write($profile);
+ if ($this->storage) {
+ return $this->storage->write($profile);
+ } else {
+ return false;
+ }
}
public function collect(Request $request, Response $response): IProfile {
@@ -88,7 +96,11 @@ class Profiler implements IProfiler {
*/
public function find(?string $url, ?int $limit, ?string $method, ?int $start, ?int $end,
string $statusCode = null): array {
- return $this->storage->find($url, $limit, $method, $start, $end, $statusCode);
+ if ($this->storage) {
+ return $this->storage->find($url, $limit, $method, $start, $end, $statusCode);
+ } else {
+ return [];
+ }
}
public function dataProviders(): array {