Magento 1 tips, tweaks and notes

Magento is an excellent online shop package, but has some parts which aren’t quite as elegant… or that are better with a daily prod rather than using a part of Magento to do something.

 

Import Related

Magento had a fair number of weird bugs which do strange things to imports.

  • Image filenames should be unique, particularly when handled by MAGMI (this can rename them to be unique)
  • Image filenames should not contain the $ symbol (best avoid any special symbols, Magento fails to escape filenames correctly)

Filesystem Related

Magento doesn’t clean up after itself as regards session files. PHP can be configured to do this via garbage collection, but only gets processor time when handling pages from users – not a good time to do nonessential processing.
The following cron job can be run at quiet time:
find /var/www/html/magento/var/session -type f -cmin +$(/usr/lib/php5/maxlifetime) -delete

 

Backups

Database:

mysqldump -u root magento | gzip >magento.sql.gz

Filesystem:

rsync -a –delete –exclude “sess_” –link-dest=`pwd`/backup.1 /var/www/html/ `pwd`/backup.0

 

 

Leave a Reply