Optimize Eclipse and Zend studio refresh in Magento projects with the resources filters

If you’re using Zend Studio or eclipse and have kept the native structure of a Magento project (in its first version), refreshing a project could sometime be a long task.

This is partly due to the number of files that change and need to be refreshed: Magento needs to take their new content into account.

To avoid refreshing every file changing frequently, you can exclude them: they won’t appear in the project folder, and so, won’t be

Which files types should be excluded from an Eclipse Magento project?

Probably most of the files you won’t edit from Eclipse:

  • Cache files
  • Log files (system.log, exception.log, and all your specific log files)
  • Media files (catalog pictures)
  • Import and export files
  • Backups files
  • Lock files
  • Report files
  • Downloader cache files
  • ….

How to exclude files from an Eclipse Magento project?

You can exclude them using the folders properties:

Properties are available when you right click on a folder from the
PHP Explorer

The properties window under the Zend studio and Eclipse projects

This will open a dialog box allowing to specify the resources filters

Let's go to define the properties four our forder

Adding a resource filter will be a combination of the following parameters

  • Does the filter define an inclusion or exclusion list?
  • On which element is applied filter?: files, folders, both
  • Is the filter applied recurcively?
  • How can we select the appropriate resources?

Screenshot of the window which allow to define resources filters

When exclusion filter will be defined, all matching resources won’t appear anymore in the PHP Explorer tab

Resources filters you should define for your Magento projects

  • Exclude mage–* files from var/cache and var/full_page_cache
  • Exclude sess_* files from var/session
  • Exclude *.log from var/log
  • Exclude *.gif, *.jpg, *.png recurcively from media
  • Exclude *.lock files from var/lock
  • Exclude * from var/backups, var/import, var/export