1.20.x common.inc backdrop_delete_file_if_stale($uri)

Deletes files modified more than a set time ago.

Callback for file_scan_directory() within:

File

includes/common.inc, line 4280
Common functions that many Backdrop modules will need to reference.

Code

function backdrop_delete_file_if_stale($uri) {
  // Default stale file threshold is 30 days.
  if (REQUEST_TIME - filemtime($uri) > settings_get('stale_file_threshold', 2592000)) {
    file_unmanaged_delete($uri);
  }
}