Seeing the following error on first installing oauth_common. autoload and inputstream modules were already installed without error.

Fatal error: Class 'OAuthCommonHooks' not found in /drupal-6.13/sites/all/modules/oauth_common/oauth_common.module on line 58

environment:
MySQL 5.0.51a
PHP 5.2.4-2ubuntu5.5
Drupal 6.13
autoload 6.x-1.3
inputstream 6.x-1.0
oauth_common 6.x-1.0-beta3

Comments

xolotl’s picture

is the problem here the same mentioned in this autoload module issue?
http://drupal.org/node/359147

would it be as simple as renaming the include files to load in an alphabetical order that matches their dependencies?

Hugo Wetterberg’s picture

Assigned: Unassigned » Hugo Wetterberg

Hi Xolotl,
This has something to do with cache clearing. I'll take a closer look at this, but for now, just clear your cache.

/Hugo

xolotl’s picture

You were right. I was able to avoid the error by manually deleting a record from the cache table with a cid of "autoload:" after I had enabled the oauth_common module and encountered the error. Sorry I don't have more info.

RobLoach’s picture

Hugo, what are your thoughts on merging in the class hooks into the .module file?

Hugo Wetterberg’s picture

Do you mean skipping the dependency on the autoload module? It looks like it's either that or to programmatically flush the autoload cache entry when the module is enabled. It's just that autoload is such a nice thing to have, thank god that this problem will go away with the code registry.

I've taken a look at this again, and it should probably be solved by adding:

/**
 * Implementation of hook_enable().
 */
function services_oauth_enable() {
  // Flush the autoload caches so that our classes are registered
  autoload_flush_caches();
}

This should probably be done by all modules that use the autoload module.

Hugo Wetterberg’s picture

Ok, update has been committed to CVS and will show up in the dev snapshot.

xolotl’s picture

Looks like success! I did not encounter the error upon installing the 6.x-1.0-beta4 version. I did have to disenable and reenable the oauth_common module to avoid the error.

Hugo Wetterberg’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

smelliott’s picture

Sorry, I installed 6.x-1.0-beta4 and I still get this error.
Drupal 6.13
autoload 6.x-1.3
inputstream 6.x-1.0
oauth_common 6.x-1.0-beta4
Class 'OAuthCommonHooks' not found in /public_html/sites/all/modules/oauth_common/oauth_common.module on line 60

kehan’s picture

Status: Closed (fixed) » Active

Afraid I'm also getting this - apologies for issue spamming - I'm just upgrading my various services to the latest services and friends modules - love the principal of everything here I must say especially granular access control for individual service methods.

I've also been using drush (a lot), and #547736 indicates that autoload doesn't work when being called from the CLI.

valkum’s picture

he wrote that he put this in dev snapshot ;) try the dev version.

kehan’s picture

Status: Active » Fixed

Apologies - it was actually #547736: Autoload fails with drush, and a need for clearing the cache.

kehan’s picture

Priority: Normal » Critical
Status: Fixed » Active

I have discovered that both the 6.x-1.x-dev build and the 6.x-1.0-beta4 build break drupal database updates.

The version from October 12th on github however works fine - I think there has been some refactoring as autoload wasn't working for drupal hooks like hook_user and hook_menu.

Anyway to fix the issues use the version available at:

http://github.com/hugowetterberg/oauth_common

Hugo Wetterberg’s picture

Version: 6.x-1.x-dev » 6.x-1.0-beta5
Status: Active » Fixed

This is fixed in the current release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.