Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It appears that xautoload works fine on install for hook_schema but when uninstalling it fails. I have found a workaround by storing a table of schema data in the database on installation and using that for the uninstall but it would be better if I could find a way to load on uninstall so I dont need to use the workaround.
Comments
Comment #1
donquixote CreditAttribution: donquixote commentedHi!
This requires some more thinking.
At the moment that you uninstall a module, this module is already disabled. So naturally, xautoload does not register this module's namespaces.
At this time we cannot even guarantee that xautoload itself is enabled. Because module dependencies do only apply to enabled modules.
The only solution I could think of is to roll your own mini class loader as a fallback. Or include those classes manually.
You can have a look at xautoload.emulate.inc for some inspiration :) it is really not hard to make a custom class loader for a very specific purpose.
The emulate.inc in 7.x-2.x is for the pseudo-PEAR variation of xautoload, but it shouldn't be so hard to adapt that for PSR-0.
EDIT:
I would recommend that you only activate this fallback loader during uninstall, but continue to depend on xautoload while the module is enabled.
Comment #2
donquixote CreditAttribution: donquixote commentedI think not much we can do. I am closing this.
The xautoload.emulate.inc is a bit nicer in 7.x-3.x, btw.
Comment #3
damiandennis CreditAttribution: damiandennis commentedThanks I will look into the xautoload.emulate.inc