gpt4 book ai didi

php - 如何以编程方式禁用和卸载 Drupal 模块?

转载 作者:IT王子 更新时间:2023-10-29 00:20:04 25 4
gpt4 key购买 nike

我希望能够在我的本地环境中以编程方式禁用然后卸载模块,然后轻松将该代码推送到产品,以便所有内容都得到更新。

我猜这与 hook_update_N 有关.但不确定从哪里开始。

最佳答案

我想我找到了答案!在模块 .install 文件中,我添加了这段代码:

/**
* Disable and uninstall the module.
*/
function MODULE_update_7200() {
if( module_exists('MODULE')) {
module_disable(array('MODULE'));
drupal_uninstall_modules(array('MODULE'));
}
}

函数中的数字应该反射(reflect)您的 drupal 安装。在这里查看如何给它们编号:http://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_update_N/7

关于php - 如何以编程方式禁用和卸载 Drupal 模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13708873/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com