What this solution does
The mpm.cleaner module is designed for managing and clearing cache and temporary files in 1C-Bitrix projects. Unlike standard tools, it provides detailed visual statistics before operations: it displays the file count and occupied volume for each cache directory.
A widget in the administrator panel shows real-time data on cache type, path, file count, and size without requiring a page reload.
The functionality allows for selective clearing: users can mark specific directories and trigger the process for them. Both targeted clearing of individual folders and mass deletion of all cache directories in one click are supported.
The module allows adding custom temporary directories via a form or an integrated file browser. Added paths are automatically included in monitoring and cleaning.
Security features include blocking attempts to escape the site's root directory. Clearing the system root is prohibited. All AJAX requests are protected against CSRF attacks. Access to the module's functionality is restricted to users with the administrator role.
All operations are logged in the Bitrix event journal, recording the operation type and path.
The module supports extensibility via events. The OnBeforeMpmCleanerClean event allows other modules to add their own directories to the cleanup list, while OnAfterMpmCleanerClean notifies about the completion of the cleanup. This ensures easy integration into the site ecosystem without modifying the core code.
The architecture is built on PHP 8+ with full strict typing, utilizing readonly classes and named arguments. The core is fully written in D7.
The interface uses Bitrix UI design tokens for a native appearance. It implements skeleton loading to prevent interface jitter during data loading. The system displays adaptive success and error notifications and includes a built-in Bitrix directory browser for convenient path selection.
The module performs regular cleanup of the following cache types:
- managed cache (/bitrix/managed_cache/);
- stack cache (/bitrix/stack_cache/);
- standard cache (/bitrix/cache/);
- HTML cache (composite) (/bitrix/html_pages/);
- image resize cache (/upload/resize_cache/).
Additionally, it provides monitoring of temporary directory usage, allowing you to always see how much space the cache occupies.
The module removes unused temporary files in any directories, including the ability to add custom paths. It accelerates cache clearing for developers and site administrators without requiring menu navigation. Content managers can independently clear the cache after updating content without involving a developer. Online store owners can control the size of image cache and composite cache to maintain optimal site speed.
General iT can install and configure this module and check how it works on your website.