Best practices in Magento for modifying private function code in vendor
1. Create shell file: m2-patch/apply-patch.sh
#!/bin/bash
PATCH_FILES=( $(find ./m2-patch -name "*.patch") )
for file in "${PATCH_FILES[@]}"; do
echo "$file"
done
for PATCH_FILE in "${PATCH_FILES[@]}"
do
APPLIED=$(patch -p1 --dry-run < $PATCH_FILE | grep -c "ignored")
if [ $APPLIED -eq 0 ]; then
patch -p1 < $PATCH_FILE
echo "Apply success: $PATCH_FILE"
else
echo "Patch has been applied: $PATCH_FILE"
fi
done
2. Add a patch file, for example m2-patch/fix_vendor_varnish_purge.patch
#Here is the patch content
3. Then, you can use the command to update code change.
bash m2-patch/apply-patch.sh
April 9, 2024
|
View: 122
|
Categories: <a class="mp-info" href="https://www.dmtq.com/blog/category/development.html">Development</a>
| Tags: <a class="mp-info" href="https://www.dmtq.com/blog/tag/magento.html">Magento</a>, <a class="mp-info" href="https://www.dmtq.com/blog/tag/patch.html">Patch</a>, <a class="mp-info" href="https://www.dmtq.com/blog/tag/vendor.html">Vendor</a>
|
By: <a class="mp-info" href="https://www.dmtq.com/blog/author.html">Admin</a>
About the Author
Admin
Multiple magento websites share one varnish instance
April 9, 2024
Categories
Monthly Archive
Topics
My Wish List