drush_hack.inc replaces Autoload's class loader with it's own implementation in drush tasks. This was an attempt to work around #547736: Autoload fails with drush which has now been fixed. Worse though, is that the code breaks autoloading if you use Autoload 6.x-2.x as autoload_get_lookup() doesn't return anything now:

As the code is now unneeded and it's probably a bad idea to use it, can we remove it?


Dean Reilly’s picture

Title: Remove drush_hack.inc » Remove old drush autoload workaround
1.54 KB
Dean Reilly’s picture

Status: Active » Needs review
Dean Reilly’s picture

I've also posted a patch to the notifications tools issue queue to remove references to the file. #1748012: Module doesn't work with Autoload 2.x. Stop using drush_hack.inc.

jataylor’s picture

I'm trying to upgrade to Autoload 6.x-2.1, and everything seems to be working ok, except that even after removing the drush_hack.inc file I am getting this error:

PHP Fatal error: Class 'Messaging_Store' not found in /sites/all/modules/contrib/messaging/messaging.module on line 564

As far as I can tell though, nothing is actually breaking because of it. Do you have any idea what would cause this?

Dean Reilly’s picture

Title: Remove old drush autoload workaround » Update Messaging to work with the latest version of autoload
Status: Needs review » Needs work

Hi jataylor,

Messaging still uses the old hook_autoload_info() method of defining classes (http://drupalcode.org/project/messaging.git/blob/refs/heads/6.x-4.x:/mes...) which is no longer supported by the latest version of autoload. You'll want to convert it to a files array in the info file (http://drupalcode.org/project/autoload.git/blob/refs/heads/6.x-2.x:/READ...). Something like:

files[] = includes/messaging_object.class.inc
files[] = includes/messaging_destination.class.inc
files[] = includes/messaging_message.class.inc
files[] = includes/messaging_method.class.inc
files[] = includes/messaging_store.class.inc

Let me know how you get on. I'll do some testing over the weekend and update the patch then (unless you want to take a crack at it before then).

jataylor’s picture

Status: Needs work » Needs review

That appears to have fixed my issue, thanks Dean.