summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2023-04-05 15:57:50 +0200
committerGitHub <noreply@github.com>2023-04-05 15:57:50 +0200
commit63fc83de26f362e951eb57ee979425584c6bde1b (patch)
tree94362d49fbf1d10fd84a73298633edf42cee77c5
parenta1b7f132c8a495fbf8fcce4612a9cd6b86d511d4 (diff)
parent43b61d26e86e5fafd22e7b77c9139b07313ad44f (diff)
downloadnextcloud-server-63fc83de26f362e951eb57ee979425584c6bde1b.tar.gz
nextcloud-server-63fc83de26f362e951eb57ee979425584c6bde1b.zip
Merge pull request #33292 from nextcloud/no-profiler
don't hard error when trying to load profiles with no profiler registered
-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 {