Skip to content

Commit

Permalink
Require module autoload file before module init (#3397)
Browse files Browse the repository at this point in the history
* Require module autoload file before module init

* Change module loading to require once
  • Loading branch information
samerton committed Jun 17, 2023
1 parent 28a2ada commit 9d559e2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions core/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* Made by Samerton
* https://github.com/NamelessMC/Nameless/
* NamelessMC version 2.0.2
* NamelessMC version 2.1.1
*
* License: MIT
*
Expand Down Expand Up @@ -454,9 +454,17 @@
return $a['priority'] - $b['priority'];
});

// Load module dependencies
foreach ($enabled_modules as $module) {
if (file_exists(ROOT_PATH . '/modules/' . $module['name'] . '/autoload.php')) {
require_once ROOT_PATH . '/modules/' . $module['name'] . '/autoload.php';
}
}

// Load modules
foreach ($enabled_modules as $module) {
if (file_exists(ROOT_PATH . '/modules/' . $module['name'] . '/init.php')) {
require(ROOT_PATH . '/modules/' . $module['name'] . '/init.php');
require_once ROOT_PATH . '/modules/' . $module['name'] . '/init.php';
}
}

Expand Down

0 comments on commit 9d559e2

Please sign in to comment.