我开发了一个自定义模块并从后台安装它。最近我需要更改模块名称。
我尝试了这些步骤。
-
卸载我的模块
-
重命名我的模块文件夹名称 (my_shipping -> shipping_module (
-
重命名模块文件夹 (my_shipping.php -> 下的模块文件 shipping_module(
-
重命名类名和__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;
}
}
对我来说,由于某些错误,它似乎没有在步骤#1中卸载。
请尝试此步骤。
将其重命名为原来的样子,然后卸载并删除它(有一个复选框用于卸载模块后删除模块(。
一旦确定它已被删除,请使用新名称、文件夹、类以及模块文件中出现的每次类名对其进行重命名。
再次安装模块;将调试模式保持为 ON,以便可以看到可能出现的任何错误。
选项:
删除/- modules/module 中的模块文件夹以删除
转到模块主文件(类(并尝试运行"卸载"功能。
如果你想重命名模块,你需要运行尝试下一个代码:
$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,检查如何调用卸载函数(类似于"公共函数卸载(("(,并尝试运行下一个代码:
$this->[name_of_uninstall()]; //example $this->uninstall();