map: fix cluster on deletion

pull/396/head
Varun Patil 2023-02-09 08:40:26 -08:00
parent efea8369bd
commit f7b7fa2ac8
1 changed files with 14 additions and 0 deletions

View File

@ -233,6 +233,15 @@ class TimelineWrite
*/ */
public function deleteFile(File &$file) public function deleteFile(File &$file)
{ {
// Get full record
$query = $this->connection->getQueryBuilder();
$query->select('*')
->from('memories')
->where($query->expr()->eq('fileid', $query->createNamedParameter($file->getId(), IQueryBuilder::PARAM_INT)))
;
$record = $query->executeQuery()->fetch();
// Delete all records regardless of existence
foreach (DELETE_TABLES as $table) { foreach (DELETE_TABLES as $table) {
$query = $this->connection->getQueryBuilder(); $query = $this->connection->getQueryBuilder();
$query->delete($table) $query->delete($table)
@ -240,6 +249,11 @@ class TimelineWrite
; ;
$query->executeStatement(); $query->executeStatement();
} }
// Delete from map cluster
if ($record && ($cid = (int) $record['mapcluster']) > 0) {
$this->removeFromCluster($cid, (float) $record['lat'], (float) $record['lon']);
}
} }
/** /**