At versioncontrol module(whre we are trying to fix tests: #893010: Fix tests) we have a little piece of code that seems to be too hacky at the start of hook_menu():

  // FIXME this is hacky; it forces autoload to rebuild its cache to ensure
  // everything is up-to-date, since we need it to be for this function.
  if (function_exists('autoload_get_lookup')) {
    // for autoload 1.x
    autoload_get_lookup(TRUE);
  }
  else {
    // autoload 2.x branch
    autoload_registry_update();
  }

So, is this the better way to deal with this problem?

There is exactly the same problem for dbtng module(see #957262: Make sure autoload registry is setup), so it would be great to receive a suggestion :-)

Comments

Crell’s picture

Eew. :-)

The 1.x code should still work in the 2.x branch, though. If not, autoload_get_lookup() should be modified to call autoload_registry_update().

Or you could just assume a 2.x dependency once that's declared stable. Dave's handling that branch and I'm hoping to hand the module over to him once the 2.x is released. (I haven't told him that, though, so don't let him find out. Shhh!)

dave reid’s picture

Status: Active » Fixed
marvil07’s picture

Status: Fixed » Active

Thanks for the commit for backward compatibility :-)

But my question is to ask if there is another way to have autoload working without calling autoload_registry_update() at hook_menu(). I suppose I am missing something at implementing autoload API in versioncontrol module.

Crell’s picture

Issue summary: View changes
Status: Active » Closed (fixed)