tnegeli / m2clitools

tnegeli/m2clitools

Some nice commands to cleanup media files and tables on production systems

magento2-module 2.4.6-2.4.9 Compatible Based on composer requirements only QA: failed MIT

CLI Tools for Magento 2

Various CLI Tools for Magento 2

Available commands:

php bin/magento tnegeli:cleanup-unused-product-media

Use this command to backup (or delete) unused product media from filesystem.

You can use the --dry-run option to just test the result.

You can use the --delete option to remove files, instead of doing a backup.

php bin/magento tnegeli:cleanup-unused-category-media

Use this command to backup (or delete) unused category media from filesystem.

You can use the --dry-run option to just test the result.

You can use the --delete option to remove files, instead of doing a backup.

php bin/magento tnegeli:cleanup-unused-swatches-media

Use this command to backup (or delete) unused swatches media from filesystem.

You can use the --dry-run option to just test the result.

You can use the --delete option to remove files, instead of doing a backup.

php bin/magento tnegeli:cleanup-illegal-product-media

Use this command to identify and remove illegal entries in the media gallery database table, which might break catalog:images:resize process.

You can use the --dry-run option to just test the result and give you a list of value_id entries from the media gallery table which are illegal.

php bin/magento tnegeli:cleanup-illegal-product-media-non-existing-files

Use this command to identify and remove illegal entries in the media gallery database table that have no files on the filesystem, which might break catalog:images:resize process.

You can use the --dry-run option to just test the result and give you a list of value_id entries from the media gallery table which are illegal.

php bin/magento tnegeli:cleanup-illegal-product-image-markers-non-existing-files

Each product is checked for the attribute values of

  • image
  • small_image
  • thumbnail

If a product references a file that does not exist, the reference is removed.

You can use the --dry-run option to just test your database.

No changelog yet

The vendor hasn't published a changelog. Tagged releases appear in the Versions tab.

Versions
Version Stability QA Status Released
1.5.5 stable Fail 2025-11-07 10:55:27
1.5.4 stable Not tested 2025-11-07 10:34:15
1.5.3 stable Not tested 2023-08-28 08:00:02
1.5.2 stable Not tested 2020-09-16 12:27:53
1.5.0 stable Not tested 2020-08-27 10:18:08
1.4.2 stable Not tested 2020-06-04 05:38:57
1.4.1 stable Not tested 2019-06-05 14:08:28
1.4.0 stable Not tested 2019-06-05 13:24:52
1.3.0 stable Not tested 2019-05-24 10:07:34
1.2.3 stable Not tested 2017-08-02 09:37:14
1.2.2 stable Not tested 2017-07-18 12:38:02
1.2.1 stable Not tested 2017-07-18 12:26:56
1.2.0 stable Not tested 2017-07-18 12:18:05
1.1.0 stable Not tested 2017-07-14 06:12:56
1.0.0 stable Not tested 2017-07-12 14:15:01

Requires 2

Package Constraint
php >=7.1
magento/framework >=100.1.5
QA results
Tool Status Findings Summary
PHPCS Fail 14 14 errors (gating threshold: error-severity=10, ruleset: Magento2)
PHPStan Fail 14 14 errors (level 4, ruleset: phpstan + bitexpert/phpstan-magento)
Cpd Fail 1 1 duplicated chunk spanning 31 total lines (min-lines=5, min-tokens=70)
Security Pass 0
License
MIT
Make it pay

Turn an existing module into recurring revenue.

If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.