Merge pull request #33292 from nextcloud/no-profiler

don't hard error when trying to load profiles with no profiler registered
pull/37428/head
Robin Appelman 2023-04-05 15:57:50 +07:00 committed by GitHub
commit 63fc83de26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 3 deletions

@ -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 {