Console Commands
Freeform includes several console commands to allow you to run cleanup tasks and other tasks.
Resave Submissions4.1.16+
If you need to resave all Freeform submissions, you can do so with the following CLI command: ./craft freeform/submissions/resave
. Most of the arguments available to Craft's resave/entries
command are available here too, so if you need to also update the Craft Search Index, be sure to add --update-search-index
.
php craft freeform/submissions/resave --update-search-index
Purge Commands
Purge SubmissionsPro
Allows you to purge all submissions older than a specific number of days. Freeform automatically attempts to execute this service based on the specified number of days for the Automatically Purge Submission Data setting.
./craft freeform/purge/submissions --age-in-days=30
Purge Spam
Allows you to purge all spam submissions older than a specific number of days. Freeform automatically attempts to execute this service based on the specified number of days for the Automatically Purge Spam Submissions setting.
./craft freeform/purge/spam --age-in-days=30
Purge Unfinalized Assets
Allows you to purge all unfinalized assets older than a specific number of minutes. Freeform automatically attempts to execute this service every 3 hours by default.
./craft freeform/purge/unfinalized-assets --age-in-minutes=180
Field Commands
Create Fields
Allows you to create new fields from the command line.
--label="My Field"
- the name of the field to be created. Handles will automatically be converted as camel case to match, e.g.myField
.--iterations=5
(optional) - the number of fields you'd like created as this type and set. Additional fields will be automatically suffixed with numbers, e.g.My Field, My Field 1, My Field 2
.--type=select
- the field type you'd like the new field to be created as. Options are:checkbox
checkbox_group
datetime
dynamic_recipients
email
file
file_drag_and_drop
hidden
invisible
multiple_select
number
opinion_scale
phone
radio_group
rating
regex
select
signature
table
text
textarea
website
./craft freeform/fields/create --label="My Field" --iterations=5 --type=select