diff options
author | Joas Schilling <coding@schilljs.com> | 2016-09-21 10:00:18 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2016-11-10 15:49:54 +0300 |
commit | f621a8a4f755a5922fc57c6c5c390e82deb8ba49 (patch) | |
tree | 79bbf500de310a72c121b6289358881bc07bafb4 /lib | |
parent | 27c1b30bedf5ce4e9747b81899cc8b90dc01ba29 (diff) |
Add comments and system tags to stats
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Categories/Stats.php | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/Categories/Stats.php b/lib/Categories/Stats.php index 08df7a7..8e671d2 100644 --- a/lib/Categories/Stats.php +++ b/lib/Categories/Stats.php @@ -57,7 +57,7 @@ class Stats implements ICategory { * @return string */ public function getDisplayName() { - return (string) $this->l->t('Statistic <em>(number of: files, users, storages per type)</em>'); + return (string) $this->l->t('Statistic <em>(number of: files, users, storages per type, comments and tags)</em>'); } /** @@ -71,6 +71,11 @@ class Stats implements ICategory { 'num_storages_local' => $this->countStorages('local'), 'num_storages_home' => $this->countStorages('home'), 'num_storages_other' => $this->countStorages('other'), + + 'num_comments' => $this->countEntries('comments'), + 'num_comment_markers' => $this->countEntries('comments_read_markers', 'user_id'), + 'num_systemtags' => $this->countEntries('systemtag'), + 'num_systemtags_mappings' => $this->countEntries('systemtag_object_mapping'), ]; } @@ -116,11 +121,16 @@ class Stats implements ICategory { /** * @param string $tableName + * @param string $column * @return int */ - protected function countEntries($tableName) { + protected function countEntries($tableName, $column = '*') { + if ($column !== '*') { + $column = 'DISTINCT(' . $column . ')'; + } + $query = $this->connection->getQueryBuilder(); - $query->selectAlias($query->createFunction('COUNT(*)'), 'num_entries') + $query->selectAlias($query->createFunction('COUNT(' . $column . ')'), 'num_entries') ->from($tableName); $result = $query->execute(); $row = $result->fetch(); |