Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modules/backend/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class ServiceProvider extends ModuleServiceProvider
*/
public function register()
{
parent::register();

$this->registerConsole();
$this->registerMailer();
$this->registerAssetBundles();
Expand Down
2 changes: 2 additions & 0 deletions modules/cms/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class ServiceProvider extends ModuleServiceProvider
*/
public function register()
{
parent::register();

$this->registerConsole();
$this->registerTwigParser();
$this->registerAssetBundles();
Expand Down
2 changes: 2 additions & 0 deletions modules/system/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class ServiceProvider extends ModuleServiceProvider
*/
public function register()
{
parent::register();

$this->registerSingletons();
$this->registerPrivilegedActions();

Expand Down
2 changes: 2 additions & 0 deletions modules/system/classes/PluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ public function loadPlugin(string $namespace, string $path): ?PluginBase
$className = $namespace . '\Plugin';
$classPath = $path . '/Plugin.php';

$this->app->make(ClassLoader::class)->autoloadPackage($namespace, $path);

try {
// Autoloader failed?
if (!class_exists($className)) {
Expand Down
35 changes: 31 additions & 4 deletions modules/system/tests/bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,34 @@
);

$loader->register();
$loader->addDirectories([
'modules',
'plugins'
]);

/*
* Manually register all module classes for autoloading
*/
foreach (glob($baseDir . '/modules/*', GLOB_ONLYDIR) as $modulePath) {
$loader->autoloadPackage(basename($modulePath), $modulePath);
}

/*
* Manually register all plugin classes for autoloading
*/
$dirPath = $baseDir . '/plugins';
if (is_dir($dirPath)) {
$it = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($dirPath, FilesystemIterator::FOLLOW_SYMLINKS)
);
$it->setMaxDepth(2);
$it->rewind();

while ($it->valid()) {
if (($it->getDepth() > 1) && $it->isFile() && (strtolower($it->getFilename()) === "plugin.php")) {
$filePath = dirname($it->getPathname());
$pluginName = basename($filePath);
$vendorName = basename(dirname($filePath));

$loader->autoloadPackage($vendorName . '\\' . $pluginName, $filePath);
}

$it->next();
}
}