如何卸载覆盖核心用户模块的模块?

发布于 2024-09-16 13:14:45 字数 258 浏览 9 评论 0原文

我的一位开发人员想要覆盖核心用户模块的某些功能。他复制了核心用户模块并将其放置在sites/all/modules 文件夹中。功能中的某些东西搞砸了,现在我不知道如何卸载它。我尝试从站点/所有/模块文件夹中删除该模块,但它现在使站点崩溃。然后,我编辑系统表以确保所有条目都指向原始用户模块,但现在我遇到了用户模块问题和奇怪的异常情况。覆盖核心模块是一种不好的做法吗? 还有其他桌子需要清洁吗?删除无法通过管理控制面板删除的模块的可靠方法是什么,因为在这种情况下,覆盖的用户模块永远不会出现在模块列表中。

One of my developers wanted to override some functionality of the core user module. He made a copy of the core user module and placed it in the sites/all/modules folder. Something in the functionality screwed up and now I am not sure how to uninstall it. I have tried deleting the module from the sites/all/modules folder and it now crashes the site. I then edit the systems table to make sure all entries point to the original user module but now I have problems with the user module and weird anomalies. Is it a bad practice to override core modules?
Are there any other tables that need to be cleaned? What is a sure shot way of removing a module which cannot be removed via Admin control panel as in this case the overriden user module never appears in the module list.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

稳稳的幸福 2024-09-23 13:14:45

覆盖核心模块是一种不好的做法吗?

是的。不要覆盖核心模块:糟糕的事情(就像你现在遇到的那样)会发生。

还有其他桌子需要清洁吗?

如果不知道您的 user 模块版本中的代码,就不可能知道这一点,但即使知道,损害也已经造成了。

删除无法通过管理控制面板删除的模块的可靠方法是什么,因为在这种情况下,覆盖的用户模块永远不会出现在模块列表中。

通常,如果您由于某种原因无法访问模块管理页面,您可以运行以下命令来卸载该模块:

module_load_install($module);
$versions = drupal_get_schema_versions($module);
drupal_set_installed_schema_version($module, SCHEMA_UNINSTALLED);
module_invoke($module, 'uninstall');

然后删除覆盖模块的文件并重新安装原始模块。您必须在运行卸载挂钩之后删除这些文件,因为这些文件包含卸载期间需要执行的代码。

但是,由于您已经覆盖了 user 模块,因此您的处境非常糟糕,因为您无法卸载 user 模块:并不意味着需要核心模块被篡改。

因此,摆脱当前困境的可靠方法是删除覆盖模块并从以前的数据库备份中恢复。

Is it a bad practice to override core modules?

Yes. Do not override core modules: Bad Things (like what you have now) happen.

Are there any other tables that need to be cleaned?

This is impossible to tell without knowing the code in your version of the user module, but even knowing it the damage has already been done.

What is a sure shot way of removing a module which cannot be removed via Admin control panel as in this case the overriden user module never appears in the module list.

Normally, if you can't access the module administration page for whatever reason, you'd run the following to uninstall the module:

module_load_install($module);
$versions = drupal_get_schema_versions($module);
drupal_set_installed_schema_version($module, SCHEMA_UNINSTALLED);
module_invoke($module, 'uninstall');

Then delete the overriding module's files and re-install the original module. You have to delete the files after running the uninstall hooks because the files contain the code that needs to be performed during the uninstall.

However, since you've overridden the user module, you're in a really bad place, as you can't uninstall the user module: required core modules are not meant to be tampered with.

So, the surefire way to get out of the mess you're currently in is to delete the overriding module and restore from a previous database backup.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文