SuiteCRM crashes after deploying custom module

Hi,

I tried to deploy a simple custom module using SuiteCRM version 7.4.3, but the deployment was running forever. Then I checked the PHP error log:

PHP Fatal error: Call to undefined method dc_events_sugar::dc_events_sugar() in /var/www/html/suitecrm/modules/dc_events/dc_events.php on line 47, referer: http://121.40.228.135:4000/suitecrm-tmp/index.php?module=ModuleBuilder&action=index&type=mb

The whole system became unusable, but fortunately I made a backup.

Everytime I try to deploy a custom module again I run into the same problem.

Any thoughts on how to solve this issue?

The custom module appears in my Installed Modules list (Module Loader - extensions), but it doesn’t have an Uninstall or Disable option (the package actually is un-installable, so it seems to be corrupted in my system)

I tried to remove it manually as described in this post:

https://suitecrm.com/forum/developer-help/2580-module-installer-bug-how-to-manually-remove-custom-module#10499

Now my suitecrm doesn’t load anymore. The problem is that my manually deleted custom module is still required somewhere in the code:

PHP Fatal error: require_once(): Failed opening required ‘modules/dc_events/dc_events.php’ (include_path=’/var/www/html/suitecrm-tmp/include/HTMLPurifier/standalone:/var/www/html/suitecrm-tmp/include/…:.:/usr/share/pear:/usr/share/php’) in /var/www/html/suitecrm-tmp/include/utils/autoloader.php on line 83

The $GLOBALS(‘beanFiles’) variable still contains a reference to the deleted module.
Any idea which part of the code I have to change in order to remove the reference?

I found out that the module is still referenced from within the following file:

custom/application/Ext/Include/modules.ext.php

If I remove the custom module from that file the crm loads again.

However, the modules.ext.php file is auto generated, so as soon as you do a Quick Repair and Rebuild the crm stops working again.

How to make sure the crm does not look for the removed module anymore?

It’s a bit brute force but can you do a search of each file just looking for the name of your module? Just grep for the name in each file recursively from the root of htdocs? then at least you can see all files that reference it, and then go through them hopefully there will only be one or two?

Yes, that’s exactly what I’ve been doing. It took me a while, but eventually all references to the custom module were cleared. However, even though the name of the custom module could not be found anymore using grep recursively from within the suitecrm root folder, the system was still complaining about a required include which it could not find.

I solved it eventually by recreating the custom module (same name, fields, etc), so it stopped complaining about the required include. Then I uninstalled the module using the Module Loader. Thereafter, all errors were gone.