Let the platform do the work

Autoloader

Overview

The autoloader is an API that allows the unified handling of customizations and customizable metadata while reducing the number of filesystem accesses and improving performance.

SugarAutoLoader

The SugarAutoLoader class, located in ./include/utils/autoloader.php, keeps a map of files within the Sugar directory that may be loaded.

Included File Extensions

The autoloader will only map files with the following extensions:

  • bmp
  • css
  • gif
  • hbs
  • html
  • ico
  • jpg
  • js
  • less
  • override
  • php
  • png
  • tif
  • tpl
  • xml

*All other file extensions are excluded from the mapping.

Class Loading Directories

The autoloader will scan and autoload classes in the following directories:

  • ./clients/base/api/
  • ./data/duplicatecheck/
  • ./data/Relationships/
  • ./data/visibility/
  • ./include/
  • ./include/api/
  • ./include/CalendarEvents/
  • ./include/SugarSearchEngine/
  • ./modules/Calendar/
  • ./modules/Mailer/

Ignored Directories

The following directories in Sugar are ignored by the autoloader mapping:

  • ./.idea/
  • ./cache/
  • ./custom/backup/
  • ./custom/blowfish/
  • ./custom/Extension/
  • ./custom/history/
  • ./custom/modulebuilder/
  • ./docs/
  • ./examples/
  • ./portal/
  • ./tests/
  • ./upload/
  • ./vendor/bin/
  • ./vendor/HTMLPurifier/
  • ./vendor/log4php/
  • ./vendor/nusoap/
  • ./vendor/pclzip/
  • ./vendor/reCaptcha/
  • ./vendor/ytree/