A few times I’ve been asked to help with auditing an existing website. A customer may come to you with such request, because they need to upgrade, detect and fix errors, improve the performance or add new features to the website. Depending of the audit purpose, you may focus on one of the aspects only or check all of them.
What I begin with is of course files comparision to a clean Magento package of the same version. Pay attention especially to
/app/code/core, /app/design/frontend/base/default, /app/design/adminhtml/base/default, /lib . If there are any modifications in the core files, move them to a custom module or theme. You can do it even for the /lib files – say you have Varien_Date class in /lib/Varien/Date.php and you notice it’s been modifed. Just save it as
/app/code/local/Varien/Date.php and restore the original file from the clean package. The modification should still be working and what’s important – it is going to be preserved when upgrading Magento in the future. You can deal in a similar way with the design files – just copy them to a new theme or package.
Sometimes you inherit code of good quality, other times it may be hard to understand. Do not be afraid to leave the existing code as is – even if the quality do not satisfy you. Remember the golden rule: “If it ain’t broke, don’t fix it“. Otherwise, if you decide to correct working code, you need to have good reasons for it – maybe you see major potential issues (e.g. incompatibility with the PHP version installed on the server)? Otherwise, the best choice is usually to wrap it, creating a ‘black box’, where nobody will look into. The main tip I can give is: be prepared for surprises. Although Magento sites share a lot of functionality and there are common modifications, you can still encounter the unexpected.