From edf50a71d1e3153c5a98d012b295cb37159e5c27 Mon Sep 17 00:00:00 2001 From: Treeed <21248276+Treeed@users.noreply.github.com> Date: Sun, 2 Feb 2025 21:05:47 +0100 Subject: [PATCH] fixed attachment statistics for sqlite (#847) Co-authored-by: jona --- src/Repository/AttachmentRepository.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Repository/AttachmentRepository.php b/src/Repository/AttachmentRepository.php index 8acce3e3..865443d2 100644 --- a/src/Repository/AttachmentRepository.php +++ b/src/Repository/AttachmentRepository.php @@ -58,8 +58,8 @@ class AttachmentRepository extends DBElementRepository { $qb = $this->createQueryBuilder('attachment'); $qb->select('COUNT(attachment)') - ->where('attachment.path LIKE :like'); - $qb->setParameter('like', '\\%SECURE\\%%'); + ->where('attachment.path LIKE :like ESCAPE \'#\''); + $qb->setParameter('like', '#%SECURE#%%'); $query = $qb->getQuery(); return (int) $query->getSingleScalarResult(); @@ -94,12 +94,12 @@ class AttachmentRepository extends DBElementRepository { $qb = $this->createQueryBuilder('attachment'); $qb->select('COUNT(attachment)') - ->where('attachment.path LIKE :base') - ->orWhere('attachment.path LIKE :media') - ->orWhere('attachment.path LIKE :secure'); - $qb->setParameter('secure', '\\%SECURE\\%%'); - $qb->setParameter('base', '\\%BASE\\%%'); - $qb->setParameter('media', '\\%MEDIA\\%%'); + ->where('attachment.path LIKE :base ESCAPE \'#\'') + ->orWhere('attachment.path LIKE :media ESCAPE \'#\'') + ->orWhere('attachment.path LIKE :secure ESCAPE \'#\''); + $qb->setParameter('secure', '#%SECURE#%%'); + $qb->setParameter('base', '#%BASE#%%'); + $qb->setParameter('media', '#%MEDIA#%%'); $query = $qb->getQuery(); return (int) $query->getSingleScalarResult();