Skip to main content

CLI

This page describes the CLI commands that are included in mosparo.

Maintenance

Database cleanup

One of the main features of mosparo is to ensure that the form data is removed from mosparo after two weeks. To clean the database after two weeks, mosparo executes the cleanup process every 6 hours automatically when a form is loaded. If you prefer to execute the cleanup at a specified time, you can use this command and set up a cron job.

This command uses a slight delay when executed. The idea behind this command is to make sure that the command is only executed once, especially in a multi-node setup where multiple nodes may execute the command at the same time.

./bin/console mosparo:cleanup-database

Arguments

This command does not offer any arguments.

Use case

Use this command in a cron job to execute this functionality automatically.

GeoIP2 database download

This command can be used to download the latest GeoIP2 database from the MaxMind servers automatically.

./bin/console mosparo:geoip2:download-database

Arguments

This command does not offer any arguments.

Use case

Use this command in a cron job to execute this functionality automatically.

Health

The health command checks the health of the mosparo installation.

./bin/console mosparo:health

Arguments

This command does not offer any arguments.

Use case

This command is used as the Docker Healthcheck to detect the health of the container automatically.

Update

The update command is an interactive command to update mosparo to the latest version automatically.

./bin/console mosparo:self-update

Arguments

This command does not offer any arguments.

Use case

Use this command to update your mosparo installation.

Import & Export

Import project settings

With the import command, you can import the settings from a previously exported project into a project. You can use this command to make a backup of the settings.

./bin/console mosparo:import [--generalSettings|--no-generalSettings] [--designSettings|--no-designSettings] [--securitySettings|--no-securitySettings] [--rules|--no-rules] [--handlingExistingRules HANDLINGEXISTINGRULES] [--rulePackages|--no-rulePackages] [-f|--force] [--] <projectId> <filePath>

Arguments

ArgumentRequiredDescription
projectIdRequiredThe project ID of the project into which you want to import the settings. You can find the ID of a project in the project list in mosparo.
filePathRequiredThe location of the file you want to import.
--generalSettingsOptionalImport the general settings of a project.
--no-generalSettingsOptionalDo not import the general settings of a project.
--designSettingsOptionalImport the design settings of a project.
--no-designSettingsOptionalDo not import the design settings of a project.
--securitySettingsOptionalImport the security settings of a project.
--no-securitySettingsOptionalDo not import the security settings of a project.
--rulesOptionalImport the rules of a project.
--no-rulesOptionalDo not import the rules of a project.
--handlingExistingRulesOptionalDefines how mosparo should handle existing rules. Use override, to override a rule that already exists. Use append to append the rule items if a rule already exists. Use add to add an existing rule as a new rule.
--rulePackagesOptionalImport the rule packages of a project.
--no-rulePackagesOptionalDo not import the rule packages of a project.
--forceOptionalIf force is set, the command will execute all changes without asking. Otherwise, the command will be executed interactively, and you need to tell the command which changes to apply.

Use case

Use this command to import the settings, rules, and rule packages from a file into a project.

Export project settings

With the export command, you can export the settings of a project. You can later import the settings into a different project in the same or a different mosparo installation.

mosparo will not export any sensitive data, such as submitted form data or the UUID, public or private key of a project.

./bin/console mosparo:export [--generalSettings|--no-generalSettings] [--designSettings|--no-designSettings] [--securitySettings|--no-securitySettings] [--rules|--no-rules] [--rulePackages|--no-rulePackages] [--] <projectId> [<filePath>]

Arguments

ArgumentRequiredDescription
projectIdRequiredThe project ID of the project you want to export. You can find the ID of a project in the project list in mosparo.
filePathOptionalThe location where the command should store the export file.
--generalSettingsOptionalExport the general settings of a project.
--no-generalSettingsOptionalDo not export the general settings of a project.
--designSettingsOptionalExport the design settings of a project.
--no-designSettingsOptionalDo not export the design settings of a project.
--securitySettingsOptionalExport the security settings of a project.
--no-securitySettingsOptionalDo not export the security settings of a project.
--rulesOptionalExport the rules of a project.
--no-rulesOptionalDo not export the rules of a project.
--rulePackagesOptionalExport the rule packages of a project.
--no-rulePackagesOptionalDo not export the rule packages of a project.

Use case

Use this command to export the settings, rules, and rule packages of a project into a file.

Rule packages

Import rule package

With the rule package import command, you can import a rule package from a local file or via standard input (stdin).

./bin/console mosparo:rule-package:import [-f|--file FILE] [-i|--input] [-s|--hash HASH] [--] <projectId> <rulePackageId>

Arguments

ArgumentRequiredDescription
projectIdRequiredThe project ID of the project into which you want to import the rule package. You can find the ID of a project in the project list in mosparo.
rulePackageIdRequiredThe rule package ID of the rule package into which you want to import the rule package. This rule package needs to be of the correct type.
-f / --fileOptionalThe path to the rule pacakge file.
-i / --inputOptionalWith this option, you can tell the command to read the package content from the standard input.
-s / --hashOptionalSpecify the SHA256 hash of the content of the rule package.

At least one of -f/--file or -i/--input is required.

Use case

Use this command to import a locally generated or stored rule package.

Refresh rule packages

Refreshes all automatic rule packages. Packages that are hosted on a URL are downloaded and cached in mosparo. Packages, which are loaded from a specified file path, are directly loaded and cached in mosparo.

./bin/console mosparo:rule-package:refresh

Arguments

This command does not offer any arguments.

Use case

Use this command in a cron job to execute this functionality automatically.