llms_cleanup_tmp()

Cron function to cleanup files in the LLMS_TMP_DIR


Description Description

Removes any files that are more than a day old.


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/llms.functions.core.php

182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
*/
function llms_cleanup_tmp() {
 
    $max_age = llms_current_time( 'timestamp' ) - apply_filters( 'llms_tmpfile_max_age', DAY_IN_SECONDS );
 
    $exclude = array( '.htaccess', 'index.html' );
 
    foreach ( glob( LLMS_TMP_DIR . '*' ) as $file ) {
 
        // Don't cleanup index and .htaccess.
        if ( in_array( basename( $file ), $exclude, true ) ) {
            continue;
        }
 
        if ( filemtime( $file ) < $max_age ) {
            wp_delete_file( $file );
        }
    }


Top ↑

Changelog Changelog

Changelog
Version Description
4.10.1 Use strict type comparisons.
3.18.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.