diff options
-rw-r--r-- | plugins/mod_storage_internal.lua | 8 | ||||
-rw-r--r-- | plugins/mod_storage_memory.lua | 8 | ||||
-rw-r--r-- | plugins/mod_storage_sql.lua | 8 |
3 files changed, 15 insertions, 9 deletions
diff --git a/plugins/mod_storage_internal.lua b/plugins/mod_storage_internal.lua index 2556224d..28caa071 100644 --- a/plugins/mod_storage_internal.lua +++ b/plugins/mod_storage_internal.lua @@ -217,11 +217,13 @@ end function archive:summary(username, query) local iter, err = self:find(username, query) if not iter then return iter, err; end - local summary = {}; + local counts = {}; for _, _, _, with in iter do - summary[with] = (summary[with] or 0) + 1; + counts[with] = (counts[with] or 0) + 1; end - return summary; + return { + counts = counts; + }; end function archive:users() diff --git a/plugins/mod_storage_memory.lua b/plugins/mod_storage_memory.lua index 376ae277..cac9bc40 100644 --- a/plugins/mod_storage_memory.lua +++ b/plugins/mod_storage_memory.lua @@ -170,11 +170,13 @@ end function archive_store:summary(username, query) local iter, err = self:find(username, query) if not iter then return iter, err; end - local summary = {}; + local counts = {}; for _, _, _, with in iter do - summary[with] = (summary[with] or 0) + 1; + counts[with] = (counts[with] or 0) + 1; end - return summary; + return { + counts = counts; + }; end diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua index 518e2654..d6779946 100644 --- a/plugins/mod_storage_sql.lua +++ b/plugins/mod_storage_sql.lua @@ -446,12 +446,14 @@ function archive_store:summary(username, query) return engine:select(sql_query, unpack(args)); end); if not ok then return ok, result end - local summary = {}; + local counts = {}; for row in result do local with, count = row[1], row[2]; - summary[with] = count; + counts[with] = count; end - return summary; + return { + counts = counts; + }; end function archive_store:delete(username, query) |