The Decorator pattern allows you to dynamically add behaviour to an object without modifying its class and without inheritance. Each decorator wraps the original object and extends or modifies its behaviour. In PHP and Magento 2 it is one of the most frequently used patterns – Magento’s plugin system is effectively a Decorator implemented by the DI framework.

(more…)

An administrator account was locked after a dictionary attack – 10,000 login attempts in one hour. Magento locks an account after 6 failed attempts for 30 minutes. Problem: the attacker kept resetting the counter by changing IP, while the real admin could not log in. Fix time: 1 hour.

(more…)

Union-Find (Disjoint Set Union) is a data structure for managing disjoint sets. It supports two operations in nearly O(1) time: checking whether two elements belong to the same set (Find) and merging two sets (Union). The algorithm appears in graph problems, cycle detection and element grouping. In Magento 2 it is useful for merging duplicate customers and products.

(more…)

Magento 2 cron stopped working – over 50,000 unexecuted jobs were backed up in the cron_schedule table. Transactional emails were not going out, indexers were not updating, pricing rules were not refreshing. The shop worked normally for customers but was frozen “from the inside”. Fix time: 3 hours.

(more…)

TOP