Created
December 15, 2021 01:29
-
-
Save dev-4458/167e505322eab2c16978e69874435f5e to your computer and use it in GitHub Desktop.
Magento 2 remove un-unsed captcha folder i.e. pub\media\captcha\base folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use Magento\Framework\App\Bootstrap; | |
| require __DIR__ . '/app/bootstrap.php'; | |
| ini_set('display_errors', 1); | |
| $host = $_SERVER['HTTP_HOST']; | |
| $params = $_SERVER; | |
| $bootstrap = Bootstrap::create(BP, $params); | |
| $objectManager = $bootstrap->getObjectManager(); | |
| $state = $objectManager->get('Magento\Framework\App\State'); | |
| $state->setAreaCode('frontend'); | |
| $deleteExpiredImages = $objectManager->get('Magento\Captcha\Cron\DeleteExpiredImages'); | |
| try{ | |
| $deleteExpiredImages->execute(); | |
| echo 'deleteExpiredImages, done'; | |
| } | |
| catch(Exception $e){ | |
| echo $e->getMessage(); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CRON TAB:
/usr/local/bin/ea-php74 /var/www/public_html/magento2_delete_captcha_folder.php 2>&1 | tee /var/www/public_html/magento2_deleteCaptcha.log