Misleading instructions after enabling a module.

cpugeniusmv - June 6, 2008 - 23:49
Project:Update Status
Version:5.x-2.x-dev
Component:User interface
Category:bug report
Priority:minor
Assigned:dww
Status:closed
Description

After enabling a module, the update cache is flushed and you see the message in the attached picture. The message leads me to believe that when cron runs next (either manually or scheduled), the update statuses will be re-cached but they aren't. The "check manually" link does work.

The source of the problem is that when the update cache is cleared, the update_last_check variable doesn't get reset. Cron will eventually update the cache on the schedule it would have done anyway without the new module installation. So it's not a critical problem, but it confused me enough to warrant this post :)

#1

cpugeniusmv - June 6, 2008 - 23:50

Here's the attachment.

AttachmentSize
update_cache_limbo.png 18.9 KB

#2

cpugeniusmv - August 12, 2008 - 17:47
Version:6.2» 7.x-dev
Status:active» needs review

This should fix the issue in 7.x-dev and 6.x-dev.

AttachmentSize
update_fix_cron.patch 476 bytes

#3

Dries - August 13, 2008 - 06:58

cpugeniusmv, this looks good but it might be good to add a code comment that provides some context.

#4

cpugeniusmv - August 13, 2008 - 14:15

Updated.

AttachmentSize
update_fix_cron_6.patch 541 bytes
update_fix_cron_7.patch 541 bytes

#5

dww - August 13, 2008 - 16:53
Status:needs review» needs work

I don't think this is the right patch for this problem. This clobbers the information about the last time we checked for updates. That's printed in the UI, and just because the cache is invalidated for some reason doesn't erase the fact that we last checked for updates 5 hours ago or whatever it is.

Instead, we need to change the logic in cron when deciding if we need to check for updates to use logic something like:

if (!$have_any_data || $been_too_long_since_we_last_checked) {
  // Check for updates.
}

#6

cpugeniusmv - August 13, 2008 - 18:38

I hadn't thought of that! I'll come up with a new patch.

#7

cpugeniusmv - August 16, 2008 - 21:34
Status:needs work» needs review

How's this?

AttachmentSize
update_fix_cron2_7-x.patch 828 bytes
update_fix_cron2_6-x.patch 828 bytes

#8

obsidiandesign - August 17, 2008 - 20:59

Code applies cleanly to d7 HEAD. Next cron update does update the module status page. +1 for RTBC.

#9

maartenvg - September 12, 2008 - 07:34
Status:needs review» reviewed & tested by the community

No longer applied, attached is a new version. (time() was replaced by $_SERVER['REQUEST_TIME'] recently)

Simple problem, simple patch, wonderful result. Marking RTBC.

AttachmentSize
update_fix_cron_7-x.patch 932 bytes

#10

webchick - September 17, 2008 - 19:42
Status:reviewed & tested by the community» needs work

Needs a re-roll again due to REQUEST_TIME.

Could we also see a before/after screenshot of what this patch changes? http://webchick.net/visualize-your-patches Preferably with some arrows pointing to what's wrong. I didn't quite grok it from the original description.

#11

cpugeniusmv - September 17, 2008 - 20:10
Status:needs work» reviewed & tested by the community

Re-rolled.

There are no changes made to the UI by this patch. Before this patch, if there is no cached update data (e.g., a module was just installed) and the amount of time that has passed since the last update fetch is less than the interval configured for update checks, running cron wouldn't get the update data.

The patch simply modifies the behavior of cron so that update data is fetched when it doesn't exist, regardless of the last time it was fetched.

AttachmentSize
update_fix_cron_7-x.patch 840 bytes

#12

System Message - September 17, 2008 - 20:12
Status:reviewed & tested by the community» needs work

Patch failed to apply. More information can be found at http://testing.drupal.org/node/14501. If you need help with creating patches please look at http://drupal.org/patch/create

#13

cpugeniusmv - September 17, 2008 - 20:13
Status:needs work» reviewed & tested by the community

Let's try this again...

AttachmentSize
update_fix_cron_7-x.patch 821 bytes

#14

System Message - September 17, 2008 - 20:22
Status:reviewed & tested by the community» needs work

Patch failed to apply. More information can be found at http://testing.drupal.org/node/14502. If you need help with creating patches please look at http://drupal.org/patch/create

#15

cpugeniusmv - September 17, 2008 - 20:33

Third time's a charm?

AttachmentSize
update_fix_cron_7-x.patch 868 bytes

#16

cpugeniusmv - September 18, 2008 - 01:32
Status:needs work» reviewed & tested by the community

#17

webchick - September 19, 2008 - 02:32

Ok, I think I duplicated this bug (it's hard to tell, because there aren't really testing instructions in this issue, and the modules page is so FUBAR right now) via the following:

Before patch:

  1. Enable Devel module
  2. See message about no update information available
  3. Click "run cron"
  4. See that the message about no update information available persists

After patch:

  1. Enable Devel module
  2. See message about no update information available
  3. Click "run cron"
  4. See that the message about no update information available goes away

The latter behaviour looks to be an improvement, so I committed. Let me know if there's something I overlooked.

Marking down to 6.x.

#18

webchick - September 19, 2008 - 02:38
Version:7.x-dev» 6.x-dev

Or I thought I did anyway. ;)

#19

maartenvg - September 19, 2008 - 06:17

Yup, that is exactly the way it should behave. Because the message (by update.module) tells you to run cron to solve a problem, and running cron doesn't solve the problem. That's annoying, and fixed by this patch.

Thanks for commiting!

Attached is the version for D6.

AttachmentSize
update_fix_cron_6x.patch 924 bytes

#20

Gábor Hojtsy - September 23, 2008 - 10:19
Status:reviewed & tested by the community» fixed

Added two sets of parenthesis so that the relations are obvious on first sight. Committed this one.

AttachmentSize
update_fix_cron_6x_2.patch 901 bytes

#21

dww - September 23, 2008 - 18:07
Version:6.x-dev» 7.x-dev
Status:fixed» reviewed & tested by the community

Now available in D7 with more parens (as per Gabor). ;) Once this lands (again), I'll fix D5 update_status in contrib...

AttachmentSize
267724_update_fix_cron_7x.21.patch 857 bytes

#22

webchick - September 23, 2008 - 19:08
Status:reviewed & tested by the community» fixed

Fixed! (again :))

#23

dww - September 23, 2008 - 19:33
Project:Drupal» Update Status
Version:7.x-dev» 5.x-2.x-dev
Component:update.module» User interface
Status:fixed» needs review

Thanks, webchick. ;)

Here's an untested backport to update_status D5 contrib.

AttachmentSize
267724_update_status_fix_cron_D5.23.patch 986 bytes

#24

dww - June 1, 2009 - 19:34
Assigned to:Anonymous» dww
Status:needs review» fixed

Now that #155450: backport separate {cache_update_status} table and private non-volatile cache API from D6 core is fixed, I ported #23, tested, and committed the attached patch to DRUPAL-5--2.

AttachmentSize
267724-24.update_status_fix_cron.d5.patch 1.81 KB

#25

System Message - June 15, 2009 - 19:40
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.