Disable flush image cache button in the backend in magento2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
Go to Admin > System > Cache Management
I want to disable flush image cache button in backend given Which is highlighted in bellow image for security purpose.
Can anyone give me solution.
Thanks.
magento2 cache image magento-2.2.5 flush
add a comment |
Go to Admin > System > Cache Management
I want to disable flush image cache button in backend given Which is highlighted in bellow image for security purpose.
Can anyone give me solution.
Thanks.
magento2 cache image magento-2.2.5 flush
For all user or specific user
– Amit Bera♦
Mar 11 at 7:03
@AmitBera For all user
– Parthavi
Mar 11 at 8:41
add a comment |
Go to Admin > System > Cache Management
I want to disable flush image cache button in backend given Which is highlighted in bellow image for security purpose.
Can anyone give me solution.
Thanks.
magento2 cache image magento-2.2.5 flush
Go to Admin > System > Cache Management
I want to disable flush image cache button in backend given Which is highlighted in bellow image for security purpose.
Can anyone give me solution.
Thanks.
magento2 cache image magento-2.2.5 flush
magento2 cache image magento-2.2.5 flush
edited Mar 19 at 5:31
Shoaib Munir
2,4512930
2,4512930
asked Mar 11 at 6:33
ParthaviParthavi
1079
1079
For all user or specific user
– Amit Bera♦
Mar 11 at 7:03
@AmitBera For all user
– Parthavi
Mar 11 at 8:41
add a comment |
For all user or specific user
– Amit Bera♦
Mar 11 at 7:03
@AmitBera For all user
– Parthavi
Mar 11 at 8:41
For all user or specific user
– Amit Bera♦
Mar 11 at 7:03
For all user or specific user
– Amit Bera♦
Mar 11 at 7:03
@AmitBera For all user
– Parthavi
Mar 11 at 8:41
@AmitBera For all user
– Parthavi
Mar 11 at 8:41
add a comment |
1 Answer
1
active
oldest
votes
You cannot just directly remove this button, but you can remove access to this button
Goto System -> Permissions -> User Roles
Open the role that you want to edit
Under "Additional Cache Management" you will find "Catalog Images Cache" disable it from here
But if you still want to remove this button, you need to override it's phtml file
Add new xml file in Vendor/Module/view/adminhtml/layout/adminhtml_cache_index.xml
code in this file would be:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="MagentoBackendBlockCacheAdditional" name="cache.additional" template="Vendor_Module::system/cache/additional.phtml">
<arguments>
<argument name="permissions" xsi:type="object">MagentoBackendBlockCachePermissions</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>
And add your phtml file in your module in: Vendor/Module/view/adminhtml/templates/system/cache/additional.phtml
use code:
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
/** @var MagentoBackendBlockCachePermissions|null $permissions */
$permissions = $block->getData('permissions');
?>
<?php if ($permissions && $permissions->hasAccessToAdditionalActions()): ?>
<div class="additional-cache-management">
<?php if ($permissions->hasAccessToFlushCatalogImages()): ?>
<h2>
<span><?= $block->escapeHtml(__('Additional Cache Management')); ?></span>
</h2>
<?php /* ?><p>
<button onclick="setLocation('<?= $block->escapeJs($block->getCleanImagesUrl()); ?>')" type="button">
<?= $block->escapeHtml(__('Flush Catalog Images Cache')); ?>
</button>
<span><?= $block->escapeHtml(__('Pregenerated product images files')); ?></span>
</p><?php */ ?>
<?php endif; ?>
<?php if ($permissions->hasAccessToFlushJsCss()): ?>
<p>
<button onclick="setLocation('<?= $block->escapeJs($block->getCleanMediaUrl()); ?>')" type="button">
<?= $block->escapeHtml(__('Flush JavaScript/CSS Cache')); ?>
</button>
<span><?= $block->escapeHtml(__('Themes JavaScript and CSS files combined to one file')) ?></span>
</p>
<?php endif; ?>
<?php if (!$block->isInProductionMode() && $permissions->hasAccessToFlushStaticFiles()): ?>
<p>
<button onclick="setLocation('<?= $block->escapeJs($block->getCleanStaticFilesUrl()); ?>')" type="button">
<?= $block->escapeHtml(__('Flush Static Files Cache')); ?>
</button>
<span><?= $block->escapeHtml(__('Preprocessed view files and static files')); ?></span>
</p>
<?php endif; ?>
<?= $block->getChildHtml() ?>
</div>
<?php endif; ?>
I am not able to find "Additional Cache Management"
– Parthavi
Mar 11 at 6:44
System > User Roles > Role Resources
– magefms
Mar 11 at 6:47
Please recheck try search of your browser, screencast.com/t/nQmbQvSXO5S
– Shoaib Munir
Mar 11 at 6:49
Can u give me another solution to disable button
– Parthavi
Mar 11 at 7:15
Sure, let me try
– Shoaib Munir
Mar 11 at 7:19
|
show 4 more comments
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f265205%2fdisable-flush-image-cache-button-in-the-backend-in-magento2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You cannot just directly remove this button, but you can remove access to this button
Goto System -> Permissions -> User Roles
Open the role that you want to edit
Under "Additional Cache Management" you will find "Catalog Images Cache" disable it from here
But if you still want to remove this button, you need to override it's phtml file
Add new xml file in Vendor/Module/view/adminhtml/layout/adminhtml_cache_index.xml
code in this file would be:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="MagentoBackendBlockCacheAdditional" name="cache.additional" template="Vendor_Module::system/cache/additional.phtml">
<arguments>
<argument name="permissions" xsi:type="object">MagentoBackendBlockCachePermissions</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>
And add your phtml file in your module in: Vendor/Module/view/adminhtml/templates/system/cache/additional.phtml
use code:
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
/** @var MagentoBackendBlockCachePermissions|null $permissions */
$permissions = $block->getData('permissions');
?>
<?php if ($permissions && $permissions->hasAccessToAdditionalActions()): ?>
<div class="additional-cache-management">
<?php if ($permissions->hasAccessToFlushCatalogImages()): ?>
<h2>
<span><?= $block->escapeHtml(__('Additional Cache Management')); ?></span>
</h2>
<?php /* ?><p>
<button onclick="setLocation('<?= $block->escapeJs($block->getCleanImagesUrl()); ?>')" type="button">
<?= $block->escapeHtml(__('Flush Catalog Images Cache')); ?>
</button>
<span><?= $block->escapeHtml(__('Pregenerated product images files')); ?></span>
</p><?php */ ?>
<?php endif; ?>
<?php if ($permissions->hasAccessToFlushJsCss()): ?>
<p>
<button onclick="setLocation('<?= $block->escapeJs($block->getCleanMediaUrl()); ?>')" type="button">
<?= $block->escapeHtml(__('Flush JavaScript/CSS Cache')); ?>
</button>
<span><?= $block->escapeHtml(__('Themes JavaScript and CSS files combined to one file')) ?></span>
</p>
<?php endif; ?>
<?php if (!$block->isInProductionMode() && $permissions->hasAccessToFlushStaticFiles()): ?>
<p>
<button onclick="setLocation('<?= $block->escapeJs($block->getCleanStaticFilesUrl()); ?>')" type="button">
<?= $block->escapeHtml(__('Flush Static Files Cache')); ?>
</button>
<span><?= $block->escapeHtml(__('Preprocessed view files and static files')); ?></span>
</p>
<?php endif; ?>
<?= $block->getChildHtml() ?>
</div>
<?php endif; ?>
I am not able to find "Additional Cache Management"
– Parthavi
Mar 11 at 6:44
System > User Roles > Role Resources
– magefms
Mar 11 at 6:47
Please recheck try search of your browser, screencast.com/t/nQmbQvSXO5S
– Shoaib Munir
Mar 11 at 6:49
Can u give me another solution to disable button
– Parthavi
Mar 11 at 7:15
Sure, let me try
– Shoaib Munir
Mar 11 at 7:19
|
show 4 more comments
You cannot just directly remove this button, but you can remove access to this button
Goto System -> Permissions -> User Roles
Open the role that you want to edit
Under "Additional Cache Management" you will find "Catalog Images Cache" disable it from here
But if you still want to remove this button, you need to override it's phtml file
Add new xml file in Vendor/Module/view/adminhtml/layout/adminhtml_cache_index.xml
code in this file would be:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="MagentoBackendBlockCacheAdditional" name="cache.additional" template="Vendor_Module::system/cache/additional.phtml">
<arguments>
<argument name="permissions" xsi:type="object">MagentoBackendBlockCachePermissions</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>
And add your phtml file in your module in: Vendor/Module/view/adminhtml/templates/system/cache/additional.phtml
use code:
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
/** @var MagentoBackendBlockCachePermissions|null $permissions */
$permissions = $block->getData('permissions');
?>
<?php if ($permissions && $permissions->hasAccessToAdditionalActions()): ?>
<div class="additional-cache-management">
<?php if ($permissions->hasAccessToFlushCatalogImages()): ?>
<h2>
<span><?= $block->escapeHtml(__('Additional Cache Management')); ?></span>
</h2>
<?php /* ?><p>
<button onclick="setLocation('<?= $block->escapeJs($block->getCleanImagesUrl()); ?>')" type="button">
<?= $block->escapeHtml(__('Flush Catalog Images Cache')); ?>
</button>
<span><?= $block->escapeHtml(__('Pregenerated product images files')); ?></span>
</p><?php */ ?>
<?php endif; ?>
<?php if ($permissions->hasAccessToFlushJsCss()): ?>
<p>
<button onclick="setLocation('<?= $block->escapeJs($block->getCleanMediaUrl()); ?>')" type="button">
<?= $block->escapeHtml(__('Flush JavaScript/CSS Cache')); ?>
</button>
<span><?= $block->escapeHtml(__('Themes JavaScript and CSS files combined to one file')) ?></span>
</p>
<?php endif; ?>
<?php if (!$block->isInProductionMode() && $permissions->hasAccessToFlushStaticFiles()): ?>
<p>
<button onclick="setLocation('<?= $block->escapeJs($block->getCleanStaticFilesUrl()); ?>')" type="button">
<?= $block->escapeHtml(__('Flush Static Files Cache')); ?>
</button>
<span><?= $block->escapeHtml(__('Preprocessed view files and static files')); ?></span>
</p>
<?php endif; ?>
<?= $block->getChildHtml() ?>
</div>
<?php endif; ?>
I am not able to find "Additional Cache Management"
– Parthavi
Mar 11 at 6:44
System > User Roles > Role Resources
– magefms
Mar 11 at 6:47
Please recheck try search of your browser, screencast.com/t/nQmbQvSXO5S
– Shoaib Munir
Mar 11 at 6:49
Can u give me another solution to disable button
– Parthavi
Mar 11 at 7:15
Sure, let me try
– Shoaib Munir
Mar 11 at 7:19
|
show 4 more comments
You cannot just directly remove this button, but you can remove access to this button
Goto System -> Permissions -> User Roles
Open the role that you want to edit
Under "Additional Cache Management" you will find "Catalog Images Cache" disable it from here
But if you still want to remove this button, you need to override it's phtml file
Add new xml file in Vendor/Module/view/adminhtml/layout/adminhtml_cache_index.xml
code in this file would be:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="MagentoBackendBlockCacheAdditional" name="cache.additional" template="Vendor_Module::system/cache/additional.phtml">
<arguments>
<argument name="permissions" xsi:type="object">MagentoBackendBlockCachePermissions</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>
And add your phtml file in your module in: Vendor/Module/view/adminhtml/templates/system/cache/additional.phtml
use code:
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
/** @var MagentoBackendBlockCachePermissions|null $permissions */
$permissions = $block->getData('permissions');
?>
<?php if ($permissions && $permissions->hasAccessToAdditionalActions()): ?>
<div class="additional-cache-management">
<?php if ($permissions->hasAccessToFlushCatalogImages()): ?>
<h2>
<span><?= $block->escapeHtml(__('Additional Cache Management')); ?></span>
</h2>
<?php /* ?><p>
<button onclick="setLocation('<?= $block->escapeJs($block->getCleanImagesUrl()); ?>')" type="button">
<?= $block->escapeHtml(__('Flush Catalog Images Cache')); ?>
</button>
<span><?= $block->escapeHtml(__('Pregenerated product images files')); ?></span>
</p><?php */ ?>
<?php endif; ?>
<?php if ($permissions->hasAccessToFlushJsCss()): ?>
<p>
<button onclick="setLocation('<?= $block->escapeJs($block->getCleanMediaUrl()); ?>')" type="button">
<?= $block->escapeHtml(__('Flush JavaScript/CSS Cache')); ?>
</button>
<span><?= $block->escapeHtml(__('Themes JavaScript and CSS files combined to one file')) ?></span>
</p>
<?php endif; ?>
<?php if (!$block->isInProductionMode() && $permissions->hasAccessToFlushStaticFiles()): ?>
<p>
<button onclick="setLocation('<?= $block->escapeJs($block->getCleanStaticFilesUrl()); ?>')" type="button">
<?= $block->escapeHtml(__('Flush Static Files Cache')); ?>
</button>
<span><?= $block->escapeHtml(__('Preprocessed view files and static files')); ?></span>
</p>
<?php endif; ?>
<?= $block->getChildHtml() ?>
</div>
<?php endif; ?>
You cannot just directly remove this button, but you can remove access to this button
Goto System -> Permissions -> User Roles
Open the role that you want to edit
Under "Additional Cache Management" you will find "Catalog Images Cache" disable it from here
But if you still want to remove this button, you need to override it's phtml file
Add new xml file in Vendor/Module/view/adminhtml/layout/adminhtml_cache_index.xml
code in this file would be:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="MagentoBackendBlockCacheAdditional" name="cache.additional" template="Vendor_Module::system/cache/additional.phtml">
<arguments>
<argument name="permissions" xsi:type="object">MagentoBackendBlockCachePermissions</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>
And add your phtml file in your module in: Vendor/Module/view/adminhtml/templates/system/cache/additional.phtml
use code:
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
/** @var MagentoBackendBlockCachePermissions|null $permissions */
$permissions = $block->getData('permissions');
?>
<?php if ($permissions && $permissions->hasAccessToAdditionalActions()): ?>
<div class="additional-cache-management">
<?php if ($permissions->hasAccessToFlushCatalogImages()): ?>
<h2>
<span><?= $block->escapeHtml(__('Additional Cache Management')); ?></span>
</h2>
<?php /* ?><p>
<button onclick="setLocation('<?= $block->escapeJs($block->getCleanImagesUrl()); ?>')" type="button">
<?= $block->escapeHtml(__('Flush Catalog Images Cache')); ?>
</button>
<span><?= $block->escapeHtml(__('Pregenerated product images files')); ?></span>
</p><?php */ ?>
<?php endif; ?>
<?php if ($permissions->hasAccessToFlushJsCss()): ?>
<p>
<button onclick="setLocation('<?= $block->escapeJs($block->getCleanMediaUrl()); ?>')" type="button">
<?= $block->escapeHtml(__('Flush JavaScript/CSS Cache')); ?>
</button>
<span><?= $block->escapeHtml(__('Themes JavaScript and CSS files combined to one file')) ?></span>
</p>
<?php endif; ?>
<?php if (!$block->isInProductionMode() && $permissions->hasAccessToFlushStaticFiles()): ?>
<p>
<button onclick="setLocation('<?= $block->escapeJs($block->getCleanStaticFilesUrl()); ?>')" type="button">
<?= $block->escapeHtml(__('Flush Static Files Cache')); ?>
</button>
<span><?= $block->escapeHtml(__('Preprocessed view files and static files')); ?></span>
</p>
<?php endif; ?>
<?= $block->getChildHtml() ?>
</div>
<?php endif; ?>
edited Mar 11 at 7:27
answered Mar 11 at 6:38
Shoaib MunirShoaib Munir
2,4512930
2,4512930
I am not able to find "Additional Cache Management"
– Parthavi
Mar 11 at 6:44
System > User Roles > Role Resources
– magefms
Mar 11 at 6:47
Please recheck try search of your browser, screencast.com/t/nQmbQvSXO5S
– Shoaib Munir
Mar 11 at 6:49
Can u give me another solution to disable button
– Parthavi
Mar 11 at 7:15
Sure, let me try
– Shoaib Munir
Mar 11 at 7:19
|
show 4 more comments
I am not able to find "Additional Cache Management"
– Parthavi
Mar 11 at 6:44
System > User Roles > Role Resources
– magefms
Mar 11 at 6:47
Please recheck try search of your browser, screencast.com/t/nQmbQvSXO5S
– Shoaib Munir
Mar 11 at 6:49
Can u give me another solution to disable button
– Parthavi
Mar 11 at 7:15
Sure, let me try
– Shoaib Munir
Mar 11 at 7:19
I am not able to find "Additional Cache Management"
– Parthavi
Mar 11 at 6:44
I am not able to find "Additional Cache Management"
– Parthavi
Mar 11 at 6:44
System > User Roles > Role Resources
– magefms
Mar 11 at 6:47
System > User Roles > Role Resources
– magefms
Mar 11 at 6:47
Please recheck try search of your browser, screencast.com/t/nQmbQvSXO5S
– Shoaib Munir
Mar 11 at 6:49
Please recheck try search of your browser, screencast.com/t/nQmbQvSXO5S
– Shoaib Munir
Mar 11 at 6:49
Can u give me another solution to disable button
– Parthavi
Mar 11 at 7:15
Can u give me another solution to disable button
– Parthavi
Mar 11 at 7:15
Sure, let me try
– Shoaib Munir
Mar 11 at 7:19
Sure, let me try
– Shoaib Munir
Mar 11 at 7:19
|
show 4 more comments
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f265205%2fdisable-flush-image-cache-button-in-the-backend-in-magento2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
For all user or specific user
– Amit Bera♦
Mar 11 at 7:03
@AmitBera For all user
– Parthavi
Mar 11 at 8:41