Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

conlabz CleanMedia: Magento 2 Extension zum Bereinigen verwaister Produktbilder

🇩🇪 Deutsch · 🇬🇧 English

Diese Magento 2 Extension stellt einen CLI-Befehl bereit, der verwaiste Produktbilder im Ordner media/catalog/product findet und entfernt, inklusive der zugehörigen Datenbankeinträge.

MIT License Magento 2

Deutsch

Funktion

Conlabz_CleanMedia räumt den Medienordner gelöschter Produkte auf:

  • Durchsucht den Ordner media/catalog/product (inklusive /cache, optional überspringbar).
  • Ermittelt alle tatsächlich von Produkten genutzten Bilder über die Tabellen catalog_product_entity_media_gallery_value_to_entity (liefert value_id) und catalog_product_entity_media_gallery (liefert den realen Pfad value).
  • Löscht alle Dateien im Medienordner, die von keinem Produkt mehr referenziert werden.
  • Entfernt die zugehörigen, nicht mehr benötigten Datenbankeinträge.
  • Platzhalterbilder (/placeholder/) werden von der Löschung ausgenommen.

Kompatibilität

Komponente Version
Magento magento/framework: ^103.0 (Composer-Constraint)
Symfony Console ^7.0

Installation

composer require conlabz/magento2-module-clean-media

Befehle

php bin/magento media:clean --help
php bin/magento media:clean

Optionen:

  • --dry-run – zeigt an, was gelöscht würde, ohne tatsächlich zu löschen.
  • --no-cache – überspringt den /cache-Unterordner, sinnvoll bei sehr großen Katalogen zur Vermeidung von Performance-Problemen.
  • --force – überspringt die Sicherheitsabfrage und löscht sofort.

Ohne --dry-run und --force fragt der Befehl vor dem Löschen interaktiv nach Bestätigung.

Support

Bei Fragen zu dieser Extension: conlabz.de


English

What it does

Conlabz_CleanMedia cleans up the media folder of deleted products:

  • Scans the media/catalog/product folder (including /cache, optionally skippable).
  • Determines all images actually used by products via the catalog_product_entity_media_gallery_value_to_entity table (gives value_id) and the catalog_product_entity_media_gallery table (gives the real path value).
  • Deletes all files in the media folder that are no longer referenced by any product.
  • Removes the related, no-longer-needed database entries.
  • Placeholder images (/placeholder/) are excluded from deletion.

Compatibility

Component Version
Magento magento/framework: ^103.0 (composer constraint)
Symfony Console ^7.0

Installation

composer require conlabz/magento2-module-clean-media

Commands

php bin/magento media:clean --help
php bin/magento media:clean

Options:

  • --dry-run – shows what would be deleted without actually deleting anything.
  • --no-cache – skips the /cache subfolder, useful for very large catalogs to avoid performance issues.
  • --force – skips the confirmation prompt and deletes immediately.

Without --dry-run and --force, the command asks for interactive confirmation before deleting.

Support

For questions about this extension: conlabz.de


License

This extension is licensed under the MIT License. See LICENSE for details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages