Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

api_get_daily_stat_summary()

Description

Return a summary of daily statistics

Parameters

ColumnTypeDefaultDescription
$days int 30 The number of days - note max 365 days as only the current and previous year's data is accessed.

Location

include/api_functions.php lines 320 to 331

Definition

 
function api_get_daily_stat_summary(int $days=30)
    {
    if (!
checkperm("a")) {return false;} // Admin only
    
return ps_query("SELECT activity_type,sum(count) `count`
        FROM daily_stat  
        WHERE 
            (`year`=year(NOW()) OR `year`=year(NOW())-1)
        AND
            concat(`year`,'-',`month`,'-',`day`,'-')>date_sub(NOW(), interval ? DAY)
        GROUP BY activity_type
            "
,["i",$days]);
    }

This article was last updated 27th April 2024 08:35 Europe/London time based on the source file dated 25th April 2024 17:25 Europe/London time.