When you get a new project from a partner/client (a maintenance project), how do you know the quality of the new project’s code? Has there been a core hack or not? Verifying whether the core code of Magento has changed or not is a part of the Audit code task. Here, I will write the steps which I do to check whether the code of Core Magento has been changed or not.

First of all, we need to know why we have to verify whether the core of Magento is changed or not.

As you know, Magento changes a lot, and Magento release new versions frequently to update functions, fix bugs, improve security, etc. So each time Magento releases a new version we have to update our projects to the latest version of Magento to get the latest features and improve the security of our web site.

Each update of the Magento core is likely to change the code, and changes will be overridden when we update Magento to a new version. This could cause the site to lose functions which we made by changing the previous code in Magento’s core.

To avoid this happening we have to make sure that the core is not changed before we start implementing new functions/features for a maintenance project.

To verify the core code we need to compare the core code of a fresh Magento version (an original version downloaded from Magento) and the core code of our maintenance project.

First, we have to check the Magento version of maintenance project. In this article, I will use Magento 2 as a demo to show verify steps. 

It will show different things between the two directories vendor/magento.

  

With this result, we can see whether the core of the maintenance project is hacked or not so we will have to find a solution to fix it before we start adding new functions.

In my case, I see my project has some changes in Magento core files. So I have to check these changes then migrate them to a custom module to keep the changed functionality and then revert the core files to the original code.

You can apply the same for Magento 1 when you do an audit for a Magento 1 project.

Thanks for reading. Please leave a comment below if you have any question.

Vong Tran

Share with us your business goals and product ideas, we will support you to develop, scale and succeed together.