Skip to content

Commit 407f065

Browse files
committed
Set up autoload of classes before starting autoload scripts, and load them in a predictable fashion.
1 parent 0ad5ede commit 407f065

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

init.php

+9-3
Original file line numberDiff line numberDiff line change
@@ -483,14 +483,20 @@ class FileStreamMainStatic extends FileStreamBase
483483
unset($config);
484484

485485
foreach (System::getModules(GIMLE5) as $name) {
486+
if (is_executable(SITE_DIR . 'module/' . $name . '/lib/')) {
487+
System::autoloadRegister(SITE_DIR . 'module/' . $name . '/lib/');
488+
}
489+
$loadfiles = [];
486490
if (is_executable(SITE_DIR . 'module/' . $name . '/autoload/')) {
487491
foreach (new \RecursiveDirectoryIterator(SITE_DIR . 'module/' . $name . '/autoload/', \FilesystemIterator::SKIP_DOTS) as $fileInfo) {
488-
include SITE_DIR . 'module/' . $name . '/autoload/' . $fileInfo->getFilename();
492+
$loadfiles[] = $fileInfo->getFilename();
489493
}
490494
}
491-
if (is_executable(SITE_DIR . 'module/' . $name . '/lib/')) {
492-
System::autoloadRegister(SITE_DIR . 'module/' . $name . '/lib/');
495+
sort($loadfiles);
496+
foreach ($loadfiles as $file) {
497+
include SITE_DIR . 'module/' . $name . '/autoload/' . $file;
493498
}
499+
unset($loadfiles);
494500
}
495501

496502
if (is_executable(SITE_DIR . 'lib/')) {

0 commit comments

Comments
 (0)