diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2016-11-24 23:11:52 +0100 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2016-11-24 23:11:52 +0100 |
| commit | dd3e0698a71ca2746166f006135aeace83dfeb20 (patch) | |
| tree | b7e797bad721a980dbe06301bfe089991d146c5d /src/phinde | |
| parent | 161c1102795805ee665a727e185fb71e58c92110 (diff) | |
| download | phinde-dd3e0698a71ca2746166f006135aeace83dfeb20.tar.gz phinde-dd3e0698a71ca2746166f006135aeace83dfeb20.zip | |
show subscriptions on status page
Diffstat (limited to 'src/phinde')
| -rw-r--r-- | src/phinde/Subscriptions.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/phinde/Subscriptions.php b/src/phinde/Subscriptions.php index 4d00ab8..5aac9b2 100644 --- a/src/phinde/Subscriptions.php +++ b/src/phinde/Subscriptions.php @@ -38,6 +38,28 @@ class Subscriptions } /** + * Count number of subscriptions + * + * @return array Array of keys with different status, number as value + */ + public function count() + { + $stmt = $this->db->prepare( + 'SELECT COUNT(*) as count, sub_status FROM subscriptions' + . ' GROUP BY sub_status' + . ' ORDER BY sub_status' + ); + $stmt->execute(); + + $res = []; + foreach ($stmt as $row) { + $res[$row['sub_status']] = $row['count']; + } + + return $res; + } + + /** * Create a new subscription entry in database. * Automatically generates secret, capkey and lease seconds. * |
