Skip to content

Commit edf50a7

Browse files
Treeedjona
andauthored
fixed attachment statistics for sqlite (#847)
Co-authored-by: jona <[email protected]>
1 parent d093721 commit edf50a7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Repository/AttachmentRepository.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public function getPrivateAttachmentsCount(): int
5858
{
5959
$qb = $this->createQueryBuilder('attachment');
6060
$qb->select('COUNT(attachment)')
61-
->where('attachment.path LIKE :like');
62-
$qb->setParameter('like', '\\%SECURE\\%%');
61+
->where('attachment.path LIKE :like ESCAPE \'#\'');
62+
$qb->setParameter('like', '#%SECURE#%%');
6363
$query = $qb->getQuery();
6464

6565
return (int) $query->getSingleScalarResult();
@@ -94,12 +94,12 @@ public function getUserUploadedAttachments(): int
9494
{
9595
$qb = $this->createQueryBuilder('attachment');
9696
$qb->select('COUNT(attachment)')
97-
->where('attachment.path LIKE :base')
98-
->orWhere('attachment.path LIKE :media')
99-
->orWhere('attachment.path LIKE :secure');
100-
$qb->setParameter('secure', '\\%SECURE\\%%');
101-
$qb->setParameter('base', '\\%BASE\\%%');
102-
$qb->setParameter('media', '\\%MEDIA\\%%');
97+
->where('attachment.path LIKE :base ESCAPE \'#\'')
98+
->orWhere('attachment.path LIKE :media ESCAPE \'#\'')
99+
->orWhere('attachment.path LIKE :secure ESCAPE \'#\'');
100+
$qb->setParameter('secure', '#%SECURE#%%');
101+
$qb->setParameter('base', '#%BASE#%%');
102+
$qb->setParameter('media', '#%MEDIA#%%');
103103
$query = $qb->getQuery();
104104

105105
return (int) $query->getSingleScalarResult();

0 commit comments

Comments
 (0)