# 2. Installation

## Install the Plugin

1. Download the plugin from the Shopware Store or as a ZIP file.
2. In the Shopware Administration, navigate to **Extensions → My Extensions**.
3. Click **Upload extension** (for ZIP installation) or find the plugin in the list.
4. Click **Install** and then **Activate**.
5. No database migration is required — the plugin does not create any custom tables.

## Getting Started

1. Navigate to **Content → Media Cleanup** in the Administration.
2. The dashboard loads the list of unused media files automatically.
3. Use the filters (file type, minimum size, age) to narrow down the results.
4. Select individual files via checkbox or click **Select all**.
5. Click **Delete selected** — a confirmation dialog appears showing the count and total size.
6. Confirm the deletion. The result (deleted / skipped / failed) will be displayed.

## Setting Up User Permissions

The plugin adds two ACL privileges. To grant access to staff members:

1. Navigate to **Settings → System → Users & Permissions → Roles**.
2. Select the desired role (or create a new one).
3. Find **Media Cleanup** in the permissions section.
4. Assign the required privilege(s):
   * **Read** — access to the dashboard and the unused media list
   * **Delete** — permission to delete unused media files
5. Save the role.

## Notes

* Compatible with Shopware 6.6.x and 6.7.x (PHP 8.2+).
* The plugin communicates only with your own Shopware instance — no external services.
* Deleted files cannot be recovered. Please review your selection carefully before confirming.
* For very large media libraries, consider using the filters to process deletions in smaller batches.
* **Detection is based on Shopware's native logic:** The plugin uses Shopware's built-in unused media detection — the same logic that powers the `media:delete-unused` CLI command. The plugin is not responsible if Shopware classifies a file as unused that is still in use. Always review your selection carefully before deleting.

## Support

If you have questions or issues, please use the Shopware support tool or contact us at <moritz@momocode.de>.
