Published: April 9, 2020
Recently I had to troubleshoot an issue where some products that were expected to be indexed in Elasticsearch were not. The client wasn’t sure which / how many products were missing, so I wrote a script which diffs products stored in MySQL (
catalog_product_entity) against the Elasticsearch index. I’ve decided to share the script here in case others find it useful.
Published: March 5, 2020
Recently I’ve been working with a client whose server is running low on disk space. I found that their
media/catalog/product folder was 174 GB, 128 GB of which was in
media/catalog/product/cache. This seemed like a lot to me, so I did some quick math and realized that the size of their image cache was nearly 3X that of the total size of the source images. This made me curious…what does this ratio look on other Magento installations? I decided to do a little research on this and wanted to share my findings.
Published: March 3, 2020
Recently I was faced with large amount of code requiring review. I needed to get back to the individual who requested the review with an estimate of how long it would take.
To give an informed estimate, it’s useful to have a sense of how many lines of code have changed. This is generally easy to do with the
--shortstat diff option (GitHub also conveniently displays this when looking at a pull request):
$ git diff --shortstat 2.0.0 2.3.0 209 files changed, 30020 insertions(+), 2531 deletions(-)
However a quick glance at the changeset told me that the majority of the changes were unit test files, which I wasn’t particularly interested in reviewing here (this was a review of 3rd party code). I wanted to figure out how many lines of code had changed, excluding test files.
Published: February 5, 2020
In this post I’ll share a standalone script that can be used to render a Magento 2 category page programmatically. This script can come in handy when debugging production issues on category pages (e.g. unexpected product set). For example, it can be executed under
strace to review files opened, queries sent, and their corresponding results.
Published: January 30, 2020
In versions on Magento prior to v2.3.4, users had the ability to add custom layout updates to category, product and cms pages via a textarea input from the Magento admin panel.
These updates would then be merged with layout definitions from the theme on the website to impact the overall frontend page rendering.
Per Magento’s release notes, as of Magento v2.3.4, this ability has been removed:
Removal of custom layout updates and the deprecation of layout updates to remove the opportunity for Remote Code Execution (RCE). The Custom Layout Update field on the CMS Page Edit, Category Edit, and Product Edit pages has now been converted to a selector
I dug into this a bit and shared some info in this Twitter thread. Here, I’d like to present my findings in a slightly more formal manner, and also offer some additional details.
Published: January 8, 2020
A colleague recently reported a strange bug to me:
I’m troubleshooting an issue where data fails to sync the a 3rd party and I’ve identified this error when curl_exec runs
HTTP2 framing layer error
From what I gather online is that this typically a somewhat generic error and could have multiple causes.