Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video 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 5634 to 5651

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=sql_array("select ref value from resource where ref>0 and disk_usage_last_updated is null or datediff(now(),disk_usage_last_updated)>30 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 25th November 2020 04:05 Europe/London time based on the source file dated 13th November 2020 16:50 Europe/London time.