nathanday / module-catalog-images-clean
用于简化目录图像维护的 Magento 2 模块
1.0.2
2022-11-04 16:29 UTC
Requires
- php: ~7.3.0||~7.4.0||^8.0
- magento/framework: >=100.0.1
- magento/module-catalog: >=100.0.1
This package is auto-updated.
Last update: 2024-09-04 20:47:46 UTC
README
事实
- 版本: 1.0.0
- 扩展键: NathanDay_CatalogImagesClean
- GitHub 上的扩展
描述
一个 Magento 2 模块,可以清理目录图像,能够从文件系统中删除未使用的图像和从数据库中删除缺失的图像。
要求
- PHP >= 7.0.0
- Mage_Core
兼容性
- Magento >= 2.0
安装说明
composer config repositories.catalogimagesclean git git@github.com:natedawg92/CatalogImagesClean.git
composer require nathanday/module-catalog-images-clean
php bin/magento module:enable NathanDay_CatalogImagesClean
php bin/magento setup:upgrade
卸载
php bin/magento module:uninstall NathanDay_CatalogImagesClean
用法
信息命令
php bin/magento catalog:images:info
Description:
Information about Unused and/or Missing Images
Usage:
catalog:images:info [options]
Options:
-u, --unused Info on unused product images
-m, --missing Info on missing product images
-t, --duplicate Info on duplicate product images
-d, --database Info on Product images in the Database
-p, --physical Info on Product images in the filesystem
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
要查看未使用、缺失和重复图像的详细信息,无需指定任何特定标志,如果需要关于一个或多个图像的信息,请指定所需的标志
示例输出
======================================
Catalog Product Image Information
======================================
53 Unique Images in Database
802 Images in Filesystem
0 Missing Images
749 Unused Images
78 Duplicate Images
要获取更详细的信息,请将 -v
添加到命令中,这将打印出针对每种类型的详细信息。
- 在缺失图像的情况下,详细标志将打印出文件列表以及该文件在相册记录中出现的次数。
- 在未使用图像的情况下,这将打印出存在于文件系统中但不在数据库中的图像列表
- 在重复数据的情况下,这将打印出图像列表以及它们是重复的
清理命令
php bin/magento catalog:images:clean
Description:
Clean Catalog Images, Delete Unused Images in the Filesystem and/or Remove records in the Database for Missing Images
Usage:
catalog:images:clean [options]
Options:
-u, --unused Delete unused product images
-m, --missing Remove missing product image Records
-t, --duplicate Remove duplicate product images and update database Records
-d, --dry-run Dry Run, don't make any changes
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug```
重要:在利用此命令之前,建议进行数据库和媒体备份。
清理命令将遍历所有操作以清理您的目录图像文件和数据库记录。与信息命令一样,您可以指定要清理的图像的子集,例如 --missing
将仅对缺失图像执行清理命令。
您可以指定 --dry-run
标志,这将打印出将要执行的操作。
详细标志 -v
也可以添加到命令中,以打印出将要更新或删除的图像或数据库记录的列表。
当使用此命令而不使用 --dry-run
标志时,您将看到在继续之前进行适当备份的建议,此时您将被要求确认您想要继续。
在此之后,该命令将继续更新数据库以删除任何缺失图像记录的实例,并从媒体目录中删除与任何产品不相关的文件,具体取决于您选择的要清理的子集。
支持
如果您在此扩展中遇到任何问题,请在 GitHub 上创建问题。
贡献
任何贡献都备受赞赏。贡献代码的最佳方式是在 GitHub 上打开一个拉取请求。
开发者
许可证
版权
(c) 2020 Nathan Day