Magento2 升级脚本从模块数组中删除模块

Magento2 upgrade script removes module out of modules array

我有我的模块配置

app/code/SET/HelloWorld/etc.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
    
    <router id="standard">
    
        <route id="helloworld" frontName="helloworld">
    
            <module name="SET_HelloWorld" />
    
        </route>
    
    </router>
    
</config>
       

并添加到etc/config。php:

'SET_HelloWorld' => 1,

但是在 运行 bin/magento setup:upgrade 之后 config.php 数组中的键消失了。

谁能告诉我为什么?

我发现我错过了 Registration.php

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'SET_HelloWorld',
    __DIR__
);

如果模块未注册,magento 会自动将其从 config.php 数组中删除。

这个注册是最近才加的,网上好多教程都没找到