source:
- https://devdocs.magento.com/guides/v2.4/comp-mgr/patching/composer.html
- https://support.magento.com/hc/en-us/articles/4406893342093
- https://devdocs.magento.com/guides/v2.4/get-started/api-security.html#rate-limiting
- Open your command line application and navigate to your project directory
- Add the
cweagans/composer-patchesplugin to the composer.json file.
composer require cweagans/composer-patches- Edit the `composer.json file and add the following section to specify:
- Module:
magento/magento2-base - Title:
MC-43048 set ratelimit - Patch to patch:
https://gist.githubusercontent.com/lewisvoncken/a10d2856966084243ff0ab336d503247/raw/MC-43048__set_rate_limits__2.4.3.patchorhttps://gist.githubusercontent.com/lewisvoncken/a10d2856966084243ff0ab336d503247/raw/MC-43048__set_rate_limits__2.3.7-p1.patch
- Module:
For example (2.3.7-p1):
"extra": {
"composer-exit-on-patch-failure": true,
"patches": {
"magento/magento2-base": {
"MC-43048 set ratelimit": "https://gist.githubusercontent.com/lewisvoncken/a10d2856966084243ff0ab336d503247/raw/MC-43048__set_rate_limits__2.3.7-p1.patch"
}
}
}For example (2.4.3):
"extra": {
"composer-exit-on-patch-failure": true,
"patches": {
"magento/magento2-base": {
"MC-43048 set ratelimit": "https://gist.githubusercontent.com/lewisvoncken/a10d2856966084243ff0ab336d503247/raw/MC-43048__set_rate_limits__2.4.3.patch"
}
}
}- Apply the patch. Use the -v option only if you want to see debugging information.
# Dev
composer install -v
# Production:
composer install --no-dev- optional Update the composer.lock file. The lock file tracks which patches have been applied to each Composer package in an object.
composer update --lockThe patch is applied to a di.xml file so when applying it manually in production mode it requires a deployment/re-compile
php bin/magento setup:di:compilePerhaps the app/etc/di.xml / composer.json / composer.lock is added through version control than also commit & push.