aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Cache
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2024-02-14 13:30:11 -0100
committerMaxence Lange <maxence@artificial-owl.com>2024-02-14 13:30:27 -0100
commit4e1814acd1a9f2a30925de01fbc55c95a6f425c7 (patch)
tree4ff16f56d1dc2228fc50df7dc4c528caa410857b /lib/private/Files/Cache
parentf2df541d3b3bb0d20d28aaf931e63c3157120680 (diff)
downloadnextcloud-server-4e1814acd1a9f2a30925de01fbc55c95a6f425c7.tar.gz
nextcloud-server-4e1814acd1a9f2a30925de01fbc55c95a6f425c7.zip
migrate metadata to lazy appconfig
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/private/Files/Cache')
-rw-r--r--lib/private/Files/Cache/Cache.php4
-rw-r--r--lib/private/Files/Cache/CacheQueryBuilder.php6
-rw-r--r--lib/private/Files/Cache/QuerySearchHelper.php7
3 files changed, 6 insertions, 11 deletions
diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php
index a512bf76ace..0c0b7b2ad41 100644
--- a/lib/private/Files/Cache/Cache.php
+++ b/lib/private/Files/Cache/Cache.php
@@ -170,7 +170,7 @@ class Cache implements ICache {
} elseif (!$data) {
return $data;
} else {
- $data['metadata'] = $metadataQuery?->extractMetadata($data)->asArray() ?? [];
+ $data['metadata'] = $metadataQuery->extractMetadata($data)->asArray();
return self::cacheEntryFromData($data, $this->mimetypeLoader);
}
}
@@ -242,7 +242,7 @@ class Cache implements ICache {
$result->closeCursor();
return array_map(function (array $data) use ($metadataQuery) {
- $data['metadata'] = $metadataQuery?->extractMetadata($data)->asArray() ?? [];
+ $data['metadata'] = $metadataQuery->extractMetadata($data)->asArray();
return self::cacheEntryFromData($data, $this->mimetypeLoader);
}, $files);
}
diff --git a/lib/private/Files/Cache/CacheQueryBuilder.php b/lib/private/Files/Cache/CacheQueryBuilder.php
index 365d28fc8c5..491fb1fd4e1 100644
--- a/lib/private/Files/Cache/CacheQueryBuilder.php
+++ b/lib/private/Files/Cache/CacheQueryBuilder.php
@@ -138,11 +138,11 @@ class CacheQueryBuilder extends QueryBuilder {
/**
* join metadata to current query builder and returns an helper
*
- * @return IMetadataQuery|null NULL if no metadata have never been generated
+ * @return IMetadataQuery
*/
- public function selectMetadata(): ?IMetadataQuery {
+ public function selectMetadata(): IMetadataQuery {
$metadataQuery = $this->filesMetadataManager->getMetadataQuery($this, $this->alias, 'fileid');
- $metadataQuery?->retrieveMetadata();
+ $metadataQuery->retrieveMetadata();
return $metadataQuery;
}
}
diff --git a/lib/private/Files/Cache/QuerySearchHelper.php b/lib/private/Files/Cache/QuerySearchHelper.php
index d8c5e66e129..849135d44f0 100644
--- a/lib/private/Files/Cache/QuerySearchHelper.php
+++ b/lib/private/Files/Cache/QuerySearchHelper.php
@@ -195,12 +195,7 @@ class QuerySearchHelper {
$files = $result->fetchAll();
$rawEntries = array_map(function (array $data) use ($metadataQuery) {
- // migrate to null safe ...
- if ($metadataQuery === null) {
- $data['metadata'] = [];
- } else {
- $data['metadata'] = $metadataQuery->extractMetadata($data)->asArray();
- }
+ $data['metadata'] = $metadataQuery->extractMetadata($data)->asArray();
return Cache::cacheEntryFromData($data, $this->mimetypeLoader);
}, $files);