Skip to content

silgy_admin_info

Jurek Muszyński edited this page Nov 8, 2019 · 10 revisions

void silgy_admin_info(int ci, int users, admin_info_t ai[], int ai_cnt, bool header_n_footer)

Description

Renders admin info page showing uptime, the main counters, memory usage and recently seen users (if USERS module is enabled). Users are shown in 4 tables: all, YAUs (yearly active), MAUs (monthly active) and DAUs (daily active).

users is the number of last seen users to show; if 0, users table will not be shown;
ai is the pointer to a structure describing additional columns to be shown;
ai_cnt is the number of ai records;
header_n_footer if TRUE, then standard HTML header & footer will be added;

By default, the following columns will be shown: id, email, name, created, last_login, visits (desktop) or email, last_login, visits (mobile). If no other columns are required, then ai can be NULL and ai_cnt will be ignored.

All, YAUs, MAUs and DAUs counters are logged with admin_info tag, so historical data can be grepped:

~/live/logs $ grep admin_info *
20191108_1120.log:admin_info: --------------------
20191108_1120.log:admin_info: 2019-11-08 11:20:28
20191108_1120.log:admin_info: 1345 all user(s)
20191108_1120.log:admin_info: 723 yearly active user(s)
20191108_1120.log:admin_info: 75 monthly active user(s)
20191108_1120.log:admin_info: 12 daily active user(s)

Returns

None

Example

    // ...
    else if ( REQ("dashboard") )
    {
        if ( ADMIN )
        {
            admin_info_t ai[]={
                {"SELECT COUNT(*) FROM sites WHERE user_id=id", "pages", "long"},
                {"SELECT COUNT(*) FROM site_content WHERE user_id=id", "entries", "long"}
            };

            silgy_admin_info(ci, 20, ai, 2, true);
        }
        else
            gen_page_dashboard(ci);
    }

Notes

Clone this wiki locally