| @@ -229,17 +229,23 @@ | ||
| 229 | 229 | // delete 60 days old scheduled_actions data |
| 230 | 230 | \FluentForm\App\Models\Scheduler::where('created_at', '<', $deleteTo) |
| 231 | 231 | ->delete(); |
| 232 | 232 | |
| 233 | - // Clean temp uploads older than 2 days | |
| 233 | + // Clean temp uploads. Default threshold is 2 days. Honors the | |
| 234 | + // fluentform/temp_file_delete_time filter so multi-step and | |
| 235 | + // save-and-resume users can extend the window — same filter | |
| 236 | + // Pro's Uploader::removeOldTempFiles() already respects. Without | |
| 237 | + // this, the Scheduler cleanup would wipe temp files at 2 days | |
| 238 | + // regardless of the filter, breaking multi-step uploads. | |
| 234 | 239 | if (defined('FLUENTFORM_UPLOAD_DIR')) { |
| 235 | 240 | $tempDir = wp_upload_dir()['basedir'] . FLUENTFORM_UPLOAD_DIR . '/temp/'; |
| 236 | 241 | if (is_dir($tempDir)) { |
| 237 | 242 | $files = glob($tempDir . '*'); |
| 238 | 243 | if (!empty($files)) { |
| 239 | - $twoDaysAgo = time() - 172800; | |
| 244 | + $maxFileAge = apply_filters('fluentform/temp_file_delete_time', 172800); | |
| 245 | + $cutoff = time() - $maxFileAge; | |
| 240 | 246 | foreach ($files as $file) { |
| 241 | - if (is_file($file) && basename($file) !== 'index.php' && filemtime($file) < $twoDaysAgo) { | |
| 247 | + if (is_file($file) && basename($file) !== 'index.php' && filemtime($file) < $cutoff) { | |
| 242 | 248 | wp_delete_file($file); |
| 243 | 249 | } |
| 244 | 250 | } |
| 245 | 251 | } |