oxid-esales / consistency-check-tool
OXID eSales Consistency Check Component
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Type:oxideshop-component
Requires
- php: ^8.2
Requires (Dev)
- mikey179/vfsstream: ~1.6.8
- oxid-esales/oxideshop-ce: dev-b-7.3.x
- phpmd/phpmd: ^2.15
- phpstan/phpstan: ^2.0.2
- phpunit/phpunit: ~10.5.17
- squizlabs/php_codesniffer: ^3.10
Conflicts
- oxid-esales/oxideshop-ce: <7.3
This package is not auto-updated.
Last update: 2025-06-17 21:52:43 UTC
README
The OXID eSales Consistency Check component is designed to perform various consistency checks on your eShop. It primarily focuses on detecting unused images and provides multiple actions such as
- Performing a dry-run to see how many images would be affected
- Moving unused images to another location
- Deleting unused images to free up storage
This component ensures that your eShop remains optimized by helping you remove or move unnecessary image files while keeping track of the changes.
Features
- Provides commands to move or delete unused images.
- Supports dry-run mode, allowing safe testing before making changes.
- Filter unused images across product, categories, and manufacturers.
- Progress bar for real-time feedback
- Logs all actions in log/oe_consistency_check.log for review and auditing.
- Customizable directory paths for images.
Compatibility
This component assumes you have OXID eShop Compilation version 7.3.0 installed.
Installation
To install this component in your OXID eShop environment, use Composer:
$ composer require oxid-esales/consistency-check-tool
Development installation
The installation instructions below are shown for the current SDK for shop 7.3. Make sure your system meets the requirements of the SDK.
-
Ensure all docker containers are down to avoid port conflicts
-
Clone the SDK for the new project
echo MyProject && git clone https://github.com/OXID-eSales/docker-eshop-sdk.git $_ && cd $_
- Clone the repository to the source directory
git clone --recurse-submodules https://github.com/OXID-eSales/consistency-check-tool.git --branch=b-7.3.x ./source
- Run the recipe to setup the development environment
./source/recipes/setup-development.sh
You should be able to access the shop with http://localhost.local and the admin panel with http://localhost.local/admin (credentials: noreply@oxid-esales.com / admin)
Usage
The tool provides several commands for managing unused images.
Move Unused Images
Move unused images to a specific directory (e.g., /backup/images)
$ vendor/bin/oe-console oe:consistency_check:move-unused-images --destination=out/pictures/backup/
When specifying a destination folder for moving images, note that paths are relative to the shop root.
For example:
- If you set
destination
to/
, the source and target directories will be identical. - To move images to
out/pictures/backup/
, simply provideout/pictures/backup/
as the destination.
Delete Unused Images
Permanently delete unused images:
$ vendor/bin/oe-console oe:consistency_check:delete-unused-images
Dry Run Mode
To perform a dry-run (simulate the move without making changes):
$ vendor/bin/oe-console oe:consistency_check:delete-unused-images --dry-run $ vendor/bin/oe-console oe:consistency_check:move-unused-images --destination=/path/to/backup --dry-run
Verbose Output (-v)
To view detailed logs of affected files (e.g., which images would be deleted or moved), you can pass the -v
flag along with your command:
$ vendor/bin/oe-console oe:consistency_check:delete-unused-images --dry-run -v $ vendor/bin/oe-console oe:consistency_check:move-unused-images --destination=/path/to/backup --dry-run -v
When -v
is enabled, the command displays relevant entries from the consistency check log file directly in the console output. This is especially useful for shop owners who want to inspect which images are impacted before taking action.
Filter by Entity Type (optional)
Process specific entity types (e.g., product, category, manufacturer):
$ vendor/bin/oe-console oe:consistency_check:delete-unused-images --type=product
If this parameter is not set the application perform actions on all images.
Logs
All operations, including moved and deleted images, are logged in:
log/oe_consistency_check.log
This log file helps you track the changes and verify actions performed by the tool.
Customizable parameters
There are several parameters in the services.yaml
that can be customized for the module:
app.log_file_path
- Path to the log file where the consistency check results will be stored.
To modify the parameters, create the configurable_services.yaml
file in the var/configuration
folder as
described in the Documentation,
and overwrite the parameters you want to change. Ex.:
parameters: app.log_file_path: '/my/custom/filepath/to.log'
Custom file paths for images
If you are using custom directory paths for storing images (products, categories, manufacturers), overwrite the
services defined in src/ImageManager/Entity/services.yaml
by using the same procedure described in the
Documentation
for service overriding - use already mentioned configurable_services.yaml
file in the var/configuration
folder.:
Example override for product images:
services:
oxid_esales.consistency_check.entity.image_entity.product.oxpic1:
class: OxidEsales\ConsistencyCheck\ImageManager\Entity\ImageEntity
arguments:
$name: 'Product'
$table: 'oxarticles'
$fieldName: 'OXPIC1'
$directory: 'custom/directory/to/pictures/master/products/1'
tags: ['oe.consistency_check.image_entity']
Testing
Linting, syntax check, static analysis
$ composer update $ composer static
Unit/Integration tests
-
Install this component in a running OXID eShop
-
run Unit + Integration tests
$ composer phpunit
- run Unit tests
$ ./vendor/bin/phpunit -c vendor/oxid-esales/consistency-check-tool/tests/phpunit.xml
- run Integration tests
$ ./vendor/bin/phpunit --bootstrap=./source/bootstrap.php -c vendor/oxid-esales/consistency-check-tool/tests/phpintegration.xml
Troubleshooting
Wrong log file path
This tool uses a default log path /var/www/source/log/oe_consistency_check.log
in a standard OXID eShop
directory structure. However, if your project uses a different structure (e.g. /var/www/custom/source/log
), this
directory may not exist, and you may encounter an error like:
There is no existing directory at "/var/www/custom/source/log" and its not buildable: Permission denied.
Refer to the "Customizable parameters" section to learn how to change the log file path.