mirror of
https://github.com/nextcloud/server.git
synced 2026-06-12 18:21:40 -04:00
Merge pull request #33292 from nextcloud/no-profiler
don't hard error when trying to load profiles with no profiler registered
This commit is contained in:
commit
63fc83de26
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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue