Disable flush image cache button in the backend in magento2












1















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.



enter image description here










share|improve this question























  • For all user or specific user

    – Amit Bera
    10 hours ago













  • @AmitBera For all user

    – Parthavi
    9 hours ago
















1















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.



enter image description here










share|improve this question























  • For all user or specific user

    – Amit Bera
    10 hours ago













  • @AmitBera For all user

    – Parthavi
    9 hours ago














1












1








1








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.



enter image description here










share|improve this question














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.



enter image description here







cache image magento-2.2.5 flush






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 11 hours ago









ParthaviParthavi

589




589













  • For all user or specific user

    – Amit Bera
    10 hours ago













  • @AmitBera For all user

    – Parthavi
    9 hours ago



















  • For all user or specific user

    – Amit Bera
    10 hours ago













  • @AmitBera For all user

    – Parthavi
    9 hours ago

















For all user or specific user

– Amit Bera
10 hours ago







For all user or specific user

– Amit Bera
10 hours ago















@AmitBera For all user

– Parthavi
9 hours ago





@AmitBera For all user

– Parthavi
9 hours ago










1 Answer
1






active

oldest

votes


















2














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; ?>





share|improve this answer


























  • I am not able to find "Additional Cache Management"

    – Parthavi
    11 hours ago











  • System > User Roles > Role Resources

    – magefms
    11 hours ago











  • Please recheck try search of your browser, screencast.com/t/nQmbQvSXO5S

    – Shoaib Munir
    11 hours ago











  • Can u give me another solution to disable button

    – Parthavi
    10 hours ago











  • Sure, let me try

    – Shoaib Munir
    10 hours ago











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
});


}
});














draft saved

draft discarded


















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









2














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; ?>





share|improve this answer


























  • I am not able to find "Additional Cache Management"

    – Parthavi
    11 hours ago











  • System > User Roles > Role Resources

    – magefms
    11 hours ago











  • Please recheck try search of your browser, screencast.com/t/nQmbQvSXO5S

    – Shoaib Munir
    11 hours ago











  • Can u give me another solution to disable button

    – Parthavi
    10 hours ago











  • Sure, let me try

    – Shoaib Munir
    10 hours ago
















2














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; ?>





share|improve this answer


























  • I am not able to find "Additional Cache Management"

    – Parthavi
    11 hours ago











  • System > User Roles > Role Resources

    – magefms
    11 hours ago











  • Please recheck try search of your browser, screencast.com/t/nQmbQvSXO5S

    – Shoaib Munir
    11 hours ago











  • Can u give me another solution to disable button

    – Parthavi
    10 hours ago











  • Sure, let me try

    – Shoaib Munir
    10 hours ago














2












2








2







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; ?>





share|improve this answer















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; ?>






share|improve this answer














share|improve this answer



share|improve this answer








edited 10 hours ago

























answered 11 hours ago









Shoaib MunirShoaib Munir

1,8791627




1,8791627













  • I am not able to find "Additional Cache Management"

    – Parthavi
    11 hours ago











  • System > User Roles > Role Resources

    – magefms
    11 hours ago











  • Please recheck try search of your browser, screencast.com/t/nQmbQvSXO5S

    – Shoaib Munir
    11 hours ago











  • Can u give me another solution to disable button

    – Parthavi
    10 hours ago











  • Sure, let me try

    – Shoaib Munir
    10 hours ago



















  • I am not able to find "Additional Cache Management"

    – Parthavi
    11 hours ago











  • System > User Roles > Role Resources

    – magefms
    11 hours ago











  • Please recheck try search of your browser, screencast.com/t/nQmbQvSXO5S

    – Shoaib Munir
    11 hours ago











  • Can u give me another solution to disable button

    – Parthavi
    10 hours ago











  • Sure, let me try

    – Shoaib Munir
    10 hours ago

















I am not able to find "Additional Cache Management"

– Parthavi
11 hours ago





I am not able to find "Additional Cache Management"

– Parthavi
11 hours ago













System > User Roles > Role Resources

– magefms
11 hours ago





System > User Roles > Role Resources

– magefms
11 hours ago













Please recheck try search of your browser, screencast.com/t/nQmbQvSXO5S

– Shoaib Munir
11 hours ago





Please recheck try search of your browser, screencast.com/t/nQmbQvSXO5S

– Shoaib Munir
11 hours ago













Can u give me another solution to disable button

– Parthavi
10 hours ago





Can u give me another solution to disable button

– Parthavi
10 hours ago













Sure, let me try

– Shoaib Munir
10 hours ago





Sure, let me try

– Shoaib Munir
10 hours ago


















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Callistus I

Tabula Rosettana

How to label and detect the document text images