Switch to PSR-4 autoloader
FusionDirectory currently use an old-school autoloader, which relies on «fusiondirectory --update-cache» being run.
Modern PHP (especially stuff using Composer) tend to use autoloaders following this norm: https://www.php-fig.org/psr/psr-4/
fusiondirectory --update-cache parse all our PHP files and stores the class paths in a cache file.
__fusiondirectory_autoload as an autoloader, which uses this cache file to find the classes.
We had to add an exception for smarty classes as smarty has its own autoloader.
Use a PSR-4 autoloader in a autoload.php file.
Step by step description of new behaviour
This would require a huge reorganization of the code:
- Use namespaces
- Use subnamespaces for directories
- One file for each class, ending in .php (no more .inc)
- No more need for
- Interoperable with other autoloaders
- Makes it possible to use tools like phpstan, or libraries based on composer (most of them are nowadays)
- Heavy use of namespaces
- Break of any code relying on current FD organization
- Redo packaging
- Rewrite stuff like