0

我开发了一个自定义模块并从后台安装它。最近我需要更改模块名称。

我尝试了这些步骤。

  1. 卸载我的模块

  2. 重命名我的模块文件夹名称(my_shipping -> shipping_module )

  3. 重命名模块文件夹下的模块文件(my_shipping.php -> shipping_module)

  4. 重命名类名和 __construct 名

然后我刷新了我的后台模块选择,我在installed modules选项卡下看到了它。(但我在卸载它时已经开始了这些步骤)。然后我尝试卸载它。然后它告诉我

无法卸载模块 xxx 。模块未安装。

如何重命名我现有的自定义模块?

class Shipping_module extends CarrierModule
{
    protected $config_form = false;

    public function __construct()
    {
        $this->name          = 'shipping_module';
        $this->tab           = 'shipping_logistics';
        $this->version       = '1.0.0';
        $this->author        = 'DDD';
        $this->need_instance = 0;
    }
}
4

2 回答 2

1

对我来说,由于某些错误,它似乎没有在第 1 步被卸载。

试试这个步骤。

  1. 将其重命名为原来的名称,然后卸载并删除它(卸载后有一个复选框可以删除模块)。

  2. 一旦您确定它已被删除,请使用新名称、文件夹、类以及模块文件中每次出现的类名重命名它。

  3. 再次安装模块;将调试模式保持为 ON,这样您就可以看到可能出现的任何错误。

于 2020-05-19T07:25:47.257 回答
1

选项:

  1. 删除 /modules/moduletodelete 中的模块文件夹
  2. 转到模块主文件(类)并尝试运行“卸载”功能。

  3. 如果你喜欢重命名模块,你需要运行尝试下一个代码:

     $this->name = 'custom';
     $this->tab = 'custom';
     $this->version = '0.0.1';
     $this->author = 'custom';
     $this->need_instance = 0;
     $this->add();//or $this->save;
    

第 2 点的示例:转到 /modules/moduletodelete/moduletodelete.php,检查卸载函数的调用方式(类似于“public function uninstall()”)并尝试运行下一个代码:

$this->[name_of_uninstall()]; //example $this->uninstall();
于 2020-05-20T10:16:49.033 回答