CleanupFormUploadsService

Service to find and clean up old form upload folders.

When ext:form handles file uploads, it creates sub-folders named form_<40-hex-chars> inside the configured upload folder (default: 1:/user_upload/). Over time, these folders accumulate — both from completed and incomplete form submissions.

Since uploaded files are not moved upon form submission, there is no way to distinguish between folders from completed and abandoned submissions. This service identifies form upload folders based on their age (modification time) and provides methods to list and delete them.

Internal

Table of Contents

Methods

__construct()  : mixed
deleteFolders()  : array{deleted: int, failed: int, errors: list}
Deletes the given folders and returns a result summary.
getExpiredFolders()  : array<int, Folder>
Finds expired form upload folders in the given upload folders.

Methods

deleteFolders()

Deletes the given folders and returns a result summary.

public deleteFolders(array<int, Folder$folders) : array{deleted: int, failed: int, errors: list}
Parameters
$folders : array<int, Folder>

Folders to delete

Return values
array{deleted: int, failed: int, errors: list}

getExpiredFolders()

Finds expired form upload folders in the given upload folders.

public getExpiredFolders(int $maximumAge, array<int, string> $uploadFolderIdentifiers) : array<int, Folder>

A folder is considered expired when:

  1. Its name matches the form_<40-hex-chars> pattern
  2. Its modification time is older than the given maximum age
Parameters
$maximumAge : int

Maximum age in seconds. Folders older than this are considered expired.

$uploadFolderIdentifiers : array<int, string>

List of combined folder identifiers to scan (e.g. ['1:/user_upload/', '2:/custom_uploads/']).

Return values
array<int, Folder>

List of expired form upload folders


        
On this page

Search results