mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 09:42:09 -04:00
fix(dav): Reduce memory usage while reading CardDAV cards
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
bd8348f5c1
commit
0dd86983bb
1 changed files with 8 additions and 1 deletions
|
|
@ -519,6 +519,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
$result = $query->executeQuery();
|
||||
$row = $result->fetch();
|
||||
if (!$row) {
|
||||
$result->closeCursor();
|
||||
return false;
|
||||
}
|
||||
$row['etag'] = '"' . $row['etag'] . '"';
|
||||
|
|
@ -528,6 +529,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
if ($modified) {
|
||||
$row['size'] = strlen($row['carddata']);
|
||||
}
|
||||
$result->closeCursor();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
|
@ -974,7 +976,12 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
*/
|
||||
private function readBlob($cardData, &$modified = false) {
|
||||
if (is_resource($cardData)) {
|
||||
$cardData = stream_get_contents($cardData);
|
||||
$stringCardData = stream_get_contents($cardData);
|
||||
if ($stringCardData === false) {
|
||||
return '';
|
||||
}
|
||||
fclose($cardData);
|
||||
$cardData = $stringCardData;
|
||||
}
|
||||
|
||||
// Micro optimisation
|
||||
|
|
|
|||
Loading…
Reference in a new issue