tnegeli / m2clitools
tnegeli/m2clitools
Some nice commands to cleanup media files and tables on production systems
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.
| Version | Stability | QA Status | Compatibility | Released |
|---|---|---|---|---|
| 1.5.5 | stable | Fail | Magento 2.4.7-2.4.8 Details | 2025-11-07 10:55:27 |
| 1.5.4 | stable | Not tested | Not yet tested Details | 2025-11-07 10:34:15 |
| 1.5.3 | stable | Not tested | Not yet tested Details | 2023-08-28 08:00:02 |
| 1.5.2 | stable | Not tested | Not yet tested Details | 2020-09-16 12:27:53 |
| 1.5.0 | stable | Not tested | Not yet tested Details | 2020-08-27 10:18:08 |
| 1.4.2 | stable | Not tested | Not yet tested Details | 2020-06-04 05:38:57 |
| 1.4.1 | stable | Not tested | Not yet tested Details | 2019-06-05 14:08:28 |
| 1.4.0 | stable | Not tested | Not yet tested Details | 2019-06-05 13:24:52 |
| 1.3.0 | stable | Not tested | Not yet tested Details | 2019-05-24 10:07:34 |
| 1.2.3 | stable | Not tested | Not yet tested Details | 2017-08-02 09:37:14 |
| 1.2.2 | stable | Not tested | Not yet tested Details | 2017-07-18 12:38:02 |
| 1.2.1 | stable | Not tested | Not yet tested Details | 2017-07-18 12:26:56 |
| 1.2.0 | stable | Not tested | Not yet tested Details | 2017-07-18 12:18:05 |
| 1.1.0 | stable | Not tested | Not yet tested Details | 2017-07-14 06:12:56 |
| 1.0.0 | stable | Not tested | Not yet tested Details | 2017-07-12 14:15:01 |
Requires 2
| Package | Constraint |
|---|---|
| php | >=7.1 |
| magento/framework | >=100.1.5 |
Compatibility
Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.
Code Quality
Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge. A phpcs finding can't make a module incompatible.
Static analysis
Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.
| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Fail | 440 | 14 errors, 426 warnings (ruleset: Magento2) — 303 auto-fixable with phpcbf |
| PHPMD | Warning | 8 | 8 rule violations (CyclomaticComplexity:3, NPathComplexity:3, UnusedFormalParameter:1, ExcessiveMethodLength:1) |
| Cpd | Warning | 1 | 1 duplicated chunk spanning 31 total lines (min-lines=5, min-tokens=70) |
| Composer validate | Info | 1 | valid; 1 advisory note (composer validate --strict) |
PHPStan
Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases.
Tests
Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.
Unit tests
| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | ||
| 2.4.8 | N/A | N/A | ||
| 2.4.9 | N/A | N/A |
Integration tests
| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | ||
| 2.4.8 | N/A | N/A | ||
| 2.4.9 | N/A | N/A |
Security
Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.
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.