aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-11-12 17:43:56 +0100
committerGitHub <noreply@github.com>2018-11-12 17:43:56 +0100
commitfd8eeccb15e1219a2d18fc421e741c315737c55e (patch)
tree55b56592cf40ab4fcc605e45a95d13d79806eb91 /apps
parent9e1ec0cf46055dbf08a139124d292eb38b8aebd2 (diff)
parentbb352fb667e87ea0829f1da5f9e85c34bdefe9fa (diff)
downloadnextcloud-server-fd8eeccb15e1219a2d18fc421e741c315737c55e.tar.gz
nextcloud-server-fd8eeccb15e1219a2d18fc421e741c315737c55e.zip
Merge pull request #11942 from nextcloud/techdebt/noid/use-count-function
Use the defined func()->count() instead of manual counting
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/CalDAV/CalDavBackend.php4
-rw-r--r--apps/dav/lib/CardDAV/CardDavBackend.php2
-rw-r--r--apps/files_sharing/lib/Command/CleanupRemoteStorages.php2
-rw-r--r--apps/user_ldap/lib/Mapping/AbstractMapping.php2
4 files changed, 5 insertions, 5 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index 60f163abcbf..187ba4ecdcf 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php
+++ b/apps/dav/lib/CalDAV/CalDavBackend.php
@@ -213,7 +213,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
public function getCalendarsForUserCount($principalUri, $excludeBirthday = true) {
$principalUri = $this->convertPrincipal($principalUri, true);
$query = $this->db->getQueryBuilder();
- $query->select($query->createFunction('COUNT(*)'))
+ $query->select($query->func()->count('*'))
->from('calendars')
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
@@ -1045,7 +1045,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$extraData = $this->getDenormalizedData($calendarData);
$q = $this->db->getQueryBuilder();
- $q->select($q->createFunction('COUNT(*)'))
+ $q->select($q->func()->count('*'))
->from('calendarobjects')
->where($q->expr()->eq('calendarid', $q->createNamedParameter($calendarId)))
->andWhere($q->expr()->eq('uid', $q->createNamedParameter($extraData['uid'])))
diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php
index eb94885d177..699248f7b17 100644
--- a/apps/dav/lib/CardDAV/CardDavBackend.php
+++ b/apps/dav/lib/CardDAV/CardDavBackend.php
@@ -117,7 +117,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
public function getAddressBooksForUserCount($principalUri) {
$principalUri = $this->convertPrincipal($principalUri, true);
$query = $this->db->getQueryBuilder();
- $query->select($query->createFunction('COUNT(*)'))
+ $query->select($query->func()->count('*'))
->from('addressbooks')
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
diff --git a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php
index 2175982dfc1..a4e5f50b9b2 100644
--- a/apps/files_sharing/lib/Command/CleanupRemoteStorages.php
+++ b/apps/files_sharing/lib/Command/CleanupRemoteStorages.php
@@ -98,7 +98,7 @@ class CleanupRemoteStorages extends Command {
public function countFiles($numericId, OutputInterface $output) {
$queryBuilder = $this->connection->getQueryBuilder();
- $queryBuilder->select($queryBuilder->createFunction('COUNT(' . $queryBuilder->getColumnName('fileid') . ')'))
+ $queryBuilder->select($queryBuilder->func()->count('fileid'))
->from('filecache')
->where($queryBuilder->expr()->eq(
'storage',
diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php
index c3f09fd6caa..7ec22b6b79c 100644
--- a/apps/user_ldap/lib/Mapping/AbstractMapping.php
+++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php
@@ -311,7 +311,7 @@ abstract class AbstractMapping {
*/
public function count() {
$qb = $this->dbc->getQueryBuilder();
- $query = $qb->select($qb->createFunction('COUNT(' . $qb->getColumnName('ldap_dn') . ')'))
+ $query = $qb->select($qb->func()->count('ldap_dn'))
->from($this->getTableName());
$res = $query->execute();
$count = $res->fetchColumn();