'Counts all users registered on the homeserver.'

@defer.inlineCallbacks
def count_all_users(self):

    def _count_users(txn):
        txn.execute('SELECT    COUNT(*)    AS    users    FROM    users')
        rows = self.cursor_to_dict(txn)
        if rows:
            return rows[0]['users']
        return 0
    ret = (yield self.runInteraction('count_users', _count_users))
    defer.returnValue(ret)
