Magento: Check your modified Magento class (diff)

If you override the Magento classes in app/code/local/Mage like me, you have certainly outdated classes after a version upgrade.

Note : I don’t recommend you to override the Magento classes because you will have a lot of work during the installation of new release of Magento; If you have the choice, It is better to use a module instead.

You will find below a tip how to perform a diff:

cd app/code/local/Mage/
for i in $(find . -name "*.php")
do echo "************** : $i ****************"
diff -Naur <(tail -n +28 $i) <(tail -n +28 ../../core/Mage/$i)
echo "END $i *******"
read break

This is not a common syntax but I wanted to exclude the license header but as the license date changed, I searched a solution how to exclude the header.

Some explanation :

  • tail -n +2 : exclude the license header
  • <( )          : executes the command in a subshell and redirect the standard output to a FIFO

Below an extract of the shell manual :

Process Substitution
Process substitution is supported on systems that support named pipes (FIFOs) or the /dev/fd method of naming open  files. It takes  the  form  of <(list) or >(list).  The process list is run with its input or output connected to a FIFO or some file in /dev/fd.  The name of this file is passed as an argument to the current command as the result of the expansion.  If the >(list) form is used, writing to the file will provide input for list. If the <(list) form is used, the file passed as an argument should be read to obtain the output of list. When  available,  process substitution is performed simultaneously with parameter and variable expansion, command substitution, and arithmetic expansion.

Et voila,

Nicolas Portais
Author Photographer

Ce contenu a été publié dans Magento, avec comme mot(s)-clé(s) , . Vous pouvez le mettre en favoris avec ce permalien.

1 réponse à Magento: Check your modified Magento class (diff)

  1. Ping : Magento: Compare two Magento themes (diff) | My Magento Blog

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Captcha (solve the arithmetic equation) * Time limit is exhausted. Please reload CAPTCHA.