axllent/silverstripe-version-truncator
Composer 安装命令:
composer require axllent/silverstripe-version-truncator
包简介
Automatically delete old versioned Silverstripe records from the database
README 文档
README
An extension for Silverstripe to automatically delete old versioned DataObject records from your database when a record is published, following predefined retention policies (see configuration).
When a record is being edited (such as a Page), no changes are made until it is published, so it could have 50 draft versions while you work on the copy. When you publish the page, the module prunes the (by default) all draft copies, leaving just the 10 latest published versions (configurable).
Features
- Delete all but the last XX published versions of a DataObject on publish
- Delete all but the last YY draft versions of a DataObject on publish
- Optionally keep old SiteTree objects where the URLSegment has changed (to preserve redirects)
Tasks
The module adds four manual tasks to:
- Force a run over the entire database - this task is generally not needed unless you either just install the module and wish to tidy up, or change your DataObject configurations.
- Silverstripe does not currently delete any File records once the file had been physically deleted (probably due to the immediate post-delete functionality relating to internal file linking). I cannot see any purpose of keeping these records after this, so this task will remove all records pertaining to deleted files/folders.
- Force a "reset", keeping only the latest published version of each currently published DataObject (regardless of policy). Unpublished / modified DataObjects are not touched.
- Delete all archived DataObjects.
The tasks can be run in your browser via /dev/tasks/TruncateVersionsTask,
or see sake tasks:TruncateVersionsTask --help for CLI options.
Requirements
- Silverstripe ^6.0
Please see the 3 branch for Silverstripe 4 & 5 support.
Installation
composer require axllent/silverstripe-version-truncator
Configuration
Configuration is optional (see Default config), however you can create a YML file (eg: app/_config/version-truncator.yml):
MyCustomObject: keep_versions: 5 keep_drafts: 5
To skip pruning altogether for a particular DataObject, set keep_versions: 0 for that object class.
To overwrite the global defaults, see _config/extension.yml, eg:
SilverStripe\CMS\Model\SiteTree: keep_versions: 20 keep_drafts: 10
Default config
SiteTree (and extending classes eg: Page etc)
On publish, the last 10 published versions are kept, and all draft copied are removed. The only exception is if the URLSegment and/or ParentID is has changed, in which case the module will keep a single record for each differing URLSegment to allow auto-redirection.
All other DataObjects
For all other versioned DataObjects, only the latest published version is kept, and all drafts deleted. This can be adjusted per DataObject, or globally (see above).
axllent/silverstripe-version-truncator 适用场景与选型建议
axllent/silverstripe-version-truncator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 77.57k 次下载、GitHub Stars 达 36, 最近一次更新时间为 2014 年 03 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「database」 「performance」 「silverstripe」 「versioned」 「dataobject」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 axllent/silverstripe-version-truncator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 axllent/silverstripe-version-truncator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 axllent/silverstripe-version-truncator 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
Dibi is Database Abstraction Library for PHP
g4 application profiler package
CSS/Javascript Minificator, Compressor and Concatenator for TYPO3 - highly configurable frontend asset optimization for CSS/JS merging, minification and compression with optional body parsing, async/defer loading, inline output, data-ignore exclusions, SRI integrity validation/calculation, external
WordPress mu-plugin to remove jQuery Migrate from the list of jQuery dependencies and to allow jQuery to enqueue before </body> instead of in the <head>.
Store your language lines in the database, yaml or other sources
统计信息
- 总下载量: 77.57k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 36
- 点击次数: 25
- 依赖项目数: 3
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2014-03-26