|
|
@@ -16,8 +16,6 @@ use think\event\HttpRun;
|
|
|
use think\exception\Handle;
|
|
|
use think\Service;
|
|
|
|
|
|
-use function SixShop\Core\extension_path;
|
|
|
-
|
|
|
class CoreService extends Service
|
|
|
{
|
|
|
public static string $extensionPath;
|
|
|
@@ -27,16 +25,18 @@ class CoreService extends Service
|
|
|
*/
|
|
|
public static array $extensionComposerMap = [];
|
|
|
|
|
|
- /* @deprecated */
|
|
|
- public static array $extensionNameList = [];
|
|
|
-
|
|
|
- private static array $normalExtensionNameList = [];
|
|
|
+ private static array $invalidExtensionIDs = [];
|
|
|
|
|
|
public static function getExtensionComposerMap(): array
|
|
|
{
|
|
|
return self::$extensionComposerMap;
|
|
|
}
|
|
|
|
|
|
+ public static function getExtensionNameList(): array
|
|
|
+ {
|
|
|
+ return array_diff(array_keys(self::$extensionComposerMap), self::$invalidExtensionIDs);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @throws ParsingException
|
|
|
*/
|
|
|
@@ -50,7 +50,6 @@ class CoreService extends Service
|
|
|
);
|
|
|
self::$extensionPath = $this->app->getRootPath() . 'extension' . DIRECTORY_SEPARATOR;
|
|
|
$this->initExtensionList();
|
|
|
- $this->compatibleExtensionNameList();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -86,38 +85,16 @@ class CoreService extends Service
|
|
|
file_put_contents($extensionComposerFile, $content);
|
|
|
}
|
|
|
|
|
|
- /* @deprecated */
|
|
|
- private function compatibleExtensionNameList(): void
|
|
|
- {
|
|
|
- if (empty(self::$extensionNameList)) {
|
|
|
- self::$extensionNameList = array_keys(self::$extensionComposerMap);
|
|
|
- $normalFile = $this->app->getRootPath() . 'runtime/module_name_list_normal.php';
|
|
|
- if (file_exists($normalFile)) {
|
|
|
- $normalExtensionList = require $normalFile;
|
|
|
- foreach ($normalExtensionList as $item) {
|
|
|
- if (array_key_exists($item, self::$extensionComposerMap)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (is_dir(extension_path($item) . 'src')) {
|
|
|
- self::$extensionNameList[] = $item;
|
|
|
- self::$normalExtensionNameList[] = $item;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* @throws ReflectionException
|
|
|
*/
|
|
|
public function boot(): void
|
|
|
{
|
|
|
$autoloadService = $this->app->make(AutoloadService::class);
|
|
|
- $invalidExtensionIDs = $autoloadService->load(self::$extensionComposerMap, self::$normalExtensionNameList);
|
|
|
- self::$extensionNameList = array_diff(self::$extensionNameList, $invalidExtensionIDs);
|
|
|
+ self::$invalidExtensionIDs = $autoloadService->load(self::$extensionComposerMap);
|
|
|
$this->app->get('extension.system')->boot();
|
|
|
- foreach (self::$extensionComposerMap + self::$normalExtensionNameList as $moduleName => $_) {
|
|
|
- if (in_array($moduleName, $invalidExtensionIDs)) {
|
|
|
+ foreach (self::$extensionComposerMap as $moduleName => $_) {
|
|
|
+ if (in_array($moduleName, self::$invalidExtensionIDs)) {
|
|
|
continue;
|
|
|
}
|
|
|
$extension = $autoloadService->getExtension($moduleName);
|