Include catch-all count in domaininfo output v0.6.x
authormartin f. krafft <madduck@madduck.net>
Tue, 10 Apr 2012 23:50:18 +0200
branchv0.6.x
changeset 515 09fa019bb330
parent 514 d863a44a6353
child 516 b2084e7f6854
Include catch-all count in domaininfo output
VirtualMailManager/cli/subcommands.py
VirtualMailManager/domain.py
pgsql/create_tables-dovecot-1.2.x.pgsql
pgsql/create_tables.pgsql
pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql
pgsql/update_tables_0.5.x-0.6.pgsql
--- a/VirtualMailManager/cli/subcommands.py	Tue Apr 10 22:56:30 2012 +0200
+++ b/VirtualMailManager/cli/subcommands.py	Tue Apr 10 23:50:18 2012 +0200
@@ -810,7 +810,7 @@
         order = ((u'domain name', 0), (u'gid', 1), (u'domain directory', 0),
                  (u'quota limit/user', 0), (u'active services', 0),
                  (u'transport', 0), (u'alias domains', 0), (u'accounts', 0),
-                 (u'aliases', 0), (u'relocated', 0))
+                 (u'aliases', 0), (u'relocated', 0), (u'catch-all dests', 0))
     elif ctx.scmd == 'userinfo':
         if ctx.argc == 4 and ctx.args[3] != u'aliases' or \
            ctx.cget('account.disk_usage'):
--- a/VirtualMailManager/domain.py	Tue Apr 10 22:56:30 2012 +0200
+++ b/VirtualMailManager/domain.py	Tue Apr 10 23:50:18 2012 +0200
@@ -348,11 +348,12 @@
         self._chk_state()
         dbc = self._dbh.cursor()
         dbc.execute('SELECT aliasdomains "alias domains", accounts, aliases, '
-                    'relocated FROM vmm_domain_info WHERE gid = %s',
-                    (self._gid,))
+                    'relocated, catchall "catch-all dests" '
+                    'FROM vmm_domain_info WHERE gid = %s', (self._gid,))
         info = dbc.fetchone()
         dbc.close()
-        keys = ('alias domains', 'accounts', 'aliases', 'relocated')
+        keys = ('alias domains', 'accounts', 'aliases', 'relocated',
+                'catch-all dests')
         info = dict(zip(keys, info))
         info['gid'] = self._gid
         info['domain name'] = self._name
--- a/pgsql/create_tables-dovecot-1.2.x.pgsql	Tue Apr 10 22:56:30 2012 +0200
+++ b/pgsql/create_tables-dovecot-1.2.x.pgsql	Tue Apr 10 23:50:18 2012 +0200
@@ -196,7 +196,10 @@
            (SELECT count(gid)
               FROM domain_name
              WHERE domain_name.gid = domain_data.gid
-               AND NOT domain_name.is_primary) AS aliasdomains
+               AND NOT domain_name.is_primary) AS aliasdomains,
+           (SELECT count(gid)
+              FROM catchall
+             WHERE catchall.gid = domain_data.gid) AS catchall
       FROM domain_data
            LEFT JOIN domain_name USING (gid)
            LEFT JOIN users USING (gid)
--- a/pgsql/create_tables.pgsql	Tue Apr 10 22:56:30 2012 +0200
+++ b/pgsql/create_tables.pgsql	Tue Apr 10 23:50:18 2012 +0200
@@ -196,7 +196,10 @@
            (SELECT count(gid)
               FROM domain_name
              WHERE domain_name.gid = domain_data.gid
-               AND NOT domain_name.is_primary) AS aliasdomains
+               AND NOT domain_name.is_primary) AS aliasdomains,
+           (SELECT count(gid)
+              FROM catchall
+             WHERE catchall.gid = domain_data.gid) AS catchall
       FROM domain_data
            LEFT JOIN domain_name USING (gid)
            LEFT JOIN users USING (gid)
--- a/pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql	Tue Apr 10 22:56:30 2012 +0200
+++ b/pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql	Tue Apr 10 23:50:18 2012 +0200
@@ -190,7 +190,10 @@
            (SELECT count(gid)
               FROM domain_name
              WHERE domain_name.gid = domain_data.gid
-               AND NOT domain_name.is_primary) AS aliasdomains
+               AND NOT domain_name.is_primary) AS aliasdomains,
+           (SELECT count(gid)
+              FROM catchall
+             WHERE catchall.gid = domain_data.gid) AS catchall
       FROM domain_data
            LEFT JOIN domain_name USING (gid)
            LEFT JOIN users USING (gid)
--- a/pgsql/update_tables_0.5.x-0.6.pgsql	Tue Apr 10 22:56:30 2012 +0200
+++ b/pgsql/update_tables_0.5.x-0.6.pgsql	Tue Apr 10 23:50:18 2012 +0200
@@ -168,7 +168,10 @@
            (SELECT count(gid)
               FROM domain_name
              WHERE domain_name.gid = domain_data.gid
-               AND NOT domain_name.is_primary) AS aliasdomains
+               AND NOT domain_name.is_primary) AS aliasdomains,
+           (SELECT count(gid)
+              FROM catchall
+             WHERE catchall.gid = domain_data.gid) AS catchall
       FROM domain_data
            LEFT JOIN domain_name USING (gid)
            LEFT JOIN users USING (gid)