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
MassRefresh.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Backend\Controller\Adminhtml\Cache
;
8
9
use
Magento\Framework\Exception\LocalizedException
;
10
use
Magento\Framework\Controller\ResultFactory
;
11
12
class
MassRefresh
extends
\Magento\Backend\Controller\Adminhtml\Cache
13
{
19
const
ADMIN_RESOURCE
=
'Magento_Backend::refresh_cache_type'
;
20
26
public
function
execute
()
27
{
28
try
{
29
$types = $this->
getRequest
()->getParam(
'types'
);
30
$updatedTypes = 0;
31
if
(!is_array($types)) {
32
$types = [];
33
}
34
$this->
_validateTypes
($types);
35
foreach
($types as
$type
) {
36
$this->_cacheTypeList->cleanType(
$type
);
37
$updatedTypes++;
38
}
39
if
($updatedTypes > 0) {
40
$this->messageManager->addSuccessMessage(
__
(
"%1 cache type(s) refreshed."
, $updatedTypes));
41
}
42
}
catch
(
LocalizedException
$e) {
43
$this->messageManager->addErrorMessage($e->getMessage());
44
}
catch
(\Exception $e) {
45
$this->messageManager->addExceptionMessage($e,
__
(
'An error occurred while refreshing cache.'
));
46
}
47
49
$resultRedirect = $this->resultFactory->create(
ResultFactory::TYPE_REDIRECT
);
50
return
$resultRedirect->setPath(
'adminhtml/*'
);
51
}
52
}
Magento\Framework\Exception\LocalizedException
Definition:
LocalizedException.php:17
Magento\Backend\Controller\Adminhtml\Cache\MassRefresh\ADMIN_RESOURCE
const ADMIN_RESOURCE
Definition:
MassRefresh.php:19
Magento\Backend\Controller\Adminhtml\Cache
Definition:
Cache.php:12
Magento\Framework\Controller\ResultFactory
Definition:
ResultFactory.php:17
__
__()
Definition:
__.php:13
Magento\Framework\App\Action\AbstractAction\getRequest
getRequest()
Definition:
AbstractAction.php:60
Magento\Backend\Controller\Adminhtml\Cache\MassRefresh
Definition:
MassRefresh.php:12
$type
$type
Definition:
item.phtml:13
Magento\Framework\App\ActionInterface\execute
execute()
Magento\Backend\Controller\Adminhtml\Cache
Definition:
CleanStaticFilesTest.php:7
Magento\Framework\Controller\ResultFactory\TYPE_REDIRECT
const TYPE_REDIRECT
Definition:
ResultFactory.php:24
Magento\Backend\Controller\Adminhtml\Cache\_validateTypes
_validateTypes(array $types)
Definition:
Cache.php:69