定制 plasticstudio/form-submission-cleanup 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

plasticstudio/form-submission-cleanup

Composer 安装命令:

composer require plasticstudio/form-submission-cleanup

包简介

Configurable queued-job cleanup for SilverStripe form submission DataObjects.

README 文档

README

A Silverstripe module that provides a single queued job to delete old form submission DataObjects on a daily schedule. Target classes, retention periods, and exclude rules are all defined in YAML config.

Requirements

  • silverstripe/framework ^6
  • symbiote/silverstripe-queuedjobs ^6.2
  • silverstripe/userforms ^7 (optional — only required if targeting SubmittedForm records)

Installation

composer require plasticstudio/form-submission-cleanup

Setup a cron job:

*/1 * * * * /path/to/silverstripe/vendor/bin/sake tasks:ProcessJobQueueTask

Configuration

Copy the relevant blocks into your project's _config/config.yml.

Globals

PlasticStudio\FormSubmissionCleanup\Jobs\FormSubmissionCleanupJob:
  default_retention_days: 365  # applied to any target without its own retention_days
  default_date_field: Created  # field used to determine record age

Targets

Add one entry per DataObject class to clean up. UserForms is shown as an example; omit it if the module is not installed.

PlasticStudio\FormSubmissionCleanup\Jobs\FormSubmissionCleanupJob:
  targets:
    'SilverStripe\UserForms\Model\Submission\SubmittedForm':
      retention_days: 365       # optional — overrides default_retention_days
      date_field: Created       # optional — overrides default_date_field
      exclude:                  # optional — ORM exclude filter (same syntax as DataList::exclude)
        IsArchived: true

    'App\Model\AnotherSubmission':
      retention_days: 90

Per-target options

Key Type Description
retention_days int Overrides the global default for this class only
date_field string DataObject field to measure age against (default Created)
exclude map ORM filter passed to DataList::exclude() — matching records are kept

Daily scheduling (default jobs)

Register the job as a QueuedJobs default job so it is automatically re-queued after each run.

SilverStripe\Core\Injector\Injector:
  Symbiote\QueuedJobs\Services\QueuedJobService:
    properties:
      defaultJobs:
        FormSubmissionCleanup:
          type: 'PlasticStudio\FormSubmissionCleanup\Jobs\FormSubmissionCleanupJob'
          filter:
            JobTitle: 'Form Submission Cleanup'
          recreate: 1
          startDateFormat: 'Y-m-d H:i:s'
          startTimeString: 'tomorrow 02:00'

Run a dev/build, then queue the first instance manually via the CMS (Admin > Jobs). Subsequent runs are scheduled automatically.

How it works

  1. setup() iterates every configured target class, applies the retention cutoff and any exclude filter, and collects matching record IDs.
  2. process() deletes one record per step. Cascade-delete rules on each DataObject handle any related records (e.g. SubmittedFormField children on SubmittedForm).
  3. After the job completes, the default jobs feature re-queues it for the next scheduled run.

统计信息

  • 总下载量: 76
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2026-06-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固