Skip to content

Commit

Permalink
Merge pull request #33292 from nextcloud/no-profiler
Browse files Browse the repository at this point in the history
don't hard error when trying to load profiles with no profiler registered
  • Loading branch information
icewind1991 authored Apr 5, 2023
2 parents a1b7f13 + 43b61d2 commit 63fc83d
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/private/Profiler/Profiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,19 @@ public function loadProfileFromResponse(Response $response): ?IProfile {
}

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 {
Expand All @@ -88,7 +96,11 @@ public function collect(Request $request, Response $response): IProfile {
*/
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 {
Expand Down

0 comments on commit 63fc83d

Please sign in to comment.