flowpack/neos-asset-usage
Composer 安装命令:
composer require flowpack/neos-asset-usage
包简介
Provides an asset usage service for the Neos CMS
README 文档
README
This package provides a more performant replacement for the asset usage calculation in Neos CMS 5.x, 7.x and 8.x.
In Neos >= 9.0, highly performant asset usage is included in the core, you do NOT need this package anymore then.
Upgrading to Neos 9
- remove the dependency to
flowpack/neos-asset-usage- there is no step 2 - that's it 🙂
Neos always calculated the asset usage when the information was requested. This could take quite long depending on the number of nodes and assets in a project.
This package solves the problem by using the registration service of Flowpack.EntityUsage
to register a usage if an asset is referenced and unregister when the asset is not referenced
by a node anymore.
The data is stored in a database table and can be efficiently queried and accessed by the provided service.
Additionally, the package provides a replacement for the AssetUsageInNodePropertiesStrategy
of Neos CMS. The core strategy is disabled via AOP.
TLDR
Viewing asset usages in Neos CMS will be super fast when this package is installed.
Using it with Flowpack.Media.Ui will also allow enabling additional features
like filtering for unused assets and delete button are disabled if an asset is used.
Compatibility
Neos 5.2, Neos 7.x + Neos 8.x
Installation
Add the package, and the storage as dependency in your site package:
composer require --no-update flowpack/neos-asset-usage flowpack/entity-usage-databasestorage
The run composer update in your project root.
Finally you need to run the command to build the initial usage index:
./flow assetusage:update
This will store all usages in your database. If you deploy your project on another system you have to make sure that you run this command there.
It is recommended to run the command from time to make sure that no usages are in the database that don't exist anymore or usages are missing. When that happens, it is important that you try to find out where they come from. If you think this happened due to an error in this package, please open an issue with as much information as you can give.
Feature: Exclude node types from usage count
Possible use case: If you are using this package in combination with neos/metadata-contentrepositoryadapter, the metadata entries will be recognized as usage count. You can adjust this behaviour with the following settings.
Example to exclude all metadata node types from usage count:
Flowpack: Neos: AssetUsage: excludedNodeTypes: - 'Neos.MetaData:AbstractMetaData'
Example to exclude multiple custom metadata node types:
Flowpack: Neos: AssetUsage: excludedNodeTypes: - 'Vendor.PackageName:Custom.MetaData.NodeType1' - 'Vendor.PackageName:Custom.MetaData.NodeType2'
Related packages
- Flowpack.EntityUsage the generic usage implementation
- Flowpack.EntityUsage.DatabaseStorage for storing usages in the database
Development goal
This functionality will at some point be integrated into the core of a future Neos CMS version.
flowpack/neos-asset-usage 适用场景与选型建议
flowpack/neos-asset-usage 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 27.33k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2021 年 04 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 flowpack/neos-asset-usage 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 flowpack/neos-asset-usage 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 27.33k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 10
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2021-04-23