Update.module seems to be forgetting its data, even just a few minutes after the last check. Doesn't matter whether I check manually or run cron, it only retains its data very briefly. It looks like it forgets it's data every time the modules page is submitted (not just loaded).

Steps to reproduce:

  • load modules page, see warning,
  • run update, all is good,
  • click around, come back, still good,
  • submit modules page, data missing again.

I do have two modules installed which are works in progress and thus not in CVS yet (so they lack version info). Could that be related?

Comments

dww’s picture

Category: bug » support
Status: Active » Closed (works as designed)

Every time you submit the modules page, update status clears its cache of available update data. That's because you might have enabled modules, and it wouldn't have the info about those. This is expected behavior, not a bug.

seanr’s picture

Why not have it re-fetch the update data on submit? I think this is actually a usability issue - the current behavior is rather unintuitive. If it confused me (I've been building Drupal sites for five years), it'd definitely be an issue for new users.

darrellduane’s picture

I agree that this is confusing, and I've been using Drupal for 3 years. I think seanr's idea is good. Alternatively, rather than clearing the entire cache, perhaps there is a way to preserve the cache data and update it as needed only for the modules that have been turned on and turned off .

I think the way to fix this is to override the submit form handler #submit to call a new function which re-fetches the update data, and then perhaps add it as an option to the DrupalTweaks module or something. I did some work on this 'cos it was bugging me.

Here's a quick snippet you can put in one of your custom modules to make this fix:

function yourmodulename_form_alter(&$form, $form_state, $form_id){
  
  if($form_id == 'system_modules' || $form_id == 'system_themes_form' ){

    // find where in the submit array update_invalidate_cache is being called   
    $key = array_keys($form['#submit'],'update_invalidate_cache');

    // replace it with the update_refresh call
    // note that we don't need to call update_invalidate_cache or
    // _update_cache_clear() since it already gets called as a part of update_refresh
    $form['#submit'][$key[0]] = 'update_refresh';    

  }
}
darrellduane’s picture

http://drupal.org/node/1010526 has been submitted for a feature request for the the Drupal Tweaks module.

dww’s picture

Note: tweaks and UI fixes for update status module that can't make it into core b/c of string freeze and other rules generally go into http://drupal.org/project/update_advanced

Cheers,
-Derek