From b81d9c1df68d8d3956702b631a84c89076a0e927 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Wed, 23 Nov 2022 10:40:41 -0800 Subject: [PATCH] Delete livephoto entries on deletion --- lib/Db/TimelineWrite.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/Db/TimelineWrite.php b/lib/Db/TimelineWrite.php index 1d5dc88e..4265ea65 100644 --- a/lib/Db/TimelineWrite.php +++ b/lib/Db/TimelineWrite.php @@ -199,11 +199,15 @@ class TimelineWrite */ public function deleteFile(File &$file) { - $query = $this->connection->getQueryBuilder(); - $query->delete('memories') - ->where($query->expr()->eq('fileid', $query->createNamedParameter($file->getId(), IQueryBuilder::PARAM_INT))) - ; - $query->executeStatement(); + $deleteFrom = function ($table) use (&$file) { + $query = $this->connection->getQueryBuilder(); + $query->delete($table) + ->where($query->expr()->eq('fileid', $query->createNamedParameter($file->getId(), IQueryBuilder::PARAM_INT))) + ; + $query->executeStatement(); + }; + $deleteFrom('memories'); + $deleteFrom('memories_livephoto'); } /**