Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-backend
Controller
Adminhtml
Cache
CleanImages.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Backend\Controller\Adminhtml\Cache
;
8
9
use
Magento\Framework\App\Action\HttpGetActionInterface
as HttpGetActionInterface;
10
use
Magento\Framework\Exception\LocalizedException
;
11
use
Magento\Framework\Controller\ResultFactory
;
12
13
class
CleanImages
extends
\Magento\Backend\Controller\Adminhtml\Cache
implements HttpGetActionInterface
14
{
20
const
ADMIN_RESOURCE
=
'Magento_Backend::flush_catalog_images'
;
21
27
public
function
execute
()
28
{
29
try
{
30
$this->_objectManager->create(\
Magento
\Catalog\Model\Product\Image::class)->clearCache();
31
$this->_eventManager->dispatch(
'clean_catalog_images_cache_after'
);
32
$this->messageManager->addSuccessMessage(
__
(
'The image cache was cleaned.'
));
33
}
catch
(
LocalizedException
$e) {
34
$this->messageManager->addErrorMessage($e->getMessage());
35
}
catch
(\Exception $e) {
36
$this->messageManager->addExceptionMessage($e,
__
(
'An error occurred while clearing the image cache.'
));
37
}
38
40
$resultRedirect = $this->resultFactory->create(
ResultFactory::TYPE_REDIRECT
);
41
return
$resultRedirect->setPath(
'adminhtml/*'
);
42
}
43
}
Magento\Framework\Exception\LocalizedException
Definition:
LocalizedException.php:17
Magento\Backend\Controller\Adminhtml\Cache
Definition:
Cache.php:12
Magento\Backend\Controller\Adminhtml\Cache\CleanImages
Definition:
CleanImages.php:13
Magento\Framework\App\Action\HttpGetActionInterface
Definition:
HttpGetActionInterface.php:16
Magento\Framework\Controller\ResultFactory
Definition:
ResultFactory.php:17
__
__()
Definition:
__.php:13
Magento\Framework\App\ActionInterface\execute
execute()
Magento\Backend\Controller\Adminhtml\Cache
Definition:
CleanStaticFilesTest.php:7
Magento
Magento\Framework\Controller\ResultFactory\TYPE_REDIRECT
const TYPE_REDIRECT
Definition:
ResultFactory.php:24
Magento\Backend\Controller\Adminhtml\Cache\CleanImages\ADMIN_RESOURCE
const ADMIN_RESOURCE
Definition:
CleanImages.php:20