diff options
Diffstat (limited to 'apps/user_ldap/lib/Mapping/AbstractMapping.php')
-rw-r--r-- | apps/user_ldap/lib/Mapping/AbstractMapping.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php index 755cfadbccd..f5f56ce03d6 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -277,4 +277,19 @@ abstract class AbstractMapping { ->getTruncateTableSQL('`' . $this->getTableName() . '`'); return $this->dbc->prepare($sql)->execute(); } + + /** + * returns the number of entries in the mappings table + * + * @return int + */ + public function count() { + $qb = $this->dbc->getQueryBuilder(); + $query = $qb->select($qb->createFunction('COUNT(`ldap_dn`)')) + ->from($this->getTableName()); + $res = $query->execute(); + $count = $res->fetchColumn(); + $res->closeCursor(); + return (int)$count; + } } |