Collections functions
General functions
Render functions
Theme permission functions
Resource functions

update_disk_usage_cron()

Description

Update disk usage for all resources that have not yet been updated or have not been updated in the past 30 days.
Limit to a reasonable amount so that this process is spread over several cron intervals for large data sets.

Parameters

This function accepts no parameters.

Return

boolean|void

Location

include/resource_functions.php lines 5617 to 5642

Definition

 
function update_disk_usage_cron()
    {
    
$lastrun get_sysvar('last_update_disk_usage_cron''1970-01-01');
    
# Don't run if already run in last 24 hours.
    
if (time()-strtotime($lastrun) < 24*60*60)
        {
        echo 
" - Skipping update_disk_usage_cron  - last run: " $lastrun "<br/>\n";
        return 
false;
        }

    
$resources=ps_array(
        
"SELECT ref value
            FROM resource
        WHERE ref>0
            AND disk_usage_last_updated IS null
                OR datediff(now(),disk_usage_last_updated)>30
        ORDER BY disk_usage_last_updated ASC
        LIMIT 20000"
,
        []);
    foreach (
$resources as $resource)
        {
        
update_disk_usage($resource);
        }

    
set_sysvar("last_update_disk_usage_cron",date("Y-m-d H:i:s"));
    }

This article was last updated 2nd October 2022 16:05 Europe/London time based on the source file dated 30th September 2022 14:20 Europe/London time.